Track Score
curl --request POST \
--url https://api.promptlayer.com/rest/track-score \
--header 'Content-Type: application/json' \
--data '
{
"request_id": "<string>",
"score": 123,
"name": "<string>",
"api_key": "<string>"
}
'import requests
url = "https://api.promptlayer.com/rest/track-score"
payload = {
"request_id": "<string>",
"score": 123,
"name": "<string>",
"api_key": "<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({request_id: '<string>', score: 123, name: '<string>', api_key: '<string>'})
};
fetch('https://api.promptlayer.com/rest/track-score', 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-score",
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([
'request_id' => '<string>',
'score' => 123,
'name' => '<string>',
'api_key' => '<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-score"
payload := strings.NewReader("{\n \"request_id\": \"<string>\",\n \"score\": 123,\n \"name\": \"<string>\",\n \"api_key\": \"<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-score")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"<string>\",\n \"score\": 123,\n \"name\": \"<string>\",\n \"api_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/rest/track-score")
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 \"request_id\": \"<string>\",\n \"score\": 123,\n \"name\": \"<string>\",\n \"api_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyReference
Track Score
POST
/
rest
/
track-score
Track Score
curl --request POST \
--url https://api.promptlayer.com/rest/track-score \
--header 'Content-Type: application/json' \
--data '
{
"request_id": "<string>",
"score": 123,
"name": "<string>",
"api_key": "<string>"
}
'import requests
url = "https://api.promptlayer.com/rest/track-score"
payload = {
"request_id": "<string>",
"score": 123,
"name": "<string>",
"api_key": "<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({request_id: '<string>', score: 123, name: '<string>', api_key: '<string>'})
};
fetch('https://api.promptlayer.com/rest/track-score', 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-score",
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([
'request_id' => '<string>',
'score' => 123,
'name' => '<string>',
'api_key' => '<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-score"
payload := strings.NewReader("{\n \"request_id\": \"<string>\",\n \"score\": 123,\n \"name\": \"<string>\",\n \"api_key\": \"<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-score")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"<string>\",\n \"score\": 123,\n \"name\": \"<string>\",\n \"api_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/rest/track-score")
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 \"request_id\": \"<string>\",\n \"score\": 123,\n \"name\": \"<string>\",\n \"api_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyTrack score allows you to associate a score 0-100 with each request.
Example Code
import requests
request_response = requests.post(
"https://api.promptlayer.com/rest/track-score",
json={
"request_id": "<PL_REQUEST_ID>",
"score": "<NUMBER>",
"name": "<SCORE_NAME>", # optional
"api_key": "pl_<YOUR API KEY>",
},
)
Request Parameters
string
The
request_id from track-requestinteger
The score you would like to give to this request (0 - 100)
string
A name for this request score.
string
Your PromptLayer API Key
Was this page helpful?
⌘I

