Skip to main content
PATCH
/
snippets
/
{id}
Update a snippet
curl --request PATCH \
  --url https://api.getfernand.com/snippets/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "title": "Updated Welcome Message",
  "shortcut": "welcome2",
  "categories": [
    2,
    4
  ],
  "actions": [
    {
      "name": "assign",
      "data": {
        "agent_id": 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 an existing snippet. All fields are optional, allowing partial updates. If categories are included in the request, they will replace the existing category assignments. Actions are validated to ensure they are supported with a maximum of 10 actions per snippet.

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.

Body

application/json
title
string | null

New title for the snippet (optional).

Maximum string length: 50
Example:

"Updated Welcome Message"

shortcut
string | null

New keyboard shortcut (optional, lowercase, numbers, and dashes only).

Maximum string length: 40
Example:

"welcome2"

categories
integer[] | null

New array of category IDs (optional, replaces existing categories).

Example:
[2, 4]
actions
object[] | null

New array of actions (optional, 1-10 actions if provided).

Required array length: 1 - 10 elements
Example:
[
{
"name": "assign",
"data": { "agent_id": 5 }
}
]

Response

Snippet 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)