> For the complete documentation index, see [llms.txt](https://developer.pesatime.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.pesatime.com/income/income.md).

# Income

## CREATE

<mark style="color:green;">`POST`</mark> `https://api.pesatime.com/v1/income`

Record a new sale

#### Request Body

| Name        | Type   | Description                                            |
| ----------- | ------ | ------------------------------------------------------ |
| category    | string | Category ID                                            |
| amount      | number | Amount                                                 |
| date        | string | The date this sale was made YYYY-MM-DD e.g. 2019-11-03 |
| description | string | Add any notes                                          |

{% tabs %}
{% tab title="200 Success" %}

```
{
  "status": 1,
  "message": "Saved",
  "data": {
    "_id": "5dce4b8a4d44af36f693cd2b"
  }
}
```

{% endtab %}

{% tab title="302 Error" %}

```
{
  "status": 0,
  "message": "Error message here"
}
```

{% endtab %}
{% endtabs %}

## UPDATE

<mark style="color:orange;">`PUT`</mark> `https://api.pesatime.com/v1/income/:incomeId`

Update an income

#### Path Parameters

| Name     | Type   | Description          |
| -------- | ------ | -------------------- |
| incomeId | string | The ID of the income |

#### Request Body

| Name        | Type   | Description               |
| ----------- | ------ | ------------------------- |
| date        | string | Date in format YYYY-MM-DD |
| description | string | The new description       |
| amount      | number | The new amount            |
| category    | number | New category ID           |

{% tabs %}
{% tab title="200 SUCCESS" %}

```
{
  "status": 1,
  "message": "Expense updated successfully"
}
```

{% endtab %}

{% tab title="302 Error" %}

```
{
  "status": 0,
  "message": "Error description here"
}
```

{% endtab %}
{% endtabs %}

## DELETE

<mark style="color:red;">`DELETE`</mark> `https://api.pesatime.com/v1/income/:incomeId`

Delete a sale

#### Path Parameters

| Name     | Type   | Description              |
| -------- | ------ | ------------------------ |
| incomeId | string | ID of the sale to delete |

{% tabs %}
{% tab title="200 Success" %}

```
{
  "status": 1,
  "message": "Expense deleted successfully"
}
```

{% endtab %}

{% tab title="302 Error" %}

```
{
  "status": 0,
  "message": "Error description here"
}
```

{% endtab %}
{% endtabs %}

## RETRIEVE - All

<mark style="color:blue;">`GET`</mark> `https://api.pesatime.com/v1/income`

Retrieve all sales made

#### Query Parameters

| Name        | Type   | Description                      |
| ----------- | ------ | -------------------------------- |
| category    | string | Category ID                      |
| description | string | Contains any of what is put here |
| date\_from  | string | The date this sale was made      |
| date\_from  | string | The date this sale was made      |

{% tabs %}
{% tab title="200 " %}

```
{
  "status": 1,
  "data": [
    {
      "amount": 10001,
      "active": true,
      "_id": "5dce51d0bf6c524c59a75c96",
      "organization": "5db5a64a6cb3e2060a7b864c",
      "user": "5cded7f553ea376e8bba6bfd",
      "category": {
        "_id": "5cdfb75bb8f2b84e5fb55ce6",
        "name": "Marketing"
      },
      "description": "New marketing deal",
      "date": "2019-01-23T00:00:00.000Z",
      "attachments": [],
      "dateCreated": "2019-11-15T07:20:48.818Z",
      "__v": 0
    },
    
    .......
  
  ]
}
```

{% endtab %}
{% endtabs %}

## RETRIEVE - single item

<mark style="color:blue;">`GET`</mark> `https://api.pesatime.com/v1/income/:incomeId`

Retrieve contents of one sale item

#### Query Parameters

| Name     | Type   | Description                |
| -------- | ------ | -------------------------- |
| incomeId | string | The ID of the item to pull |

{% tabs %}
{% tab title="200 " %}

```
{
  "status": 1,
  "data": {
    "amount": 10001,
    "active": true,
    "_id": "5dce51d0bf6c524c59a75c96",
    "organization": "5db5a64a6cb3e2060a7b864c",
    "user": "5cded7f553ea376e8bba6bfd",
    "category": {
      "_id": "5cdfb75bb8f2b84e5fb55ce6",
      "name": "Marketing"
    },
    "description": "Description here",
    "date": "2019-01-23T00:00:00.000Z",
    "attachments": [],
    "dateCreated": "2019-11-15T07:20:48.818Z",
    "__v": 0
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.pesatime.com/income/income.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
