CATEGORIES
Add or Update Category Translation
Add or update translation content for a given locale for preference categories and sections.
POST
/
v1
/
{workspace}
/
preference_category
/
translation
/
content
/
{locale}
/
Add Translation
curl -X POST "https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/" \
--header "Authorization: ServiceToken {token}" \
--header "Content-Type: application/json" \
--data '{
"sections": {
"account-updates": {
"name": "Actualizaciones de Cuenta",
"description": "Notificaciones importantes relacionadas con la cuenta"
}
},
"categories": {
"password-reset": {
"name": "Restablecimiento de Contraseña",
"description": "Notificaciones cuando se restablece la contraseña"
}
}
}'import requests
url = "https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/"
payload = {
"sections": { "account-updates": {
"name": "Actualizaciones de Cuenta",
"description": "Notificaciones importantes relacionadas con la cuenta"
} },
"categories": { "password-reset": {
"name": "Restablecimiento de Contraseña",
"description": "Notificaciones cuando se restablece la contraseña"
} }
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sections: {
'account-updates': {
name: 'Actualizaciones de Cuenta',
description: 'Notificaciones importantes relacionadas con la cuenta'
}
},
categories: {
'password-reset': {
name: 'Restablecimiento de Contraseña',
description: 'Notificaciones cuando se restablece la contraseña'
}
}
})
};
fetch('https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/', 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://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sections' => [
'account-updates' => [
'name' => 'Actualizaciones de Cuenta',
'description' => 'Notificaciones importantes relacionadas con la cuenta'
]
],
'categories' => [
'password-reset' => [
'name' => 'Restablecimiento de Contraseña',
'description' => 'Notificaciones cuando se restablece la contraseña'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ServiceToken <token>: <api-key>"
],
]);
$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://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/"
payload := strings.NewReader("{\n \"sections\": {\n \"account-updates\": {\n \"name\": \"Actualizaciones de Cuenta\",\n \"description\": \"Notificaciones importantes relacionadas con la cuenta\"\n }\n },\n \"categories\": {\n \"password-reset\": {\n \"name\": \"Restablecimiento de Contraseña\",\n \"description\": \"Notificaciones cuando se restablece la contraseña\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ServiceToken <token>", "<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.post("https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sections\": {\n \"account-updates\": {\n \"name\": \"Actualizaciones de Cuenta\",\n \"description\": \"Notificaciones importantes relacionadas con la cuenta\"\n }\n },\n \"categories\": {\n \"password-reset\": {\n \"name\": \"Restablecimiento de Contraseña\",\n \"description\": \"Notificaciones cuando se restablece la contraseña\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sections\": {\n \"account-updates\": {\n \"name\": \"Actualizaciones de Cuenta\",\n \"description\": \"Notificaciones importantes relacionadas con la cuenta\"\n }\n },\n \"categories\": {\n \"password-reset\": {\n \"name\": \"Restablecimiento de Contraseña\",\n \"description\": \"Notificaciones cuando se restablece la contraseña\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"sections": {
"new-5": {
"name": null,
"description": null
},
"nik-section-for-transactional": {
"name": null,
"description": null
}
},
"categories": {
"nik-sub-category": {
"name": null,
"description": null
},
"amount-refunded": {
"name": null,
"description": null
}
}
}{
"code": 400,
"message": "invalid/unsupported locale: 'apl'"
}{
"code": 401,
"message": "ServiceToken not found"
}{
"code": 404,
"message": "workspace not found for slug/uid: workspace"
}Authorizations
You can get Service Token from SuprSend dashboard -> Account Settings -> Service Tokens section.
Path Parameters
Workspace slug (staging, production, etc.)
Locale code (e.g., es, fr, de, ja)
Body
application/json
Was this page helpful?
Previous
Delete TranslationDelete translation content for a given locale for preference categories and sections.
Next
⌘I
Add Translation
curl -X POST "https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/" \
--header "Authorization: ServiceToken {token}" \
--header "Content-Type: application/json" \
--data '{
"sections": {
"account-updates": {
"name": "Actualizaciones de Cuenta",
"description": "Notificaciones importantes relacionadas con la cuenta"
}
},
"categories": {
"password-reset": {
"name": "Restablecimiento de Contraseña",
"description": "Notificaciones cuando se restablece la contraseña"
}
}
}'import requests
url = "https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/"
payload = {
"sections": { "account-updates": {
"name": "Actualizaciones de Cuenta",
"description": "Notificaciones importantes relacionadas con la cuenta"
} },
"categories": { "password-reset": {
"name": "Restablecimiento de Contraseña",
"description": "Notificaciones cuando se restablece la contraseña"
} }
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sections: {
'account-updates': {
name: 'Actualizaciones de Cuenta',
description: 'Notificaciones importantes relacionadas con la cuenta'
}
},
categories: {
'password-reset': {
name: 'Restablecimiento de Contraseña',
description: 'Notificaciones cuando se restablece la contraseña'
}
}
})
};
fetch('https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/', 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://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sections' => [
'account-updates' => [
'name' => 'Actualizaciones de Cuenta',
'description' => 'Notificaciones importantes relacionadas con la cuenta'
]
],
'categories' => [
'password-reset' => [
'name' => 'Restablecimiento de Contraseña',
'description' => 'Notificaciones cuando se restablece la contraseña'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ServiceToken <token>: <api-key>"
],
]);
$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://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/"
payload := strings.NewReader("{\n \"sections\": {\n \"account-updates\": {\n \"name\": \"Actualizaciones de Cuenta\",\n \"description\": \"Notificaciones importantes relacionadas con la cuenta\"\n }\n },\n \"categories\": {\n \"password-reset\": {\n \"name\": \"Restablecimiento de Contraseña\",\n \"description\": \"Notificaciones cuando se restablece la contraseña\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ServiceToken <token>", "<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.post("https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sections\": {\n \"account-updates\": {\n \"name\": \"Actualizaciones de Cuenta\",\n \"description\": \"Notificaciones importantes relacionadas con la cuenta\"\n }\n },\n \"categories\": {\n \"password-reset\": {\n \"name\": \"Restablecimiento de Contraseña\",\n \"description\": \"Notificaciones cuando se restablece la contraseña\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://management-api.suprsend.com/v1/{workspace}/preference_category/translation/content/{locale}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sections\": {\n \"account-updates\": {\n \"name\": \"Actualizaciones de Cuenta\",\n \"description\": \"Notificaciones importantes relacionadas con la cuenta\"\n }\n },\n \"categories\": {\n \"password-reset\": {\n \"name\": \"Restablecimiento de Contraseña\",\n \"description\": \"Notificaciones cuando se restablece la contraseña\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"sections": {
"new-5": {
"name": null,
"description": null
},
"nik-section-for-transactional": {
"name": null,
"description": null
}
},
"categories": {
"nik-sub-category": {
"name": null,
"description": null
},
"amount-refunded": {
"name": null,
"description": null
}
}
}{
"code": 400,
"message": "invalid/unsupported locale: 'apl'"
}{
"code": 401,
"message": "ServiceToken not found"
}{
"code": 404,
"message": "workspace not found for slug/uid: workspace"
}