curl --request PUT \
--url https://www.getsurfaced.ai/api/v1/content-agent/policy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Workspace-Id: <x-workspace-id>' \
--data '
{
"expectedVersion": 1,
"policy": {
"enabled": true,
"scope": {
"projectIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"routeAllowlist": [
"<string>"
],
"marketRefs": [
"<string>"
]
},
"actions": [],
"budgets": {
"maxArticlesPerWeek": 2
},
"approvals": {
"red": "explicit"
},
"killSwitch": true
}
}
'import requests
url = "https://www.getsurfaced.ai/api/v1/content-agent/policy"
payload = {
"expectedVersion": 1,
"policy": {
"enabled": True,
"scope": {
"projectIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"routeAllowlist": ["<string>"],
"marketRefs": ["<string>"]
},
"actions": [],
"budgets": { "maxArticlesPerWeek": 2 },
"approvals": { "red": "explicit" },
"killSwitch": True
}
}
headers = {
"X-Workspace-Id": "<x-workspace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Workspace-Id': '<x-workspace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
expectedVersion: 1,
policy: {
enabled: true,
scope: {
projectIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
routeAllowlist: ['<string>'],
marketRefs: ['<string>']
},
actions: [],
budgets: {maxArticlesPerWeek: 2},
approvals: {red: 'explicit'},
killSwitch: true
}
})
};
fetch('https://www.getsurfaced.ai/api/v1/content-agent/policy', 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://www.getsurfaced.ai/api/v1/content-agent/policy",
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([
'expectedVersion' => 1,
'policy' => [
'enabled' => true,
'scope' => [
'projectIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'routeAllowlist' => [
'<string>'
],
'marketRefs' => [
'<string>'
]
],
'actions' => [
],
'budgets' => [
'maxArticlesPerWeek' => 2
],
'approvals' => [
'red' => 'explicit'
],
'killSwitch' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Workspace-Id: <x-workspace-id>"
],
]);
$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://www.getsurfaced.ai/api/v1/content-agent/policy"
payload := strings.NewReader("{\n \"expectedVersion\": 1,\n \"policy\": {\n \"enabled\": true,\n \"scope\": {\n \"projectIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"routeAllowlist\": [\n \"<string>\"\n ],\n \"marketRefs\": [\n \"<string>\"\n ]\n },\n \"actions\": [],\n \"budgets\": {\n \"maxArticlesPerWeek\": 2\n },\n \"approvals\": {\n \"red\": \"explicit\"\n },\n \"killSwitch\": true\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Workspace-Id", "<x-workspace-id>")
req.Header.Add("Authorization", "Bearer <token>")
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://www.getsurfaced.ai/api/v1/content-agent/policy")
.header("X-Workspace-Id", "<x-workspace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expectedVersion\": 1,\n \"policy\": {\n \"enabled\": true,\n \"scope\": {\n \"projectIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"routeAllowlist\": [\n \"<string>\"\n ],\n \"marketRefs\": [\n \"<string>\"\n ]\n },\n \"actions\": [],\n \"budgets\": {\n \"maxArticlesPerWeek\": 2\n },\n \"approvals\": {\n \"red\": \"explicit\"\n },\n \"killSwitch\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.getsurfaced.ai/api/v1/content-agent/policy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Workspace-Id"] = '<x-workspace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expectedVersion\": 1,\n \"policy\": {\n \"enabled\": true,\n \"scope\": {\n \"projectIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"routeAllowlist\": [\n \"<string>\"\n ],\n \"marketRefs\": [\n \"<string>\"\n ]\n },\n \"actions\": [],\n \"budgets\": {\n \"maxArticlesPerWeek\": 2\n },\n \"approvals\": {\n \"red\": \"explicit\"\n },\n \"killSwitch\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"active": true,
"idempotent": true
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}Save the Content Agent settings
Replaces the settings with a new version, through the same checks as the dashboard form. Read the settings first, change what you need, and send policy with the version you read as expectedVersion. Only the fields in the request are honoured: thresholds, cooldownDays and every cost ceiling (including the weekly action ceiling) are owned by the server, read-only in GET, and not accepted here. Constraints: maxArticlesPerWeek must be at least 1 (use PUT /content-agent to switch it off); choose only configured markets and one destination route that is a path on your site; and any action beyond create_article is only allowed in mode approval_batch, where every action waits for approval. Requires write scope and manage_settings. Send an Idempotency-Key so a lost response can be retried and return the original result: without one, a retry of a request that already committed answers 409 because the version moved on.
curl --request PUT \
--url https://www.getsurfaced.ai/api/v1/content-agent/policy \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Workspace-Id: <x-workspace-id>' \
--data '
{
"expectedVersion": 1,
"policy": {
"enabled": true,
"scope": {
"projectIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"routeAllowlist": [
"<string>"
],
"marketRefs": [
"<string>"
]
},
"actions": [],
"budgets": {
"maxArticlesPerWeek": 2
},
"approvals": {
"red": "explicit"
},
"killSwitch": true
}
}
'import requests
url = "https://www.getsurfaced.ai/api/v1/content-agent/policy"
payload = {
"expectedVersion": 1,
"policy": {
"enabled": True,
"scope": {
"projectIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"routeAllowlist": ["<string>"],
"marketRefs": ["<string>"]
},
"actions": [],
"budgets": { "maxArticlesPerWeek": 2 },
"approvals": { "red": "explicit" },
"killSwitch": True
}
}
headers = {
"X-Workspace-Id": "<x-workspace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Workspace-Id': '<x-workspace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
expectedVersion: 1,
policy: {
enabled: true,
scope: {
projectIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
routeAllowlist: ['<string>'],
marketRefs: ['<string>']
},
actions: [],
budgets: {maxArticlesPerWeek: 2},
approvals: {red: 'explicit'},
killSwitch: true
}
})
};
fetch('https://www.getsurfaced.ai/api/v1/content-agent/policy', 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://www.getsurfaced.ai/api/v1/content-agent/policy",
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([
'expectedVersion' => 1,
'policy' => [
'enabled' => true,
'scope' => [
'projectIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'routeAllowlist' => [
'<string>'
],
'marketRefs' => [
'<string>'
]
],
'actions' => [
],
'budgets' => [
'maxArticlesPerWeek' => 2
],
'approvals' => [
'red' => 'explicit'
],
'killSwitch' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Workspace-Id: <x-workspace-id>"
],
]);
$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://www.getsurfaced.ai/api/v1/content-agent/policy"
payload := strings.NewReader("{\n \"expectedVersion\": 1,\n \"policy\": {\n \"enabled\": true,\n \"scope\": {\n \"projectIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"routeAllowlist\": [\n \"<string>\"\n ],\n \"marketRefs\": [\n \"<string>\"\n ]\n },\n \"actions\": [],\n \"budgets\": {\n \"maxArticlesPerWeek\": 2\n },\n \"approvals\": {\n \"red\": \"explicit\"\n },\n \"killSwitch\": true\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Workspace-Id", "<x-workspace-id>")
req.Header.Add("Authorization", "Bearer <token>")
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://www.getsurfaced.ai/api/v1/content-agent/policy")
.header("X-Workspace-Id", "<x-workspace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expectedVersion\": 1,\n \"policy\": {\n \"enabled\": true,\n \"scope\": {\n \"projectIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"routeAllowlist\": [\n \"<string>\"\n ],\n \"marketRefs\": [\n \"<string>\"\n ]\n },\n \"actions\": [],\n \"budgets\": {\n \"maxArticlesPerWeek\": 2\n },\n \"approvals\": {\n \"red\": \"explicit\"\n },\n \"killSwitch\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.getsurfaced.ai/api/v1/content-agent/policy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Workspace-Id"] = '<x-workspace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expectedVersion\": 1,\n \"policy\": {\n \"enabled\": true,\n \"scope\": {\n \"projectIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"routeAllowlist\": [\n \"<string>\"\n ],\n \"marketRefs\": [\n \"<string>\"\n ]\n },\n \"actions\": [],\n \"budgets\": {\n \"maxArticlesPerWeek\": 2\n },\n \"approvals\": {\n \"red\": \"explicit\"\n },\n \"killSwitch\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 123,
"active": true,
"idempotent": true
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"details": {}
}
}Authorizations
API key (sk_live_...) created at https://www.getsurfaced.ai/app/settings/account/api-keys