Skip to main content
PATCH
/
snippets
/
categories
/
{id}
/
position
Update a category's position and parent
curl --request PATCH \
  --url https://api.getfernand.com/snippets/categories/{id}/position \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '{
  "position": 2
}'
{
  "id": 5,
  "name": "Customer Support",
  "sort": 1,
  "parent_id": 2
}
Updates the sort position and parent relationship of a snippet category. This endpoint allows you to reorder categories within their parent or move them to a different parent category. The position is 0-based, and all sibling categories are automatically reordered to maintain a consistent sequence.

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 category to reposition.

Body

application/json
position
integer
required

New position within the parent (0-based index, required).

Example:

2

parent_id
integer | null

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

Example:

3

Response

Category position updated 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