Query a specific delivered document
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 accounting_document 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. |
document_id | Add the id of the document you are looking for. |
Headers
Name | Value |
Content-Type | application/vnd.api+json |
Authorization | Bearer [Your API Token] |
Response
In addition to the example response below, you’ll find details about the datastructure here:
- Documents which includes the current processing status.
- Accounting Documents 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"
},
"document_type": "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": {
"accounting_document": {
"data": {
"type": "accounting_document",
"id": "16724"
}
},
"sender_address": {
"data": {
"type": "sender_address",
"id": "6924"
}
}
}
},
"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": "accounting_document",
"attributes": {
"created_at": "2018-05-08T06:56:49.948Z",
"updated_at": "2018-05-10T07:26:49.123Z",
// document type
"type": "receipt",
"sub_type": null,
// invoice meta data
"invoice_date": "2018-02-21",
"delivery_date": "2018-06-01",
"number": "12 34 56",
"order_number": null,
"currency": "EUR",
"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"
}
}