Create a prompt
curl --request POST \
--url https://www.getsurfaced.ai/api/v1/prompts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Workspace-Id: <x-workspace-id>' \
--data '
{
"promptText": "<string>",
"targetCountry": "<string>",
"targetLanguage": "<string>"
}
'import requests
url = "https://www.getsurfaced.ai/api/v1/prompts"
payload = {
"promptText": "<string>",
"targetCountry": "<string>",
"targetLanguage": "<string>"
}
headers = {
"X-Workspace-Id": "<x-workspace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Workspace-Id': '<x-workspace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({promptText: '<string>', targetCountry: '<string>', targetLanguage: '<string>'})
};
fetch('https://www.getsurfaced.ai/api/v1/prompts', 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/prompts",
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([
'promptText' => '<string>',
'targetCountry' => '<string>',
'targetLanguage' => '<string>'
]),
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/prompts"
payload := strings.NewReader("{\n \"promptText\": \"<string>\",\n \"targetCountry\": \"<string>\",\n \"targetLanguage\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://www.getsurfaced.ai/api/v1/prompts")
.header("X-Workspace-Id", "<x-workspace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promptText\": \"<string>\",\n \"targetCountry\": \"<string>\",\n \"targetLanguage\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.getsurfaced.ai/api/v1/prompts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Workspace-Id"] = '<x-workspace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promptText\": \"<string>\",\n \"targetCountry\": \"<string>\",\n \"targetLanguage\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"promptText": "<string>",
"promptType": "<string>",
"source": "<string>",
"active": true,
"isBranded": true,
"intent": "<string>",
"targetCountry": "<string>",
"targetLanguage": "<string>",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"translationSource": "<string>",
"isStale": true,
"untrackedAt": "2023-11-07T05:31:56Z",
"trackingModels": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"topics": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"color": "<string>",
"icon": "<string>"
}
],
"stats": {
"totalObservations": 123,
"brandMentions": 123,
"brandVisibilityMentions": 123,
"citationMentions": 123,
"observationsWithCitations": 123,
"brandVisibility": 123,
"citationRate": 123,
"shareOfVoice": 123,
"avgSentiment": 123,
"avgRank": 123,
"lastTrackedDate": "<string>",
"providerBreakdown": [
{
"provider": "<string>",
"total": 123,
"mentions": 123
}
]
}
}
}{
"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": {}
}
}Insights
Create a prompt
Adds a prompt. It starts inactive and is not measured until activated with PATCH /prompts/{id} { "active": true }. When targetCountry is omitted it follows the workspace’s market, then the brand’s default country; when targetLanguage is omitted it is detected from the text. targetCountry is a 2-letter code or GLOBAL. Text is limited to 500 characters. Requires write scope and admin_section.
POST
/
prompts
Create a prompt
curl --request POST \
--url https://www.getsurfaced.ai/api/v1/prompts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Workspace-Id: <x-workspace-id>' \
--data '
{
"promptText": "<string>",
"targetCountry": "<string>",
"targetLanguage": "<string>"
}
'import requests
url = "https://www.getsurfaced.ai/api/v1/prompts"
payload = {
"promptText": "<string>",
"targetCountry": "<string>",
"targetLanguage": "<string>"
}
headers = {
"X-Workspace-Id": "<x-workspace-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Workspace-Id': '<x-workspace-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({promptText: '<string>', targetCountry: '<string>', targetLanguage: '<string>'})
};
fetch('https://www.getsurfaced.ai/api/v1/prompts', 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/prompts",
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([
'promptText' => '<string>',
'targetCountry' => '<string>',
'targetLanguage' => '<string>'
]),
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/prompts"
payload := strings.NewReader("{\n \"promptText\": \"<string>\",\n \"targetCountry\": \"<string>\",\n \"targetLanguage\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://www.getsurfaced.ai/api/v1/prompts")
.header("X-Workspace-Id", "<x-workspace-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"promptText\": \"<string>\",\n \"targetCountry\": \"<string>\",\n \"targetLanguage\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.getsurfaced.ai/api/v1/prompts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Workspace-Id"] = '<x-workspace-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promptText\": \"<string>\",\n \"targetCountry\": \"<string>\",\n \"targetLanguage\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"promptText": "<string>",
"promptType": "<string>",
"source": "<string>",
"active": true,
"isBranded": true,
"intent": "<string>",
"targetCountry": "<string>",
"targetLanguage": "<string>",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"translationSource": "<string>",
"isStale": true,
"untrackedAt": "2023-11-07T05:31:56Z",
"trackingModels": [
"<string>"
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"topics": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"color": "<string>",
"icon": "<string>"
}
],
"stats": {
"totalObservations": 123,
"brandMentions": 123,
"brandVisibilityMentions": 123,
"citationMentions": 123,
"observationsWithCitations": 123,
"brandVisibility": 123,
"citationRate": 123,
"shareOfVoice": 123,
"avgSentiment": 123,
"avgRank": 123,
"lastTrackedDate": "<string>",
"providerBreakdown": [
{
"provider": "<string>",
"total": 123,
"mentions": 123
}
]
}
}
}{
"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
Headers
Body
application/json