> ## Documentation Index
> Fetch the complete documentation index at: https://mitchsorg.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an Income Source

> This endpoint creates an income source for the specified user.

The details that should be specified in the request body are:

- the income source (string) - the income's description
- the payDate (date) - the date the income was paid
- the category (string) - the category of the income
- the account's id (string) - the account that was credited
- the amount (number) - the amount made from the income source
    

> When you're withdrawing from an investment, you can use this endpoint by assigning the investment ID to the income source. This will ensure the amount is deducted from the investment and credited to the account. 
  

The response body is a JSON object that includes an array of all the user's income sources. The individual income object contains:

- the income source (string) - the income's description
- the payDate (date) - the date the income was paid
- the category (string) - the category of the income
- the account's id (string) - the account that was credited
- the amount (number) - the amount made from the income source
- _id (string) - the unique identifier for the income



## OpenAPI

````yaml post /income/add
openapi: 3.0.0
info:
  title: Cashboard API
  description: >-
    Cashboard is a personal finance tool that helps users keep track of their
    income, expenses, savings and investments.


    API URL: `https://cashboard-f5x2.onrender.com`


    The Cashboard API has endpoints for:


    - Users

    - Accounts

    - Income

    - Expenses

    - Savings

    - Investments
  version: 1.0.0
servers:
  - url: https://cashboard-f5x2.onrender.com
security: []
tags:
  - name: User
    description: |-
      Cashboard uses the users endpoint to:

      - create a new user
      - get a user details
      - update user details
          

      The endpoint URL: `https://cashboard-f5x2.onrender.com/user`
  - name: Account
    description: |-
      These endpoints are used to:

      - create account
      - get all user's accounts
      - get account
      - update accounts
      - delete accounts.
          

      The endpoint URL is: `https://cashboard-f5x2.onrender.com/account`
  - name: Income
    description: |-
      These endpoints are used to:

      - create an income source
      - get all income source
      - get an income source
      - update income source
      - delete income source
          

      The endpoint URL: `https://cashboard-f5x2.onrender.com/income`
  - name: Expenses
    description: |-
      These endpoints are used to:

      - create an expense
      - get all expenses
      - get an expense
      - update an expense
      - delete an expense
          

      The endpoint URL is: `https://cashboard-f5x2.onrender.com/expenses`
  - name: Savings
    description: |-
      These endpoints are used to:

      - create a saving
      - get all savings
      - get a saving
      - update a saving
      - delete a saving
          

      The endpoint URL: `https://cashboard-f5x2.onrender.com/savings`
  - name: Investments
    description: |-
      These endpoints are used to:

      - create an investment
          
      - get all investments
          
      - get an investment
          
      - update an investment
          
      - delete an investment
          

      The endpoint URL: `https://cashboard-f5x2.onrender.com/investments`
paths:
  /income/add:
    post:
      tags:
        - Income
      summary: Create an Income Source
      description: >-
        This endpoint creates an income source for the specified user.


        The details that should be specified in the request body are:


        - the income source (string) - the income's description

        - the payDate (date) - the date the income was paid

        - the category (string) - the category of the income

        - the account's id (string) - the account that was credited

        - the amount (number) - the amount made from the income source
            

        > When you're withdrawing from an investment, you can use this endpoint
        by assigning the investment ID to the income source. This will ensure
        the amount is deducted from the investment and credited to the account. 
          

        The response body is a JSON object that includes an array of all the
        user's income sources. The individual income object contains:


        - the income source (string) - the income's description

        - the payDate (date) - the date the income was paid

        - the category (string) - the category of the income

        - the account's id (string) - the account that was credited

        - the amount (number) - the amount made from the income source

        - _id (string) - the unique identifier for the income
      parameters:
        - name: user
          in: query
          schema:
            type: string
          description: required
          example: '{{uuid}}'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              example:
                source: 'Side Hustle: Selling Shoes'
                payDate: 11/02/2024
                category: side hustle
                account: 662fbf9eac827e370c18d4b9
                amount: '7000'
      responses:
        '201':
          description: Created
          headers:
            Date:
              schema:
                type: string
                example: Mon, 29 Apr 2024 15:42:04 GMT
            Content-Type:
              schema:
                type: string
                example: application/json; charset=utf-8
            Transfer-Encoding:
              schema:
                type: string
                example: chunked
            Connection:
              schema:
                type: string
                example: keep-alive
            CF-Ray:
              schema:
                type: string
                example: 87c0664fbe21084d-IAD
            CF-Cache-Status:
              schema:
                type: string
                example: DYNAMIC
            ETag:
              schema:
                type: string
                example: W/"c6-4VgTxg1a8AFmYFE7OaKaXHnWseA"
            Vary:
              schema:
                type: string
                example: Origin, Accept-Encoding
            rndr-id:
              schema:
                type: string
                example: 167c87e6-9952-4b42
            x-powered-by:
              schema:
                type: string
                example: Express
            x-render-origin-server:
              schema:
                type: string
                example: Render
            Server:
              schema:
                type: string
                example: cloudflare
            alt-svc:
              schema:
                type: string
                example: h3=":443"; ma=86400
          content:
            application/json:
              schema:
                type: object
              example:
                income:
                  - source: 'Side Hustle: Selling Shoes'
                    payDate: '2024-11-02T00:00:00.000Z'
                    account: 662fbf9eac827e370c18d4b9
                    category: side hustle
                    amount: 7000
                    _id: 662fbfcaac827e370c18d4bf
        '500':
          description: Internal Server Error
          headers:
            Date:
              schema:
                type: string
                example: Mon, 29 Apr 2024 15:43:36 GMT
            Content-Type:
              schema:
                type: string
                example: application/json; charset=utf-8
            Transfer-Encoding:
              schema:
                type: string
                example: chunked
            Connection:
              schema:
                type: string
                example: keep-alive
            CF-Ray:
              schema:
                type: string
                example: 87c0689c4f62394a-IAD
            CF-Cache-Status:
              schema:
                type: string
                example: DYNAMIC
            ETag:
              schema:
                type: string
                example: W/"2f-5nVh4Q6rIS7qAyLOwv9hydVqSuU"
            Vary:
              schema:
                type: string
                example: Origin, Accept-Encoding
            rndr-id:
              schema:
                type: string
                example: ad87471b-3f50-44a2
            x-powered-by:
              schema:
                type: string
                example: Express
            x-render-origin-server:
              schema:
                type: string
                example: Render
            Server:
              schema:
                type: string
                example: cloudflare
            alt-svc:
              schema:
                type: string
                example: h3=":443"; ma=86400
          content:
            application/json:
              schema:
                type: object
              example:
                status: error
                message: Income not added

````