Skip to content

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
MethodGET

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"
    }
]
FieldTypeDescription
definitionIdstringThe definition id: the definition key and version, joined by @. Pass it to Get definition to read the fields.
keystringThe definition key. Send it as definitionKey to upload a document as this definition.
versionintegerThe version number.
namestringThe definition's name, for people.
descriptionstringWhat the document is. Left out when there's no description.
countrystringThe country the document is from, as an ISO 3166-1 alpha-2 code. Left out when the document can be from any country.

Errors ​

StatusMeaningWhat to do
401The 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}
MethodGET

Request ​

FieldTypeRequiredDescription
definitionIdstringYesIn 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."
                }
            ]
        }
    ]
}
FieldTypeDescription
definitionIdstringThe definition id you asked for.
fieldsarrayThe fields a document of this version has, in the definition's order.
fields[].keystringThe 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[].labelstringThe field's name, for people.
fields[].fieldTypestringThe kind of value. See the table below. Left out when the definition doesn't give one.
fields[].descriptionstringWhat the field holds. Left out when there's no description.
fields[].columnsarrayOnly 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 typeUsual value
stringText.
numberA number.
booleantrue or false.
dateA date, as an ISO 8601 string.
moneyAn amount, as a number.
identifierAn id or reference printed on the document, as text.
arrayA list of plain values.
tableA 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 ​

StatusCodeMeaningWhat to do
401The bearer token is missing, invalid or has expired.Get a new token.
404definition_not_foundThere'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.