Get prompt by package name
curl --request POST \
--url https://api.baytos.ai/v1/prompts/get \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"package_name": "@workspace/customer-support:v1",
"variables": {}
}
'import requests
url = "https://api.baytos.ai/v1/prompts/get"
payload = {
"package_name": "@workspace/customer-support:v1",
"variables": {}
}
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({package_name: '@workspace/customer-support:v1', variables: {}})
};
fetch('https://api.baytos.ai/v1/prompts/get', 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.baytos.ai/v1/prompts/get",
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([
'package_name' => '@workspace/customer-support:v1',
'variables' => [
]
]),
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.baytos.ai/v1/prompts/get"
payload := strings.NewReader("{\n \"package_name\": \"@workspace/customer-support:v1\",\n \"variables\": {}\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.baytos.ai/v1/prompts/get")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"package_name\": \"@workspace/customer-support:v1\",\n \"variables\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baytos.ai/v1/prompts/get")
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 \"package_name\": \"@workspace/customer-support:v1\",\n \"variables\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "pmt_abc123",
"title": "Customer Support Assistant",
"content": "You are a helpful customer support agent for Acme Corp...",
"systemPrompt": "Be professional, courteous, and helpful",
"description": "AI assistant for customer support inquiries",
"category": "support",
"tags": [
"customer-service",
"support"
],
"version": "v1",
"workspaceSlug": "acme-corp",
"packageName": "@acme-corp/support-assistant:v1",
"context": [
{
"id": "ctx_file_123",
"type": "file",
"label": "Product FAQ",
"fileName": "product-faq.pdf",
"fileSize": 52428,
"mimeType": "application/pdf",
"createdAt": 1705497600000
},
{
"id": "ctx_url_456",
"type": "url",
"label": "Knowledge Base",
"url": "https://example.com/kb",
"urlFetchedAt": 1705497600000,
"createdAt": 1705497000000
}
],
"metadata": {
"createdAt": 1705400000000,
"generatedAt": 1705497600000
}
}{
"error": "Invalid API key"
}{
"error": "Not Found",
"message": ""
}Prompts
Get prompt by package name
Retrieve a prompt by package name and optionally substitute variables
POST
/
prompts
/
get
Get prompt by package name
curl --request POST \
--url https://api.baytos.ai/v1/prompts/get \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"package_name": "@workspace/customer-support:v1",
"variables": {}
}
'import requests
url = "https://api.baytos.ai/v1/prompts/get"
payload = {
"package_name": "@workspace/customer-support:v1",
"variables": {}
}
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({package_name: '@workspace/customer-support:v1', variables: {}})
};
fetch('https://api.baytos.ai/v1/prompts/get', 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.baytos.ai/v1/prompts/get",
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([
'package_name' => '@workspace/customer-support:v1',
'variables' => [
]
]),
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.baytos.ai/v1/prompts/get"
payload := strings.NewReader("{\n \"package_name\": \"@workspace/customer-support:v1\",\n \"variables\": {}\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.baytos.ai/v1/prompts/get")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"package_name\": \"@workspace/customer-support:v1\",\n \"variables\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baytos.ai/v1/prompts/get")
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 \"package_name\": \"@workspace/customer-support:v1\",\n \"variables\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "pmt_abc123",
"title": "Customer Support Assistant",
"content": "You are a helpful customer support agent for Acme Corp...",
"systemPrompt": "Be professional, courteous, and helpful",
"description": "AI assistant for customer support inquiries",
"category": "support",
"tags": [
"customer-service",
"support"
],
"version": "v1",
"workspaceSlug": "acme-corp",
"packageName": "@acme-corp/support-assistant:v1",
"context": [
{
"id": "ctx_file_123",
"type": "file",
"label": "Product FAQ",
"fileName": "product-faq.pdf",
"fileSize": 52428,
"mimeType": "application/pdf",
"createdAt": 1705497600000
},
{
"id": "ctx_url_456",
"type": "url",
"label": "Knowledge Base",
"url": "https://example.com/kb",
"urlFetchedAt": 1705497600000,
"createdAt": 1705497000000
}
],
"metadata": {
"createdAt": 1705400000000,
"generatedAt": 1705497600000
}
}{
"error": "Invalid API key"
}{
"error": "Not Found",
"message": ""
}Authorizations
API key obtained from https://claro.baytos.ai
Body
application/json
Response
Successfully retrieved and processed prompt