System Prompts
Create System Prompt
Create a new system prompt composition.
POST
/
v1
/
system-prompts
Create System Prompt
curl --request POST \
--url https://api.cuadra.ai/v1/system-prompts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "System prompt for customer support interactions",
"name": "Customer Support Agent",
"particles": [
{
"order": 0,
"particleId": "particle-uuid-1"
},
{
"order": 1,
"particleId": "particle-uuid-2"
}
]
}
'import requests
url = "https://api.cuadra.ai/v1/system-prompts"
payload = {
"description": "System prompt for customer support interactions",
"name": "Customer Support Agent",
"particles": [
{
"order": 0,
"particleId": "particle-uuid-1"
},
{
"order": 1,
"particleId": "particle-uuid-2"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'System prompt for customer support interactions',
name: 'Customer Support Agent',
particles: [
{order: 0, particleId: 'particle-uuid-1'},
{order: 1, particleId: 'particle-uuid-2'}
]
})
};
fetch('https://api.cuadra.ai/v1/system-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://api.cuadra.ai/v1/system-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([
'description' => 'System prompt for customer support interactions',
'name' => 'Customer Support Agent',
'particles' => [
[
'order' => 0,
'particleId' => 'particle-uuid-1'
],
[
'order' => 1,
'particleId' => 'particle-uuid-2'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cuadra.ai/v1/system-prompts"
payload := strings.NewReader("{\n \"description\": \"System prompt for customer support interactions\",\n \"name\": \"Customer Support Agent\",\n \"particles\": [\n {\n \"order\": 0,\n \"particleId\": \"particle-uuid-1\"\n },\n {\n \"order\": 1,\n \"particleId\": \"particle-uuid-2\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.cuadra.ai/v1/system-prompts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"System prompt for customer support interactions\",\n \"name\": \"Customer Support Agent\",\n \"particles\": [\n {\n \"order\": 0,\n \"particleId\": \"particle-uuid-1\"\n },\n {\n \"order\": 1,\n \"particleId\": \"particle-uuid-2\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cuadra.ai/v1/system-prompts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"System prompt for customer support interactions\",\n \"name\": \"Customer Support Agent\",\n \"particles\": [\n {\n \"order\": 0,\n \"particleId\": \"particle-uuid-1\"\n },\n {\n \"order\": 1,\n \"particleId\": \"particle-uuid-2\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sp_abc123",
"name": "Customer Support Agent",
"enabled": true,
"isSystem": false,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "System prompt for customer support interactions",
"slug": "customer-support-agent",
"totalTokenCount": 150,
"particleCount": 3,
"particles": [
{
"id": "spa_abc123",
"particleId": "part_xyz789",
"order": 0,
"particleName": "Professional Tone",
"particleCategory": "tone",
"particleVersionId": "pv_abc123",
"pinnedVersion": 2,
"tokenCount": 25
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
bearerAuthoauth2
Body
application/json
Request schema for creating a system prompt.
Response
Successful Response
Response schema for system prompt.
Was this page helpful?
⌘I
Create System Prompt
curl --request POST \
--url https://api.cuadra.ai/v1/system-prompts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "System prompt for customer support interactions",
"name": "Customer Support Agent",
"particles": [
{
"order": 0,
"particleId": "particle-uuid-1"
},
{
"order": 1,
"particleId": "particle-uuid-2"
}
]
}
'import requests
url = "https://api.cuadra.ai/v1/system-prompts"
payload = {
"description": "System prompt for customer support interactions",
"name": "Customer Support Agent",
"particles": [
{
"order": 0,
"particleId": "particle-uuid-1"
},
{
"order": 1,
"particleId": "particle-uuid-2"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'System prompt for customer support interactions',
name: 'Customer Support Agent',
particles: [
{order: 0, particleId: 'particle-uuid-1'},
{order: 1, particleId: 'particle-uuid-2'}
]
})
};
fetch('https://api.cuadra.ai/v1/system-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://api.cuadra.ai/v1/system-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([
'description' => 'System prompt for customer support interactions',
'name' => 'Customer Support Agent',
'particles' => [
[
'order' => 0,
'particleId' => 'particle-uuid-1'
],
[
'order' => 1,
'particleId' => 'particle-uuid-2'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cuadra.ai/v1/system-prompts"
payload := strings.NewReader("{\n \"description\": \"System prompt for customer support interactions\",\n \"name\": \"Customer Support Agent\",\n \"particles\": [\n {\n \"order\": 0,\n \"particleId\": \"particle-uuid-1\"\n },\n {\n \"order\": 1,\n \"particleId\": \"particle-uuid-2\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.cuadra.ai/v1/system-prompts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"System prompt for customer support interactions\",\n \"name\": \"Customer Support Agent\",\n \"particles\": [\n {\n \"order\": 0,\n \"particleId\": \"particle-uuid-1\"\n },\n {\n \"order\": 1,\n \"particleId\": \"particle-uuid-2\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cuadra.ai/v1/system-prompts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"System prompt for customer support interactions\",\n \"name\": \"Customer Support Agent\",\n \"particles\": [\n {\n \"order\": 0,\n \"particleId\": \"particle-uuid-1\"\n },\n {\n \"order\": 1,\n \"particleId\": \"particle-uuid-2\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "sp_abc123",
"name": "Customer Support Agent",
"enabled": true,
"isSystem": false,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "System prompt for customer support interactions",
"slug": "customer-support-agent",
"totalTokenCount": 150,
"particleCount": 3,
"particles": [
{
"id": "spa_abc123",
"particleId": "part_xyz789",
"order": 0,
"particleName": "Professional Tone",
"particleCategory": "tone",
"particleVersionId": "pv_abc123",
"pinnedVersion": 2,
"tokenCount": 25
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}