Skip to main content
POST
/
snippets
/
categories
Create a new snippet category
curl --request POST \
  --url https://api.getfernand.com/snippets/categories \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "Customer Support"
}
'
{
  "id": 5,
  "name": "Customer Support",
  "sort": 1,
  "parent_id": 2
}
Creates a new snippet category with the specified name and optional parent category. The category is automatically assigned a sort position at the end of its siblings. Categories can be nested to create hierarchical organization structures.

Authorizations

X-API-Key
string
header
required

Authenticate your account by including your secret key in API requests. You can manage your API keys in the Dashboard.

Authentication to the API is performed by using the HTTP Header X-API-Key.

Body

application/json
name
string
required

Name of the category (required).

Maximum string length: 50
Example:

"Customer Support"

parent_id
integer | null

ID of the parent category (optional, null for root-level category).

Example:

2

Response

Category created successfully.

id
integer<int32>
required

Unique identifier for the snippet category

Example:

5

name
string
required

Name of the category

Maximum string length: 250
Example:

"Customer Support"

sort
integer<int32>
required

Sort order within the parent category (1-based)

Example:

1

parent_id
integer<int32> | null

ID of the parent category (null for root-level categories)

Example:

2