Skip to main content
PATCH
/
api
/
public
/
v2
/
tables
/
{table_id}
/
sheets
/
{sheet_id}
/
cells
/
{cell_id}
Update Cell
curl --request PATCH \
  --url https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/cells/{cell_id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "display_value": "<string>",
  "value": "<unknown>"
}
'
import requests

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

payload = {
"display_value": "<string>",
"value": "<unknown>"
}
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({display_value: '<string>', value: '<unknown>'})
};

fetch('https://api.promptlayer.com/api/public/v2/tables/{table_id}/sheets/{sheet_id}/cells/{cell_id}', 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}/cells/{cell_id}",
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([
'display_value' => '<string>',
'value' => '<unknown>'
]),
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}/cells/{cell_id}"

payload := strings.NewReader("{\n \"display_value\": \"<string>\",\n \"value\": \"<unknown>\"\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}/cells/{cell_id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"display_value\": \"<string>\",\n \"value\": \"<unknown>\"\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"display_value\": \"<string>\",\n \"value\": \"<unknown>\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "cell": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "sheet_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "column_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "row_index": 123,
    "display_value": "<string>",
    "value": "<unknown>",
    "error": "<string>",
    "input_hash": "<string>",
    "updated_at": "2023-11-07T05:31:56Z",
    "request_metrics": {
      "request_count": 123,
      "request_ids": [
        123
      ],
      "latency_ms": 123,
      "price": 123,
      "input_tokens": 123,
      "output_tokens": 123,
      "trace_ids": [
        "<string>"
      ]
    },
    "execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "last_computed_version": 123,
    "error_message": "<string>"
  },
  "version": 123,
  "stale_count": 123
}
{
"success": false,
"message": "<string>",
"error": "<string>"
}
{
"success": false,
"message": "<string>",
"error": "<string>"
}
{
"success": false,
"message": "<string>",
"error": "<string>"
}
Edit the value of a text column cell. Only cells in text type columns can be edited directly — non-text column cells are computed automatically. Editing a cell marks downstream dependent cells as stale. Editing a cell creates a new sheet version. The response returns version, and cells include last_computed_version when they were produced by computation.

Authorizations

X-API-KEY
string
header
required

Path Parameters

table_id
string<uuid>
required
sheet_id
string<uuid>
required
cell_id
string<uuid>
required

Body

application/json
display_value
string | null

Human-readable display value.

value
any

Structured value to store.

Response

Cell updated

success
boolean
cell
object

A single cell at the intersection of a column and a row.

version
integer

Current sheet version_count for this response. It matches the sheet's version_count after any committed changes.

stale_count
integer

Number of downstream cells marked stale due to this edit.