---
title: "Create a category"
method: POST
path: "/api/external/v2/categories"
tags: ["Categories"]
---

# Create a category

`POST /api/external/v2/categories`

## Request

- Base URL: `https://app.pennylane.com`
- URL: `https://app.pennylane.com/api/external/v2/categories`
- Auth: OAuth 2
  - Authorization code: `https://app.pennylane.com/oauth/authorize`
  - Token URL: `https://app.pennylane.com/oauth/oauth/token` scopes: `categories:all`

Create a category

> ℹ️
> This endpoint requires the following scope: `categories:all`

## Headers

- `X-Company-Id` string

## Request body

- object
  - `label` string, required
  - `direction` union: Only applicable for _treasury_ categories. If not provided, defaults to "cash_out".
    - 'cash_in' | 'cash_out': Only applicable for _treasury_ categories
    - unknown
  - `category_group_id` integer, required
  - `analytical_code` string, nullable
  - `ledger_account_id` integer, nullable: Id of the ledger account to map to this category. Only valid for categories belonging to a category group with self-service accounting enabled; rejected otherwise. Bank, pending, and, when applicable, cash accounts cannot be used as transaction counterparts.

## Response `201`

Returns the created category

- object
  - `id` integer, required
  - `label` string, required
  - `direction` union, required
    - 'cash_in' | 'cash_out': Only applicable for _treasury_ categories
    - unknown
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `category_group` object, required
    - `id` integer, required
  - `analytical_code` string, nullable, required
  - `ledger_account` object, nullable, required: The ledger account the category is wired to, or `null` when none is set.
    - `id` integer, required
    - `url` string, required: The URL to the ledger account

## Other responses

- `400`: Bad request
- `401`: Access token is missing or invalid
- `403`: Access to this resource forbidden
- `404`: The resource was not found
- `422`: Unprocessable content

## Changes

- **2026-11-03** `871f863307e5`: 3 info
  - added the new optional `header` request parameter `X-Company-Id`
  - added the new optional request property `ledger_account_id`
  - added the required property `ledger_account` to the response with the `201` status

[Operation history](https://skmtc.dev/pennylane/apis/company-v2/changes/api/external/v2/categories/post.md)

---

[API](https://skmtc.dev/pennylane/apis/company-v2.md) - [All operations](https://skmtc.dev/pennylane/apis/company-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/pennylane/apis/company-v2/revisions/871f863307e5?raw)
