Skip to main content
POST
/
snippets
/
{id}
/
categories
Update snippet's categories
curl --request POST \
  --url https://api.getfernand.com/snippets/{id}/categories \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "categories": [
    1,
    3,
    5
  ]
}
'
{
  "id": 42,
  "title": "Welcome Message",
  "created": "2024-01-15T10:30:00Z",
  "applied_count": 15,
  "categories": [
    1,
    3
  ],
  "actions": [
    {
      "id": 1,
      "name": "status",
      "data": {
        "status": "closed"
      },
      "sort": 0
    }
  ],
  "shortcut": "welcome",
  "last_applied_at": "2023-11-07T05:31:56Z"
}
Updates the categories assigned to a snippet. This endpoint replaces all existing categories with the provided list.

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.

Path Parameters

id
integer
required

ID of the snippet to update categories for.

Body

application/json
categories
integer[]
required

Array of category IDs to assign to this snippet (replaces existing assignments).

Example:
[1, 3, 5]

Response

Categories updated successfully.

id
integer<int32>
required

Unique identifier for the snippet

Example:

42

title
string
required

Title of the snippet

Maximum string length: 250
Example:

"Welcome Message"

created
string<date-time>
required

Timestamp when the snippet was created (UTC)

Example:

"2024-01-15T10:30:00Z"

applied_count
integer<int32>
required

Number of times this snippet has been applied

Example:

15

categories
integer[]
required

Array of category IDs this snippet belongs to (0 represents root category)

Example:
[1, 3]
actions
object[]
required

Array of actions to be applied when the snippet is used

Example:
[
{
"id": 1,
"name": "status",
"data": { "status": "closed" },
"sort": 0
}
]
shortcut
string | null

Optional keyboard shortcut to quickly insert the snippet (lowercase, numbers, and dashes only)

Maximum string length: 40
Example:

"welcome"

last_applied_at
string<date-time> | null

Timestamp when the snippet was last applied to a conversation (UTC)