Update API key
curl --request PATCH \
--url https://api.social-api.ai/v1/keys/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"brand_ids": [
"<string>"
],
"name": "My App",
"scopes": [
"posts:write",
"inbox:read"
]
}
'import requests
url = "https://api.social-api.ai/v1/keys/{id}"
payload = {
"brand_ids": ["<string>"],
"name": "My App",
"scopes": ["posts:write", "inbox:read"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({brand_ids: ['<string>'], name: 'My App', scopes: ['posts:write', 'inbox:read']})
};
fetch('https://api.social-api.ai/v1/keys/{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.social-api.ai/v1/keys/{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([
'brand_ids' => [
'<string>'
],
'name' => 'My App',
'scopes' => [
'posts:write',
'inbox:read'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <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://api.social-api.ai/v1/keys/{id}"
payload := strings.NewReader("{\n \"brand_ids\": [\n \"<string>\"\n ],\n \"name\": \"My App\",\n \"scopes\": [\n \"posts:write\",\n \"inbox:read\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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.patch("https://api.social-api.ai/v1/keys/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"brand_ids\": [\n \"<string>\"\n ],\n \"name\": \"My App\",\n \"scopes\": [\n \"posts:write\",\n \"inbox:read\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.social-api.ai/v1/keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"brand_ids\": [\n \"<string>\"\n ],\n \"name\": \"My App\",\n \"scopes\": [\n \"posts:write\",\n \"inbox:read\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"brand_ids": [
"<string>"
],
"id": "<string>",
"name": "<string>",
"scopes": [
"posts:write",
"inbox:read"
]
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}API Keys
Update API key
Edits an existing key’s name, scopes, and brand restrictions in place. The key value is unchanged (no new secret is issued). Empty scopes or brand_ids mean unrestricted. Requires a full-access key or the dashboard.
PATCH
/
keys
/
{id}
Update API key
curl --request PATCH \
--url https://api.social-api.ai/v1/keys/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"brand_ids": [
"<string>"
],
"name": "My App",
"scopes": [
"posts:write",
"inbox:read"
]
}
'import requests
url = "https://api.social-api.ai/v1/keys/{id}"
payload = {
"brand_ids": ["<string>"],
"name": "My App",
"scopes": ["posts:write", "inbox:read"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({brand_ids: ['<string>'], name: 'My App', scopes: ['posts:write', 'inbox:read']})
};
fetch('https://api.social-api.ai/v1/keys/{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.social-api.ai/v1/keys/{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([
'brand_ids' => [
'<string>'
],
'name' => 'My App',
'scopes' => [
'posts:write',
'inbox:read'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <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://api.social-api.ai/v1/keys/{id}"
payload := strings.NewReader("{\n \"brand_ids\": [\n \"<string>\"\n ],\n \"name\": \"My App\",\n \"scopes\": [\n \"posts:write\",\n \"inbox:read\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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.patch("https://api.social-api.ai/v1/keys/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"brand_ids\": [\n \"<string>\"\n ],\n \"name\": \"My App\",\n \"scopes\": [\n \"posts:write\",\n \"inbox:read\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.social-api.ai/v1/keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"brand_ids\": [\n \"<string>\"\n ],\n \"name\": \"My App\",\n \"scopes\": [\n \"posts:write\",\n \"inbox:read\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"brand_ids": [
"<string>"
],
"id": "<string>",
"name": "<string>",
"scopes": [
"posts:write",
"inbox:read"
]
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}{
"error": {
"code": "resource.not_found",
"message": "Account not found",
"meta": {}
}
}Authorizations
Prefix your API key with "Bearer ". Example: Authorization: Bearer sapi_key_...
Path Parameters
API key ID
Body
application/json
New name and restrictions
⌘I