Track Prompt
curl --request POST \
--url https://api.promptlayer.com/rest/track-prompt \
--header 'Content-Type: application/json' \
--data '
{
"prompt_name": "<string>",
"prompt_input_variables": {},
"api_key": "<string>",
"request_id": 123,
"version": 123,
"label": "<string>"
}
'import requests
url = "https://api.promptlayer.com/rest/track-prompt"
payload = {
"prompt_name": "<string>",
"prompt_input_variables": {},
"api_key": "<string>",
"request_id": 123,
"version": 123,
"label": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
prompt_name: '<string>',
prompt_input_variables: {},
api_key: '<string>',
request_id: 123,
version: 123,
label: '<string>'
})
};
fetch('https://api.promptlayer.com/rest/track-prompt', 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.promptlayer.com/rest/track-prompt",
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([
'prompt_name' => '<string>',
'prompt_input_variables' => [
],
'api_key' => '<string>',
'request_id' => 123,
'version' => 123,
'label' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.promptlayer.com/rest/track-prompt"
payload := strings.NewReader("{\n \"prompt_name\": \"<string>\",\n \"prompt_input_variables\": {},\n \"api_key\": \"<string>\",\n \"request_id\": 123,\n \"version\": 123,\n \"label\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.promptlayer.com/rest/track-prompt")
.header("Content-Type", "application/json")
.body("{\n \"prompt_name\": \"<string>\",\n \"prompt_input_variables\": {},\n \"api_key\": \"<string>\",\n \"request_id\": 123,\n \"version\": 123,\n \"label\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/rest/track-prompt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt_name\": \"<string>\",\n \"prompt_input_variables\": {},\n \"api_key\": \"<string>\",\n \"request_id\": 123,\n \"version\": 123,\n \"label\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyReference
Track Prompt
POST
/
rest
/
track-prompt
Track Prompt
curl --request POST \
--url https://api.promptlayer.com/rest/track-prompt \
--header 'Content-Type: application/json' \
--data '
{
"prompt_name": "<string>",
"prompt_input_variables": {},
"api_key": "<string>",
"request_id": 123,
"version": 123,
"label": "<string>"
}
'import requests
url = "https://api.promptlayer.com/rest/track-prompt"
payload = {
"prompt_name": "<string>",
"prompt_input_variables": {},
"api_key": "<string>",
"request_id": 123,
"version": 123,
"label": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
prompt_name: '<string>',
prompt_input_variables: {},
api_key: '<string>',
request_id: 123,
version: 123,
label: '<string>'
})
};
fetch('https://api.promptlayer.com/rest/track-prompt', 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.promptlayer.com/rest/track-prompt",
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([
'prompt_name' => '<string>',
'prompt_input_variables' => [
],
'api_key' => '<string>',
'request_id' => 123,
'version' => 123,
'label' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.promptlayer.com/rest/track-prompt"
payload := strings.NewReader("{\n \"prompt_name\": \"<string>\",\n \"prompt_input_variables\": {},\n \"api_key\": \"<string>\",\n \"request_id\": 123,\n \"version\": 123,\n \"label\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.promptlayer.com/rest/track-prompt")
.header("Content-Type", "application/json")
.body("{\n \"prompt_name\": \"<string>\",\n \"prompt_input_variables\": {},\n \"api_key\": \"<string>\",\n \"request_id\": 123,\n \"version\": 123,\n \"label\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/rest/track-prompt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt_name\": \"<string>\",\n \"prompt_input_variables\": {},\n \"api_key\": \"<string>\",\n \"request_id\": 123,\n \"version\": 123,\n \"label\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAssociate a prompt template with a request.
Example Code
import requests
response = requests.post(
"https://api.promptlayer.com/rest/track-prompt",
json={
"api_key": "<YOUR_API_KEY>",
"prompt_name": "<PROMPT_NAME>",
"prompt_input_variables": {"variable1": "value1", "variable2": "value2"},
"request_id": "<REQUEST_ID>",
"version": "<VERSION>"
},
)
Request Parameters
string
object
string
Your PromptLayer API Key
int
int
Both version and label cannot be specified. Only one or none.
string
Both version and label cannot be specified. Only one or none.
Was this page helpful?
⌘I

