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

# POST /v1/tickets/categories

> Add a ticket category: a name and a colour.

Adds a ticket category. Category names are unique on the account.

<Note>Needs the `tickets:write` scope.</Note>

## Body

| Field | Type | Required | Notes |
| :- | :- | :- | :- |
| `name` | string | Yes | Up to 60 characters; a longer name is cut short. |
| `colour` | string | No | `brand` (mint), `info` (blue), `warning` (amber), `ai` (violet), `rose` or `neutral` (grey). `brand` when left out. |

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.fireflo.au/v1/tickets/categories" \
    -H "Authorization: Bearer $OMNI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Warranty",
      "colour": "rose"
    }'
  ```

  ```python Python theme={null}
  import os

  import requests

  response = requests.post(
      "https://api.fireflo.au/v1/tickets/categories",
      headers={"Authorization": f"Bearer {os.environ['OMNI_API_KEY']}"},
      json={
          "name": "Warranty",
          "colour": "rose"
      },
  )
  print(response.status_code, response.json())
  ```

  ```javascript Node theme={null}
  const response = await fetch("https://api.fireflo.au/v1/tickets/categories", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.OMNI_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "name": "Warranty",
      "colour": "rose"
    }),
  });
  console.log(response.status, await response.json());
  ```
</CodeGroup>

## Response

`201 Created` — the category.

```json theme={null}
{
  "id": 7,
  "name": "Warranty",
  "colour": "rose"
}
```

## Errors

Every refusal is `{"error": {"code", "message", "field"}}`; `field` is there when one input is at fault.

| Status | Error code | When |
| :- | :- | :- |
| 400 | `invalid_request` | `name` is missing or already used by another category, or `colour` isn't one of the colours (`field` names it). |
| 400 | `invalid_json` | The body isn't valid JSON. |
| 404 | `module_off` | The account's plan doesn't include Tickets. |
| 403 | `scope_missing` | The key doesn't have the `tickets:write` scope. |

Any request can also be refused for its key, its account or its rate (`key_required`, `invalid_key`, `account_suspended`, `plan_excludes_api`, `address_not_allowed`, `rate_limited`); see [the overview](/api-reference/overview).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.