Income Categories

These endpoints are used to manage categories for income entries.


List Income Categories

GET /api/income-categories

Description: Retrieves a list of all income categories for your company.

Authorization: API Key (Bearer Token) required.

Request

curl -X GET "https://your-summit-instance.com/api/income-categories" \
     -H "Authorization: Bearer <YOUR_API_TOKEN>"

Response (Success: 200 OK)

{
  "data": [
    {
      "id": 1,
      "companyId": 1,
      "name": "Consulting Services",
      "createdAt": "2023-10-01T00:00:00.000Z",
      "updatedAt": "2023-10-01T00:00:00.000Z",
      "softDelete": false
    }
  ],
  "total": 1
}

Create Income Category

POST /api/income-categories

Description: Creates a new income category.

Authorization: API Key (Bearer Token) required.

Request Body: application/json

  • Name
    name
    Type
    string
    Description

    Name of the income category.

Error Responses:

  • 400 Bad Request: If a category with the same name already exists.

Request

curl -X POST "https://your-summit-instance.com/api/income-categories" \
     -H "Authorization: Bearer <YOUR_API_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Product Sales"
     }'

Response (Success: 201 Created)

{
  "id": 2,
  "companyId": 1,
  "name": "Product Sales",
  "createdAt": "2023-10-27T13:00:00.000Z",
  "updatedAt": "2023-10-27T13:00:00.000Z",
  "softDelete": false
}

Get Income Category Details

GET /api/income-categories/{categoryId}

Description: Retrieves details for a specific income category.

Authorization: API Key (Bearer Token) required.

Path Parameters:

  • Name
    categoryId
    Type
    integer
    Description

    ID of the income category to retrieve.

Request

curl -X GET "https://your-summit-instance.com/api/income-categories/2" \
     -H "Authorization: Bearer <YOUR_API_TOKEN>"

Response (Success: 200 OK)

{
  "id": 2,
  "companyId": 1,
  "name": "Product Sales",
  "createdAt": "2023-10-27T13:00:00.000Z",
  "updatedAt": "2023-10-27T13:00:00.000Z",
  "softDelete": false
}

Update Income Category

PUT /api/income-categories/{categoryId}

Description: Updates an existing income category.

Authorization: API Key (Bearer Token) required.

Path Parameters:

  • Name
    categoryId
    Type
    integer
    Description

    ID of the income category to update.

Request Body: application/json

  • Name
    name
    Type
    string
    Description

    New name for the income category.

Error Responses:

  • 400 Bad Request: If another category with the new name already exists.

Request

curl -X PUT "https://your-summit-instance.com/api/income-categories/2" \
     -H "Authorization: Bearer <YOUR_API_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Online Product Sales"
     }'

Response (Success: 200 OK)

{
  "id": 2,
  "companyId": 1,
  "name": "Online Product Sales",
  "createdAt": "2023-10-27T13:00:00.000Z",
  "updatedAt": "2023-10-27T14:00:00.000Z",
  "softDelete": false
}

Delete Income Category

DELETE /api/income-categories/{categoryId}

Description: Soft deletes an income category.

Authorization: API Key (Bearer Token) required.

Path Parameters:

  • Name
    categoryId
    Type
    integer
    Description

    ID of the income category to delete.

Error Responses:

  • 400 Bad Request: If the category is in use (this check is not explicitly in the provided code, but is common).

Request

curl -X DELETE "https://your-summit-instance.com/api/income-categories/2" \
     -H "Authorization: Bearer <YOUR_API_TOKEN>"

Response (Success: 200 OK)

{
  "message": "Category deleted successfully"
}

Was this page helpful?