Update prompt
curl --request PATCH \
--url http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID} \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "How can we get our service to appear in AI search?",
"promptSetID": "IkVMHhjFWcBXcJ41-h9yBQ"
}
'import requests
url = "http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}"
payload = {
"content": "How can we get our service to appear in AI search?",
"promptSetID": "IkVMHhjFWcBXcJ41-h9yBQ"
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content: 'How can we get our service to appear in AI search?',
promptSetID: 'IkVMHhjFWcBXcJ41-h9yBQ'
})
};
fetch('http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}', 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 => "http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}",
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([
'content' => 'How can we get our service to appear in AI search?',
'promptSetID' => 'IkVMHhjFWcBXcJ41-h9yBQ'
]),
CURLOPT_HTTPHEADER => [
"API-Key: <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 := "http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}"
payload := strings.NewReader("{\n \"content\": \"How can we get our service to appear in AI search?\",\n \"promptSetID\": \"IkVMHhjFWcBXcJ41-h9yBQ\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("API-Key", "<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("http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"How can we get our service to appear in AI search?\",\n \"promptSetID\": \"IkVMHhjFWcBXcJ41-h9yBQ\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"How can we get our service to appear in AI search?\",\n \"promptSetID\": \"IkVMHhjFWcBXcJ41-h9yBQ\"\n}"
response = http.request(request)
puts response.read_body{
"code": "COMMON_VALIDATION",
"details": [
"limit: must be 100 or less"
],
"message": "Data validation failed"
}{
"code": "COMMON_UNAUTHORIZED",
"message": "Unauthenticated user"
}{
"code": "INSUFFICIENT_CREDITS",
"message": "Insufficient credits."
}{
"code": "QUESTION_NOT_FOUND",
"message": "Question not found"
}{
"code": "PROMPT_SET_PROMPT_LIMIT_EXCEEDED",
"message": "Exceeded the maximum number of prompts per prompt set (1,000)"
}{
"code": "PLATFORM_RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later."
}{
"message": "Internal Server Error",
"requestID": "bkZqnHQepkgTOocTvyHWSlHcGzRqQbZk"
}Prompts
Update a prompt
Partially updates a prompt. Only the fields you provide are changed; the rest are kept. If promptSetID is provided, the prompt is moved to that set. The prompt cannot be moved if the target set has reached its limit (1,000 prompts).
Returns 204 No Content on success. The response body is empty, so call Get prompt if you need the updated content.
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | COMMON_BINDING | • Failed to parse request body JSON • Invalid promptID or promptSetID format (PLATFORM_INVALID_ID in details) |
| 400 | COMMON_VALIDATION | Content exceeds 1000 characters |
| 400 | QUESTION_CONTENT_REQUIRED | content sent as an empty string |
| 401 | COMMON_UNAUTHORIZED | API key or access token is missing or invalid |
| 402 | INSUFFICIENT_CREDITS | Organization credit balance is lower than the unit price of this request |
| 404 | QUESTION_NOT_FOUND | Prompt does not exist or belongs to another organization |
| 404 | PROMPT_SET_NOT_FOUND | Target set does not exist or belongs to another organization |
| 409 | PROMPT_SET_PROMPT_LIMIT_EXCEEDED | Target set exceeds the maximum number of prompts (1,000) |
| 429 | PLATFORM_RATE_LIMIT_EXCEEDED | Rate limit exceeded. Wait for the number of seconds in the Retry-After header, then retry |
| 500 | — | Internal server error. Returns message and requestID without code |
PATCH
/
v1
/
platform
/
prompts
/
{promptID}
Update prompt
curl --request PATCH \
--url http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID} \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "How can we get our service to appear in AI search?",
"promptSetID": "IkVMHhjFWcBXcJ41-h9yBQ"
}
'import requests
url = "http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}"
payload = {
"content": "How can we get our service to appear in AI search?",
"promptSetID": "IkVMHhjFWcBXcJ41-h9yBQ"
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
content: 'How can we get our service to appear in AI search?',
promptSetID: 'IkVMHhjFWcBXcJ41-h9yBQ'
})
};
fetch('http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}', 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 => "http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}",
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([
'content' => 'How can we get our service to appear in AI search?',
'promptSetID' => 'IkVMHhjFWcBXcJ41-h9yBQ'
]),
CURLOPT_HTTPHEADER => [
"API-Key: <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 := "http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}"
payload := strings.NewReader("{\n \"content\": \"How can we get our service to appear in AI search?\",\n \"promptSetID\": \"IkVMHhjFWcBXcJ41-h9yBQ\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("API-Key", "<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("http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"How can we get our service to appear in AI search?\",\n \"promptSetID\": \"IkVMHhjFWcBXcJ41-h9yBQ\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://dev-platform-api.trychainshift.ai/api/v1/platform/prompts/{promptID}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": \"How can we get our service to appear in AI search?\",\n \"promptSetID\": \"IkVMHhjFWcBXcJ41-h9yBQ\"\n}"
response = http.request(request)
puts response.read_body{
"code": "COMMON_VALIDATION",
"details": [
"limit: must be 100 or less"
],
"message": "Data validation failed"
}{
"code": "COMMON_UNAUTHORIZED",
"message": "Unauthenticated user"
}{
"code": "INSUFFICIENT_CREDITS",
"message": "Insufficient credits."
}{
"code": "QUESTION_NOT_FOUND",
"message": "Question not found"
}{
"code": "PROMPT_SET_PROMPT_LIMIT_EXCEEDED",
"message": "Exceeded the maximum number of prompts per prompt set (1,000)"
}{
"code": "PLATFORM_RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later."
}{
"message": "Internal Server Error",
"requestID": "bkZqnHQepkgTOocTvyHWSlHcGzRqQbZk"
}Path Parameters
Body
application/json
Prompt update request (partial update)
Response
Updated. No response body