Create Table Sheet Operation
curl --request POST \
--url https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"operation": "recalculate",
"column_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"row_ids": [
1
],
"statuses": [],
"confirmation_token": "<string>"
}
'import requests
url = "https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations"
payload = {
"operation": "recalculate",
"column_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"row_ids": [1],
"statuses": [],
"confirmation_token": "<string>"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
operation: 'recalculate',
column_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
row_ids: [1],
statuses: [],
confirmation_token: '<string>'
})
};
fetch('https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations', 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}/operations",
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([
'operation' => 'recalculate',
'column_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'row_ids' => [
1
],
'statuses' => [
],
'confirmation_token' => '<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}/operations"
payload := strings.NewReader("{\n \"operation\": \"recalculate\",\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"row_ids\": [\n 1\n ],\n \"statuses\": [],\n \"confirmation_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"operation\": \"recalculate\",\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"row_ids\": [\n 1\n ],\n \"statuses\": [],\n \"confirmation_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"operation\": \"recalculate\",\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"row_ids\": [\n 1\n ],\n \"statuses\": [],\n \"confirmation_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "recalculate",
"operation_id": "<string>",
"execution_id": "<string>",
"execution_ids": [
"<string>"
],
"cell_count": 123,
"version": 123,
"status_url": "<string>",
"virtual_cell_count": 123,
"cells": [
{
"id": "<string>",
"sheet_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"column_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"row_index": 123,
"status": "STALE",
"execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_computed_version": 123,
"display_value": "<string>",
"input_hash": "<string>",
"value": "<unknown>",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"success": true,
"operation": "recalculate",
"operation_id": "<string>",
"execution_id": "<string>",
"execution_ids": [
"<string>"
],
"cell_count": 123,
"version": 123,
"status_url": "<string>",
"virtual_cell_count": 123,
"cells": [
{
"id": "<string>",
"sheet_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"column_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"row_index": 123,
"status": "STALE",
"execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_computed_version": 123,
"display_value": "<string>",
"input_hash": "<string>",
"value": "<unknown>",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}Tables
Create Operation
Queue a recalculation operation for selected columns, rows, and cell statuses. Requests are scoped to the workspace associated with the API key; table, sheet, column, cell, operation, and version IDs must belong to that workspace.
POST
/
api
/
public
/
v2
/
tables
/
{table_id}
/
sheets
/
{sheet_id}
/
operations
Create Table Sheet Operation
curl --request POST \
--url https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"operation": "recalculate",
"column_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"row_ids": [
1
],
"statuses": [],
"confirmation_token": "<string>"
}
'import requests
url = "https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations"
payload = {
"operation": "recalculate",
"column_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"row_ids": [1],
"statuses": [],
"confirmation_token": "<string>"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
operation: 'recalculate',
column_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
row_ids: [1],
statuses: [],
confirmation_token: '<string>'
})
};
fetch('https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations', 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}/operations",
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([
'operation' => 'recalculate',
'column_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'row_ids' => [
1
],
'statuses' => [
],
'confirmation_token' => '<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}/operations"
payload := strings.NewReader("{\n \"operation\": \"recalculate\",\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"row_ids\": [\n 1\n ],\n \"statuses\": [],\n \"confirmation_token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"operation\": \"recalculate\",\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"row_ids\": [\n 1\n ],\n \"statuses\": [],\n \"confirmation_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/operations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"operation\": \"recalculate\",\n \"column_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"row_ids\": [\n 1\n ],\n \"statuses\": [],\n \"confirmation_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "recalculate",
"operation_id": "<string>",
"execution_id": "<string>",
"execution_ids": [
"<string>"
],
"cell_count": 123,
"version": 123,
"status_url": "<string>",
"virtual_cell_count": 123,
"cells": [
{
"id": "<string>",
"sheet_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"column_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"row_index": 123,
"status": "STALE",
"execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_computed_version": 123,
"display_value": "<string>",
"input_hash": "<string>",
"value": "<unknown>",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"success": true,
"operation": "recalculate",
"operation_id": "<string>",
"execution_id": "<string>",
"execution_ids": [
"<string>"
],
"cell_count": 123,
"version": 123,
"status_url": "<string>",
"virtual_cell_count": 123,
"cells": [
{
"id": "<string>",
"sheet_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"column_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"row_index": 123,
"status": "STALE",
"execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_computed_version": 123,
"display_value": "<string>",
"input_hash": "<string>",
"value": "<unknown>",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}Queue a
recalculate operation for selected columns, rows, and cell statuses.
By default, recalculation targets stale computed cells. Pass column_ids, row_ids, or statuses to narrow the operation.
row_ids are zero-based row indices. statuses accepts STALE, QUEUED, DISPATCHED, RUNNING, COMPLETED, and FAILED; omit it to target stale cells, or pass an empty array to include all statuses. Text columns cannot be recalculated.
If the operation affects many cells, the response may return requires_confirmation with a confirmation_token; pass that token in a follow-up request to proceed. If no matching cells need work, the endpoint can return success with cell_count: 0.
Queued recalculations return version, the sheet version count used for the operation response. Computed cells report last_computed_version after they complete.Authorizations
Headers
Your PromptLayer API key. The key's workspace scopes table resources for this request.
Body
application/json
Available options:
recalculate Columns to recalculate. Text columns cannot be recalculated.
Zero-based row indices to recalculate. If omitted, matching cells across all rows are considered.
Required range:
x >= 0Cell statuses to include. Defaults to stale cells. Pass an empty array to include all statuses.
Available options:
STALE, QUEUED, DISPATCHED, RUNNING, COMPLETED, FAILED Confirmation token returned when the operation exceeds the confirmation threshold.
Response
No operation was queued or confirmation is required.
- CreateTableSheetOperationQueuedResponse
- CreateTableSheetOperationNoopResponse
- CreateTableSheetOperationConfirmationResponse
Available options:
true Available options:
recalculate Show child attributes
Show child attributes
Was this page helpful?

