Skip to main content
PATCH
/
api
/
public
/
v2
/
tables
/
{table_id}
/
sheets
/
{sheet_id}
/
score
Configure Table Sheet Score
curl --request PATCH \
  --url https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/score \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "score_config": {},
  "column_ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "column_names": [
    "<string>"
  ],
  "code": "<string>",
  "code_language": "PYTHON",
  "true_values": [
    "<string>"
  ],
  "false_values": [
    "<string>"
  ]
}
'
import requests

url = "https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/score"

payload = {
"score_config": {},
"column_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"column_names": ["<string>"],
"code": "<string>",
"code_language": "PYTHON",
"true_values": ["<string>"],
"false_values": ["<string>"]
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PATCH',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
score_config: {},
column_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
column_names: ['<string>'],
code: '<string>',
code_language: 'PYTHON',
true_values: ['<string>'],
false_values: ['<string>']
})
};

fetch('https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/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/api/public/v2/tables/{table_id}/sheets/{sheet_id}/score",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'score_config' => [

],
'column_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'column_names' => [
'<string>'
],
'code' => '<string>',
'code_language' => 'PYTHON',
'true_values' => [
'<string>'
],
'false_values' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);

$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/api/public/v2/tables/{table_id}/sheets/{sheet_id}/score"

payload := strings.NewReader("{\n \"score_config\": {},\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"column_names\": [\n \"<string>\"\n ],\n \"code\": \"<string>\",\n \"code_language\": \"PYTHON\",\n \"true_values\": [\n \"<string>\"\n ],\n \"false_values\": [\n \"<string>\"\n ]\n}")

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

req.Header.Add("X-API-KEY", "<api-key>")
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.patch("https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/score")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"score_config\": {},\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"column_names\": [\n \"<string>\"\n ],\n \"code\": \"<string>\",\n \"code_language\": \"PYTHON\",\n \"true_values\": [\n \"<string>\"\n ],\n \"false_values\": [\n \"<string>\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/score")

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

request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"score_config\": {},\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"column_names\": [\n \"<string>\"\n ],\n \"code\": \"<string>\",\n \"code_language\": \"PYTHON\",\n \"true_values\": [\n \"<string>\"\n ],\n \"false_values\": [\n \"<string>\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "<string>",
  "score_configuration_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "status": "<string>",
  "requires_recalculation": true,
  "version": 123
}
{
"success": false,
"message": "<string>",
"error": "<string>"
}
{
"success": false,
"message": "<string>",
"error": "<string>"
}
{
"success": false,
"message": "<string>",
"error": "<string>"
}
{
"success": false,
"message": "<string>",
"error": "<string>"
}
Configure scoring for a sheet. Use column_ids or column_names for standard boolean or numeric scoring. Column names must be unique in the sheet. Use score_type with score_config for explicit configuration. Supported scoring modes are auto, boolean, numeric, and custom; score_type is required when you pass score_config. For custom scoring, pass code and optionally code_language (PYTHON by default, or JAVASCRIPT). Boolean scoring also supports true_values, false_values, and assertion_aggregation (all, any, or mean). This endpoint updates the configuration and returns requires_recalculation; call the recalculation endpoint to queue score calculation. Changing score configuration creates a new sheet version. The response returns version, the current sheet version count after the configuration update.

Authorizations

X-API-KEY
string
header
required

Headers

X-API-KEY
string
required

Your PromptLayer API key. The key's workspace scopes table resources for this request.

Path Parameters

table_id
string<uuid>
required

Table ID.

sheet_id
string<uuid>
required

Table sheet ID.

Body

application/json
score_type
enum<string> | null

Scoring mode. Required when score_config is provided.

Available options:
auto,
boolean,
numeric,
custom
score_config
object | null

Explicit score configuration.

column_ids
string<uuid>[] | null

Column IDs to score.

column_names
string[] | null

Column titles to score. Titles must be unique in the sheet.

code
string | null

Custom scoring code.

Required string length: 1 - 50000
code_language
enum<string>
default:PYTHON
Available options:
PYTHON,
JAVASCRIPT
true_values
string[] | null

Values treated as true for boolean scoring.

false_values
string[] | null

Values treated as false for boolean scoring.

assertion_aggregation
enum<string> | null

Aggregation mode for assertion-style boolean scoring.

Available options:
all,
any,
mean

Response

Score configuration updated.

success
boolean
required
message
string
required
score_configuration_id
string<uuid>
required
status
string | null
required

Returned as null by this endpoint. Use the recalculation endpoint to queue score calculation.

requires_recalculation
boolean
required

Always true after updating the score configuration.

version
integer
required