Skip to main content
PATCH
/
snippets
/
categories
/
{id}
Update a snippet category's name
curl --request PATCH \
  --url https://api.getfernand.com/snippets/categories/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "Updated Support"
}
'
import requests

url = "https://api.getfernand.com/snippets/categories/{id}"

payload = { "name": "Updated Support" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Updated Support'})
};

fetch('https://api.getfernand.com/snippets/categories/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getfernand.com/snippets/categories/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Support'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'

url = URI("https://api.getfernand.com/snippets/categories/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Support\"\n}"

response = http.request(request)
puts response.read_body
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.getfernand.com/snippets/categories/{id}"

payload := strings.NewReader("{\n \"name\": \"Updated Support\"\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
using RestSharp;


var options = new RestClientOptions("https://api.getfernand.com/snippets/categories/{id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-API-Key", "<api-key>");
request.AddJsonBody("{\n \"name\": \"Updated Support\"\n}", false);
var response = await client.PatchAsync(request);

Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.patch("https://api.getfernand.com/snippets/categories/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Support\"\n}")
.asString();
{
  "id": 5,
  "name": "Customer Support",
  "sort": 1,
  "parent_id": 2
}
{
"error": "<string>"
}
{
"error": "<string>"
}
Updates the name of an existing snippet category. The parent relationship and sort position are managed through the separate position endpoint.

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 update.

Body

application/json
name
string | null
required

New name for the category (optional).

Maximum string length: 50
Example:

"Updated Support"

Response

Category 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