> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyformat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit Field

> Correct the value of one field of an extraction

*Rate limit tier: **general**, 600 requests/min. See [Rate limits](https://docs.anyformat.ai/api-reference-v3/introduction.md#rate-limits).*

Sets the value of one field of one extraction, as a person reviewing it in the app would, and answers `204 No Content`. `extraction_id` is the `id` of an entry of `results.extractions` in [Get run](https://docs.anyformat.ai/api-reference-v3/runs/get.md). 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](https://docs.anyformat.ai/api-reference-v3/workflows/get.md) 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` |

A column key is unique only within its table, so `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 `422`.

## 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](https://docs.anyformat.ai/api-reference-v3/runs/get.md) 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](https://docs.anyformat.ai/api-reference-v3/datasets/set-ground-truth.md).
* 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`. |
| `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`. |
| `422` | `VALIDATION_ERROR` | 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. |

```bash curl theme={null}
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" }'
```

```python Python (SDK) theme={null}
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",
)
```

```typescript TypeScript (SDK) theme={null}
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",
});
```

```text Response (204 No Content) theme={null}
```

```json Response (404 NOT_FOUND) theme={null}
{
  "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"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.