Query delivered documents

GET /api/v1/[tenant_id]/documents?include=classifications,sender_address
The API responds with a collection of documents matching the criteria.

Request

In the JSON API standard, there is the concept of sideposts. This allows us to choose what kind of data we want to retrieve. In our specific case the endpoint URL already includes classifications and sender_address as an example, so you get them right away. If you don’t need those, you can just remove these. In the following examples, we just expect we would query both right away.

Parameters

Name Value
tenant_id Add your tenant_id to every request URL.
filter Add any filter parameters to match your needs.
page Add parameters to paginate your collection.

Headers

Name Value
Content-Type application/vnd.api+json
Authorization Bearer [Your API Token]

Response

In addition to the example response below, you’ll here find details about the datastructure:

  • Documents which includes the current processing status.
  • Classifications which includes extracted data specific to the document type.
  • Addresses which represents the sender address.

Example Response Body

{
    "data": [
        {
            "id": "767",
            "type": "documents",
            "attributes": {
                "created_at": "2018-05-08T06:21:19.650Z",
                "updated_at": "2018-09-24T07:21:28.998Z",

                // meta data, current status etc
                "tenant_id": "1",
                "current_status": "done",
                "estimated_time_of_completion": "2018-09-25T07:21:28.994Z",
                "extraction_process": "basic_extraction",
                "error_codes": [
                    "for_training"
                ],
                "custom_fields": {
                    "customer_id": "1234"
                },
                "classification_types": [
                    "receipt"
                ],

                // original and converted files
                "source_files": [
                    {
                        "url": "https://api.robo-accounting.io/...",
                        "file_name": "filename.pdf",
                        "mime_type": "application/pdf"
                    }
                ],
                "signed_pdf": {
                    "url": "https://api.robo-accounting.io/...",
                    "file_name": "signed_filename.pdf",
                    "mime_type": "application/pdf"
                }
            },
            "relationships": {
                "classifications": {
                    "data": {
                        "type": "classifications",
                        "id": "16724"
                    }
                },
                "sender_address": {
                    "data": {
                        "type": "sender_address",
                        "id": "6924"
                    }
                }
            }
        },
        {
            "id": "768",
            "type": "documents",
            "attributes": {
                ...
            }
        }
    ],
    "included": [
        {
            "id": "6924",
            "type": "sender_address",
            "attributes": {
                "address_id": null,
                "type": "sender_address",

                // company address
                "company_name": "Tiefbauamt Stadt Thun",
                "contact_person_name": "",
                "street": "Industriestrasse ",
                "house_number": "2",
                "post_office_box": null,
                "postal_code": "3602",
                "city_name": "Thun",
                "country_code": "CH",

                // company and tax id for identification
                "company_id": null,
                "vat_id": null
            },
            "relationships": {
                "document": {
                    "meta": {
                        "included": false
                    }
                }
            }
        },
        {
            "id": "16724",
            "type": "receipts",
            "attributes": {
                "created_at": "2018-05-08T06:56:49.948Z",
                "updated_at": "2018-05-10T07:26:49.123Z",

                // document type
                "type": "receipts",
                "sub_type": null,

                // invoice meta data
                "invoice_date": "2018-02-21",
                "number": "12 34 56",
                "order_number": null,
                "currency": "EUR",
                "delivery_date": "2018-06-01",
                "including_tax": true,
                "additional_information": null,

                // line items
                "items": [
                    {
                        "title": "DSL Internet Verbindung",
                        "amount_total": 270,
                        "nominal_account": "491"
                    }
                ],

                // payment related information
                "payment_conditions": [
                    {
                        "date": "2018-03-07",
                        "type": "payment_condition",
                        "percentage": null,
                        "fixed_price": null,
                        "number_of_days": 14
                    }
                ],
                "bank_accounts": [
                    {
                        "bic": "BIC12345678",
                        "iban": "CH12 1234 1234 1234 1234"
                    }
                ],
                "discount_rate": null,
                "discount_total": null,
                "payment_method": null,
                "amount_total": 270
                "reference": null,

                // ocr text
                "text": null,
            },
            "relationships": {
                "document": {
                    "meta": {
                        "included": false
                    }
                }
            }
        }
    ],
    "meta": {},
    "jsonapi": {
        "version": "1.0"
    }
}