curl --request PATCH \
--url https://api.surfais.com/v1/orgs/{orgId}/prompts/{promptId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"countries": [
"<string>"
],
"platforms": [],
"tags": [
"<string>"
],
"active": true
}
'import requests
url = "https://api.surfais.com/v1/orgs/{orgId}/prompts/{promptId}"
payload = {
"countries": ["<string>"],
"platforms": [],
"tags": ["<string>"],
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({countries: ['<string>'], platforms: [], tags: ['<string>'], active: true})
};
fetch('https://api.surfais.com/v1/orgs/{orgId}/prompts/{promptId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brand_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"text": "<string>",
"tags": [
"<string>"
],
"countries": [
"<string>"
],
"platforms": [
"<string>"
],
"active": true,
"source": "ui",
"created_by_key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"existing_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"tier": "<string>",
"cap": 0,
"attempted": 0
}
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}Update a prompt
Update a prompt’s countries, platforms, tags or active flag.
Text is identity: a body carrying text is 400 text_immutable; an empty patch is 400 validation_error (empty_patch). active: true on an inactive prompt REACTIVATES it — cap-checked like a create (422) and refused (409 conflict) if an active prompt with the same text now exists in the brand. active: false deactivates (never cap-checked). On a prompt of an archived brand only a body whose SOLE field is active: false is accepted (409 brand_archived otherwise — a mixed body such as { active: false, tags: [...] } is refused whole, nothing persisted).
curl --request PATCH \
--url https://api.surfais.com/v1/orgs/{orgId}/prompts/{promptId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"countries": [
"<string>"
],
"platforms": [],
"tags": [
"<string>"
],
"active": true
}
'import requests
url = "https://api.surfais.com/v1/orgs/{orgId}/prompts/{promptId}"
payload = {
"countries": ["<string>"],
"platforms": [],
"tags": ["<string>"],
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({countries: ['<string>'], platforms: [], tags: ['<string>'], active: true})
};
fetch('https://api.surfais.com/v1/orgs/{orgId}/prompts/{promptId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"brand_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"text": "<string>",
"tags": [
"<string>"
],
"countries": [
"<string>"
],
"platforms": [
"<string>"
],
"active": true,
"source": "ui",
"created_by_key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"existing_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": {
"tier": "<string>",
"cap": 0,
"attempted": 0
}
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"request_id": "<string>"
}Authorizations
A Surfais API key — an organisation key or a partner key. Issued by Surfais; shown once. Rotate by creating a new key, then revoking the old one.
Headers
Optional. 1–255 characters, unique per intended write. Same key + same request → the stored response is replayed with Idempotent-Replayed: true; same key + different request → 409 idempotency_key_reuse; still running → 409 idempotency_key_in_flight. Outside that range → 400 validation_error (invalid_header).
1 - 255Path Parameters
Organisation id. Org keys: the key's own org. Partner keys: any org with an active link. Anything else is 404.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Prompt id within the org; 404 when not in the org.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Body
Markets the prompt runs in. Duplicates are collapsed.
1 - 29 elementsISO 3166-1 alpha-2 market (case-insensitive). Must be one Surfais scans; otherwise 400 validation_error with details[].code = "unsupported_country".
^[A-Za-z]{2}$Platforms the prompt runs on. Duplicates are collapsed.
1 - 5 elementsScanned AI platform id.
perplexity, chatgpt, gemini, claude, ai_overviews Free-text labels, each at most 100 characters and 256 UTF-8 bytes after trimming, with no control characters. Duplicates are collapsed.
501 - 100true on an inactive prompt REACTIVATES it (cap-checked: 422 prompt_cap_exceeded / country_cap_exceeded, 409 conflict if an active prompt with the same text exists in the brand); false deactivates. On a prompt of an archived brand false is accepted only as the SOLE field of the body — sent with any other field the whole patch is 409 brand_archived.
Response
The updated prompt.
Show child attributes
Show child attributes