Skip to main content
POST
/
api
/
prompt
/
get-compiled
Get Compiled Prompt
curl --request POST \
  --url http://localhost:3000/api/prompt/get-compiled \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: text/plain' \
  --data '
{
  "name": "tester",
  "promptId": "a7a55e48-1588-44ee-99e2-d9de5c026238",
  "version": "1.0.0",
  "metaProperties": {},
  "compile": true,
  "variables": {
    "name": "John"
  }
}
'
import requests

url = "http://localhost:3000/api/prompt/get-compiled"

payload = {
"name": "tester",
"promptId": "a7a55e48-1588-44ee-99e2-d9de5c026238",
"version": "1.0.0",
"metaProperties": {},
"compile": True,
"variables": { "name": "John" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "text/plain"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'text/plain'},
body: JSON.stringify({
name: 'tester',
promptId: 'a7a55e48-1588-44ee-99e2-d9de5c026238',
version: '1.0.0',
metaProperties: {},
compile: true,
variables: {name: 'John'}
})
};

fetch('http://localhost:3000/api/prompt/get-compiled', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/prompt/get-compiled",
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([
'name' => 'tester',
'promptId' => 'a7a55e48-1588-44ee-99e2-d9de5c026238',
'version' => '1.0.0',
'metaProperties' => [

],
'compile' => true,
'variables' => [
'name' => 'John'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: text/plain"
],
]);

$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://localhost:3000/api/prompt/get-compiled"

payload := strings.NewReader("{\n \"name\": \"tester\",\n \"promptId\": \"a7a55e48-1588-44ee-99e2-d9de5c026238\",\n \"version\": \"1.0.0\",\n \"metaProperties\": {},\n \"compile\": true,\n \"variables\": {\n \"name\": \"John\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "text/plain")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("http://localhost:3000/api/prompt/get-compiled")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "text/plain")
.body("{\n \"name\": \"tester\",\n \"promptId\": \"a7a55e48-1588-44ee-99e2-d9de5c026238\",\n \"version\": \"1.0.0\",\n \"metaProperties\": {},\n \"compile\": true,\n \"variables\": {\n \"name\": \"John\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost:3000/api/prompt/get-compiled")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'text/plain'
request.body = "{\n \"name\": \"tester\",\n \"promptId\": \"a7a55e48-1588-44ee-99e2-d9de5c026238\",\n \"version\": \"1.0.0\",\n \"metaProperties\": {},\n \"compile\": true,\n \"variables\": {\n \"name\": \"John\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "err": {},
  "res": {
    "promptId": "a7a55e48-1588-44ee-99e2-d9de5c026238",
    "versionId": "2d44f89a-2222-498d-869b-795296496ca3",
    "name": "tester",
    "version": "1.0.0",
    "tags": [
      "<string>"
    ],
    "metaProperties": {},
    "prompt": "Hello {{name}}",
    "compiledPrompt": "Hello John"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

text/plain
name
string
Example:

"tester"

promptId
string<uuid>
Example:

"a7a55e48-1588-44ee-99e2-d9de5c026238"

version
string
Example:

"1.0.0"

metaProperties
object
compile
boolean
Example:

true

variables
object

Response

200 - application/json

Successfully retrieved compiled prompt.

err
object | null
res
object