curl 'https://api.anyformat.ai/v3/document-packets/069dcc2c-e14c-7606-8000-2ee4fb17b4e1/ground-truth/' \
-H 'Authorization: Bearer YOUR_API_KEY'
from anyformat.sdk import Client
client = Client(api_key="YOUR_API_KEY")
stored = client.get_ground_truth("069dcc2c-e14c-7606-8000-2ee4fb17b4e1")
print(stored.version_id, stored.ground_truth)
import { Anyformat } from "@anyformat/sdk";
const af = new Anyformat({ apiKey: "YOUR_API_KEY" });
const stored = await af.getGroundTruth("069dcc2c-e14c-7606-8000-2ee4fb17b4e1");
{
"ground_truth": {
"0686bb978c3070f0800097669e00aaaa": "INV-001",
"0686bb978c3070f0800097669e00bbbb": [
{ "0686bb978c3070f0800097669e00cccc": "12.00" }
]
},
"version_id": "FGaV4I2JAA",
"node_id": "extract_1"
}
{
"ground_truth": null,
"version_id": "FGaV4I2JAA",
"node_id": "extract_1"
}
Get Ground Truth
One dataset document’s ground truth, keyed by field persistent_id
curl 'https://api.anyformat.ai/v3/document-packets/069dcc2c-e14c-7606-8000-2ee4fb17b4e1/ground-truth/' \
-H 'Authorization: Bearer YOUR_API_KEY'
from anyformat.sdk import Client
client = Client(api_key="YOUR_API_KEY")
stored = client.get_ground_truth("069dcc2c-e14c-7606-8000-2ee4fb17b4e1")
print(stored.version_id, stored.ground_truth)
import { Anyformat } from "@anyformat/sdk";
const af = new Anyformat({ apiKey: "YOUR_API_KEY" });
const stored = await af.getGroundTruth("069dcc2c-e14c-7606-8000-2ee4fb17b4e1");
{
"ground_truth": {
"0686bb978c3070f0800097669e00aaaa": "INV-001",
"0686bb978c3070f0800097669e00bbbb": [
{ "0686bb978c3070f0800097669e00cccc": "12.00" }
]
},
"version_id": "FGaV4I2JAA",
"node_id": "extract_1"
}
{
"ground_truth": null,
"version_id": "FGaV4I2JAA",
"node_id": "extract_1"
}
persistent_id, as an eval grades it. Read it before you correct it with Set ground truth.
document_packet_id is the dataset copy’s id: the one Upload to dataset returns, or the one GET …/evals/{eval_id}/accuracy/ lists in by_document_packet.
Omit version to read the workflow’s current version, the one an eval grades by default; pass a version_id from List workflow versions to read another. node_id is the extract node’s id in the workflow graph, and you need it only when the version has more than one extract node; without it such a version answers 422 EXTRACT_NODE_UNRESOLVED. The response names the version_id and node_id it was read from. ground_truth is null until ground truth is first set for that version and node.
Any key with the read scope can read. Every 404 NOT_FOUND names what is missing in params.resource_type: document_packet for an unknown packet or one in another organization, and workflow_version for an unknown version. A production packet answers 409 NOT_IN_DATASET: only a dataset document packet holds ground truth.
curl 'https://api.anyformat.ai/v3/document-packets/069dcc2c-e14c-7606-8000-2ee4fb17b4e1/ground-truth/' \
-H 'Authorization: Bearer YOUR_API_KEY'
from anyformat.sdk import Client
client = Client(api_key="YOUR_API_KEY")
stored = client.get_ground_truth("069dcc2c-e14c-7606-8000-2ee4fb17b4e1")
print(stored.version_id, stored.ground_truth)
import { Anyformat } from "@anyformat/sdk";
const af = new Anyformat({ apiKey: "YOUR_API_KEY" });
const stored = await af.getGroundTruth("069dcc2c-e14c-7606-8000-2ee4fb17b4e1");
{
"ground_truth": {
"0686bb978c3070f0800097669e00aaaa": "INV-001",
"0686bb978c3070f0800097669e00bbbb": [
{ "0686bb978c3070f0800097669e00cccc": "12.00" }
]
},
"version_id": "FGaV4I2JAA",
"node_id": "extract_1"
}
{
"ground_truth": null,
"version_id": "FGaV4I2JAA",
"node_id": "extract_1"
}
Authorizations
API key issued from app.anyformat.ai/api-key. Send as Authorization: Bearer <key>.
Path Parameters
Query Parameters
A version_id from GET /v3/workflows/{workflow_id}/versions/. Omit it for the workflow's current version, the one an eval grades by default.
The extract node's id in the workflow graph, as GET /v3/workflows/{workflow_id}/ returns it. Required only when the version has more than one extract node.
Response
Successful Response
A document packet's stored ground truth and the (version, node) it belongs to.
The expected document, keyed by the workflow's field persistent_ids. A scalar field maps to string | null; a table or object field maps to an array of row objects keyed the same way. null until ground truth is first set for this version and node.
{
"0686bb978c3070f0800097669e00aaaa": "INV-001"
}
The workflow version the ground truth belongs to.
"FGaV4I2JAA"
The extract node's id in the workflow graph.
"extract_1"

