# Expense categories

## CREATE

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

Create a new expense category

#### Request Body

| Name | Type   | Description                        |
| ---- | ------ | ---------------------------------- |
| name | string | The name of the category to create |

{% tabs %}
{% tab title="200 Category successfully created." %}

```javascript
{
  "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/expense_categories/:categoryId`

Update an expense category

#### Request Body

| Name | Type   | Description                  |
| ---- | ------ | ---------------------------- |
| name | string | The new name of the category |

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

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

{% endtab %}

{% tab title="302 " %}

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

{% endtab %}
{% endtabs %}

## RETRIEVE

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

Retrieves the contents of an expense category

#### Path Parameters

| Name       | Type   | Description                                    |
| ---------- | ------ | ---------------------------------------------- |
| categoryId | string | The ID of the category to retrieve details for |

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

```
{
  "status": 1,
  "data": {
    "active": true,
    "_id": "5dcc0fc3a9e5e668a62c72e1",
    "organization": "5db5a64a6cb3e2060a7b864c",
    "user": "5cded7f553ea376e8bba6bfd",
    "name": "Salary",
    "dateCreated": "2019-11-13T14:14:27.095Z",
    "__v": 0
  }
}
```

{% endtab %}

{% tab title="302 Category not found" %}

```
{
  "status": 0,
  "message": "Category not found"
}
```

{% endtab %}
{% endtabs %}

## DELETE

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

Delete a category

#### Path Parameters

| Name       | Type   | Description                      |
| ---------- | ------ | -------------------------------- |
| categoryId | string | The ID of the category to delete |

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

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

{% endtab %}

{% tab title="302 Error" %}

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

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://developer.pesatime.com/expenses/expense-categories.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
