Update content template
curl --request PUT \
--url https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id} \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"default": true,
"name": "Updated Name",
"reference_text": "Updated content..."
}
'import requests
url = "https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}"
payload = {
"default": True,
"name": "Updated Name",
"reference_text": "Updated content..."
}
headers = {
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({default: true, name: 'Updated Name', reference_text: 'Updated content...'})
};
fetch('https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{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://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'default' => true,
'name' => 'Updated Name',
'reference_text' => 'Updated content...'
]),
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}"
payload := strings.NewReader("{\n \"default\": true,\n \"name\": \"Updated Name\",\n \"reference_text\": \"Updated content...\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("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))
}HttpResponse<String> response = Unirest.put("https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"default\": true,\n \"name\": \"Updated Name\",\n \"reference_text\": \"Updated content...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default\": true,\n \"name\": \"Updated Name\",\n \"reference_text\": \"Updated content...\"\n}"
response = http.request(request)
puts response.read_body{
"inserted_at": "2024-04-12T15:23:45Z",
"default": false,
"id": 123,
"name": "My Custom Template",
"reference_text": "Template content...",
"updated_at": "2024-06-01T09:17:33Z"
}{
"error": {
"details": [
{
"field": "keywords",
"reason": "required"
}
],
"reason": "validation_error"
}
}{
"error": {
"details": [],
"reason": "unauthorized"
}
}{
"error": {
"details": [],
"reason": "permission_denied"
}
}{
"error": {
"details": [],
"reason": "not_found"
}
}{
"error": {
"details": [
{
"allowed": [
"application/json"
],
"field": "accept",
"reason": "unsupported"
}
],
"message": "Accept must be one of: application/json",
"reason": "not_acceptable"
}
}{
"error": {
"details": [],
"message": "Set Content-Type: application/json.",
"reason": "unsupported_media_type"
}
}{
"error": {
"details": [
{
"retry_after": 30
}
],
"reason": "rate_limit_exceeded"
}
}Content Templates
Update content template
Updates a custom content template.
Rate limit: 10 requests/sec
PUT
/
api
/
v2
/
workspaces
/
{workspace_id}
/
content_templates
/
{id}
Update content template
curl --request PUT \
--url https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id} \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"default": true,
"name": "Updated Name",
"reference_text": "Updated content..."
}
'import requests
url = "https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}"
payload = {
"default": True,
"name": "Updated Name",
"reference_text": "Updated content..."
}
headers = {
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({default: true, name: 'Updated Name', reference_text: 'Updated content...'})
};
fetch('https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{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://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'default' => true,
'name' => 'Updated Name',
'reference_text' => 'Updated content...'
]),
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}"
payload := strings.NewReader("{\n \"default\": true,\n \"name\": \"Updated Name\",\n \"reference_text\": \"Updated content...\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("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))
}HttpResponse<String> response = Unirest.put("https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"default\": true,\n \"name\": \"Updated Name\",\n \"reference_text\": \"Updated content...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.surferseo.com/api/v2/workspaces/{workspace_id}/content_templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"default\": true,\n \"name\": \"Updated Name\",\n \"reference_text\": \"Updated content...\"\n}"
response = http.request(request)
puts response.read_body{
"inserted_at": "2024-04-12T15:23:45Z",
"default": false,
"id": 123,
"name": "My Custom Template",
"reference_text": "Template content...",
"updated_at": "2024-06-01T09:17:33Z"
}{
"error": {
"details": [
{
"field": "keywords",
"reason": "required"
}
],
"reason": "validation_error"
}
}{
"error": {
"details": [],
"reason": "unauthorized"
}
}{
"error": {
"details": [],
"reason": "permission_denied"
}
}{
"error": {
"details": [],
"reason": "not_found"
}
}{
"error": {
"details": [
{
"allowed": [
"application/json"
],
"field": "accept",
"reason": "unsupported"
}
],
"message": "Accept must be one of: application/json",
"reason": "not_acceptable"
}
}{
"error": {
"details": [],
"message": "Set Content-Type: application/json.",
"reason": "unsupported_media_type"
}
}{
"error": {
"details": [
{
"retry_after": 30
}
],
"reason": "rate_limit_exceeded"
}
}Authorizations
Path Parameters
Required range:
x >= 1Example:
123
Required range:
x >= 1Example:
123
Body
application/json
Content template params
Maximum string length:
100Example:
"Updated Name"
Reference content (UTF-8). 1–25,000 characters; must contain at least 200 words.
Stored and returned verbatim — no sanitization or normalization. Markdown is the recommended format; predefined Surfer templates use Markdown, and the in-app editor parses this field as Markdown.
The 200-word minimum is counted by a tokenizer over the raw string, so markup characters may or may not contribute to the count.
Maximum string length:
25000Example:
"Updated content..."
Response
Updated content template
Example:
"2024-04-12T15:23:45Z"
Example:
false
Required range:
x >= 1Example:
123
Example:
"My Custom Template"
Stored verbatim; Markdown recommended.
Example:
"Template content..."
Example:
"2024-06-01T09:17:33Z"
Was this page helpful?