curl -X POST 'https://api.anyformat.ai/v3/extractions/0699a1c2-e14c-7606-8000-2ee4fb17b4fd/fields/edit/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "sanitized_name": "holdings", "row_index": 2, "column": "quantity", "value": "121" }'
from anyformat.sdk import Client
client = Client(api_key="YOUR_API_KEY")
client.edit_field(
"0699a1c2-e14c-7606-8000-2ee4fb17b4fd",
sanitized_name="holdings",
row_index=2,
column="quantity",
value="121",
)
import { Anyformat } from "@anyformat/sdk";
const af = new Anyformat({ apiKey: "YOUR_API_KEY" });
await af.editField("0699a1c2-e14c-7606-8000-2ee4fb17b4fd", {
sanitizedName: "holdings",
rowIndex: 2,
column: "quantity",
value: "121",
});
{
"error": "Field not found.",
"error_code": "NOT_FOUND",
"retryable": false,
"params": { "resource_type": "field" },
"request_id": "req_abc123",
"doc_url": "https://docs.anyformat.ai/api-reference-v3/errors#error-code-not_found"
}
Edit Field
Correct the value of one field of an extraction
curl -X POST 'https://api.anyformat.ai/v3/extractions/0699a1c2-e14c-7606-8000-2ee4fb17b4fd/fields/edit/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "sanitized_name": "holdings", "row_index": 2, "column": "quantity", "value": "121" }'
from anyformat.sdk import Client
client = Client(api_key="YOUR_API_KEY")
client.edit_field(
"0699a1c2-e14c-7606-8000-2ee4fb17b4fd",
sanitized_name="holdings",
row_index=2,
column="quantity",
value="121",
)
import { Anyformat } from "@anyformat/sdk";
const af = new Anyformat({ apiKey: "YOUR_API_KEY" });
await af.editField("0699a1c2-e14c-7606-8000-2ee4fb17b4fd", {
sanitizedName: "holdings",
rowIndex: 2,
column: "quantity",
value: "121",
});
{
"error": "Field not found.",
"error_code": "NOT_FOUND",
"retryable": false,
"params": { "resource_type": "field" },
"request_id": "req_abc123",
"doc_url": "https://docs.anyformat.ai/api-reference-v3/errors#error-code-not_found"
}
204 No Content. extraction_id is the id of an entry of results.extractions in Get run. One extraction belongs to one workflow version, so a name picks exactly one field.
Naming the field
Name the field by its key in the results (sanitized_name) or by its persistent_id, not both. Send the key you just read, or the persistent_id if you keep ids: it survives a rename. A field’s persistent_id is the one Get workflow returns for it.
| Field | Body |
|---|---|
| A field | { "sanitized_name": "total_balance", "value": "4594.62" } |
| A field, by id | { "persistent_id": "0686bb978c3070f0800097669e00aaaa", "value": "4594.62" } |
| A cell of a table | { "sanitized_name": "holdings", "row_index": 2, "column": "quantity", "value": "121" } |
| A cell of a table, by the column’s id | { "persistent_id": "<id of the quantity column>", "row_index": 2, "value": "121" } |
| A column of a single object | the same, with "row_index": 0 |
column goes with the table’s sanitized_name. row_index counts from 0. A cell of a table is named by a column and a row: the table alone, or a column without its row_index, answers 400.
The value
value is required. Send null to empty the field. Today the API takes the value as a string or null, the form Get run returns. Treat value as the field’s value in whatever type results return for it: a later release can accept numbers, booleans, dates and lists in the same key, and refuse a value that does not fit the field’s type.
A value that is the same text as the original verifies the field. Any other value marks it human_edited. A yes/no field set back to its original answer still counts as an edit when the text differs, such as "true" and "True". value_unit is not part of the public request.
What else the edit does
- On a dataset document whose extraction is fully verified, the edit rewrites the document’s ground truth.
- A document with an assigned verifier refuses every other user with
403 NOT_ASSIGNED_VERIFIER. The key acts as its owner. - The edit changes the stored results only. It does not run the workflow again.
Errors
| Status | error_code | When |
|---|---|---|
400 | VALIDATION_ERROR | The body names no field, names it twice, sends column with a persistent_id, or lacks value; or the name reaches a field that is not one cell: a table, or a column sent without a row_index. The message says which to add. |
403 | NOT_ASSIGNED_VERIFIER | Another user is the assigned verifier of the document. |
403 | insufficient_api_key_scope | The API key has no write scope. |
404 | NOT_FOUND | params.resource_type is extraction (unknown, or in another organization), field (no field has that sanitized_name or column) or datapoint (no cell has that persistent_id or row_index). An extraction_id or a persistent_id that is not a UUID also answers 404, without params. |
curl -X POST 'https://api.anyformat.ai/v3/extractions/0699a1c2-e14c-7606-8000-2ee4fb17b4fd/fields/edit/' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "sanitized_name": "holdings", "row_index": 2, "column": "quantity", "value": "121" }'
from anyformat.sdk import Client
client = Client(api_key="YOUR_API_KEY")
client.edit_field(
"0699a1c2-e14c-7606-8000-2ee4fb17b4fd",
sanitized_name="holdings",
row_index=2,
column="quantity",
value="121",
)
import { Anyformat } from "@anyformat/sdk";
const af = new Anyformat({ apiKey: "YOUR_API_KEY" });
await af.editField("0699a1c2-e14c-7606-8000-2ee4fb17b4fd", {
sanitizedName: "holdings",
rowIndex: 2,
column: "quantity",
value: "121",
});
{
"error": "Field not found.",
"error_code": "NOT_FOUND",
"retryable": false,
"params": { "resource_type": "field" },
"request_id": "req_abc123",
"doc_url": "https://docs.anyformat.ai/api-reference-v3/errors#error-code-not_found"
}
Authorizations
API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.
Path Parameters
Body
Body for POST /v3/extractions/{extraction_id}/fields/edit/.
The corrected value, or null for an empty one. Send the type that results returns for the field. Today every value is a string, and a later release can return numbers, booleans, dates or lists in the same key. A yes/no field edited back to its original answer still counts as an edit when the text differs, as "true" and "True" do.
"4594.62"
The field's key in results.extractions[].fields. Name the field by this or by persistent_id, not both. Inside a table, the table's key.
"holdings"
The field's persistent_id, which survives a rename. Name the field by this or by sanitized_name, not both. Inside a table, the column's own persistent_id.
"0686bb978c3070f0800097669e00aaaa"
The column's key inside the table that sanitized_name names. A column key is unique only within its table. Send it only with sanitized_name; a persistent_id already names the column.
"quantity"
The position of the row in the table, from 0. Send it for a table column, and use 0 for a column of a single object. Omit it for a field that is not in a table.
x >= 02
Response
Successful Response

