Appearance
Definitions
Endpoints for reading document definitions: the kinds of defined document you can upload, and the fields each one has.
List definitions
Lists the document definitions you can upload a document as, sorted by name.
| Endpoint | /api/definitions |
|---|---|
| Method | GET |
WARNING
Defined documents must be enabled for your account. If they aren't, this endpoint returns an empty list ([]). Contact us to enable them.
The list has the latest version of each definition, the one an upload uses.
Request
bash
curl https://api-sandbox.eyedp.com/api/definitions \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response
json
[
{
"definitionId": "uk_council_tax@2",
"key": "uk_council_tax",
"version": 2,
"name": "UK council tax bill",
"description": "A yearly council tax bill from a council in the United Kingdom.",
"country": "GB"
},
{
"definitionId": "vehicle_insurance_certificate@1",
"key": "vehicle_insurance_certificate",
"version": 1,
"name": "Vehicle insurance certificate"
}
]| Field | Type | Description |
|---|---|---|
definitionId | string | The definition id: the definition key and version, joined by @. Pass it to Get definition to read the fields. |
key | string | The definition key. Send it as definitionKey to upload a document as this definition. |
version | integer | The version number. |
name | string | The definition's name, for people. |
description | string | What the document is. Left out when there's no description. |
country | string | The country the document is from, as an ISO 3166-1 alpha-2 code. Left out when the document can be from any country. |
Errors
| Status | Meaning | What to do |
|---|---|---|
401 | The bearer token is missing, invalid or has expired. | Get a new token. |
Get definition
Gets the fields of one version of a document definition. Use it to see which fields a defined document has, including one processed with an older version.
| Endpoint | /api/definitions/{definitionId} |
|---|---|
| Method | GET |
Request
| Field | Type | Required | Description |
|---|---|---|---|
definitionId | string | Yes | In the path. A definition id, such as uk_council_tax@2. Take it from List definitions, or from a document's definitionId on Get document. |
You can read older versions as well as the latest, so you can read the fields of a document processed with one. This works even when defined documents aren't enabled for your account. It doesn't work once all of a definition's versions have been retired (see the 404 below). Get document extraction still returns the fields and values of a document processed with one.
bash
curl https://api-sandbox.eyedp.com/api/definitions/uk_council_tax@2 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Response
json
{
"definitionId": "uk_council_tax@2",
"fields": [
{
"key": "holder.fullName",
"label": "Name",
"fieldType": "string",
"description": "The name of the person the bill is for."
},
{
"key": "holder.address",
"label": "Address",
"fieldType": "string"
},
{
"key": "issueDate",
"label": "Issue date",
"fieldType": "date"
},
{
"key": "band",
"label": "Band",
"fieldType": "string"
},
{
"key": "totalDue",
"label": "Total due",
"fieldType": "money"
},
{
"key": "discounts",
"label": "Discounts",
"fieldType": "array"
},
{
"key": "instalments",
"label": "Instalments",
"fieldType": "table",
"columns": [
{
"key": "dueDate",
"label": "Due date",
"fieldType": "date"
},
{
"key": "amount",
"label": "Amount",
"fieldType": "money",
"description": "The amount due on that date."
}
]
}
]
}| Field | Type | Description |
|---|---|---|
definitionId | string | The definition id you asked for. |
fields | array | The fields a document of this version has, in the definition's order. |
fields[].key | string | The field's key. A field inside a group of fields has a dotted key, such as holder.fullName. The group itself isn't listed. |
fields[].label | string | The field's name, for people. |
fields[].fieldType | string | The kind of value. See the table below. Left out when the definition doesn't give one. |
fields[].description | string | What the field holds. Left out when there's no description. |
fields[].columns | array | Only for a table field: the fields of each row, with keys relative to the row. Each column has key, label, fieldType and description, as a field does. A group of fields in a row has dotted keys, such as payee.name. |
| Field type | Usual value |
|---|---|
string | Text. |
number | A number. |
boolean | true or false. |
date | A date, as an ISO 8601 string. |
money | An amount, as a number. |
identifier | An id or reference printed on the document, as text. |
array | A list of plain values. |
table | A list of rows, each with the fields in columns. |
New field types may be added. Treat a field type you don't recognise as plain JSON, and read its value as it is.
Get document extraction returns a document's values under the same keys. A value isn't always the kind its field type names, so check its JSON type there.
Errors
| Status | Code | Meaning | What to do |
|---|---|---|---|
401 | The bearer token is missing, invalid or has expired. | Get a new token. | |
404 | definition_not_found | There's no definition version with this id that you can read. This includes an id that isn't in the key@version form. It also includes a definition you can no longer upload as because all its versions have been retired: every version of it returns 404, including older ones. | Check the id. See Error codes. |

