Skip to content
Website

Fetch Document

Retrieve a document, its extracted fields, processing state and approval state.

GET/api/v1_2/documents/:document_id

Document attributes

Text and date attributes may be null or an empty string ("").
Amount attributes are filled with 0 by default.


Response attributes

  • id
    Unique document ID generated by Datamolino on document create
    Example: 69054543

  • agenda_id
    Unique folder ID where the document belongs. (in the UI this is now called Folder)
    Example: 234433

  • type
    String: PurchaseInvoice or SalesInvoice
    Example: PurchaseInvoice

  • created_at
    Timestamp of document creation in iso8601 format
    Example: 2014-12-17T21:58:56Z

  • last_modified_at
    Timestamp of last document modification in iso8601 format
    Example: 2014-12-17T22:03:44Z

  • state
    String - State of document, see description of states below
    Example: repairing

  • comments_count
    Integer - Current count of document comments
    Example: 3

  • verificator_response
    Result text description for processed or not processed document (reason why is document not processed)
    Example: ok

  • preview
    Link to image first page preview. It contains Amazon S3 link to document preview image of document first page. Link is valid for 30 seconds only.
    Example: https://molino.s3....

  • original
    Link to original. It contains Amazon S3 link to document file. Link is valid for 1 hour only after request time and it can be used only once. If you want download original document as url safe base64 string, call Retrieve original file.
    Example: https://molino.s3....

  • content_type
    Content (Mime) type of uploaded document file.
    Example: application/pdf

  • user_file_name
    Initial name of file uploaded by user. Children created during split have the same file name of their parent in this column.
    Example: file_name.pdf

  • parent_document_id
    ID of the originally uploaded document that was split into multiple invoices.
    Example: 44324235

  • invoice_type
    This denotes the sub-type of invoice, such as Invoice, Credit note, Receipt. This value can be changed in Datamolino UI. The Datamolino system tries to detect this invoice type. If detection is not successful, the value defaults to “0 - invoice”. See table below.
    Example: 0

Invoice types

invoice_type Description
0 Invoice
1 Credit note
2 Proforma invoice
3 Cash receipt
4 Not supported
5 Invoice statement
6 Purchase order
7 Interest note
8 Delivery note

approval

  • state
    String - approval addon state
    Example: approved

  • state_description
    String - approval addon state description e.g. reject reason
    Example: Some text

  • approved_at
    Date of approval
    Example: 2014-12-17T21:58:56Z

bank_account

  • bban
    Country specific bank account number - Basic Bank Account Number data not provided by default
    Example: 84939477347

  • bank_code
    Country specific bank code data not provided by default
    Example: 1100

  • bic
    Bank identifier Code (SWIFT code) data not provided by default
    Example: CEKOSKBXXXX

  • iban
    International Bank Account Number data not provided by default
    Example: SK3112000000198742637541

payment_options

List of payment provider specific data extracted from invoice (e.g. Bpay). Contains empty object {} if no payment options are available.

Example of bpay online provider data:

{
  "biller_code": "188011",
  "customer_reference": "10010047002"
}

export_metadata

Contains external id for each integration (Xero, Quickbooks, FreeAgent) where the document was export during his lifecycle. Usually only one is present. Data is always related to the latest export. Contains empty object {} if no data is available.

Example:

{
  "export_metadata": {
    "xero": {
      "id": "demo_export_id"
    }
  }
}

data > header

  • locale
    Language and country identification. Internal usage, based on OCR estimate or other metadata. For internal use only.
    Example: en_GB

  • invoice_text
    Short document text. Invoice description or first line item text. See text field for full text data.
    Example: Dropper premium service ...

  • invoice_no
    Invoice number
    Example: INVC34452683

  • sepa_reference - is not provided by default
    SEPA Payer reference
    Example VS43984349348

  • variable_symbol
    Payment identifier used for domestic payments in Czech Republic and Slovakia.
    Example: 5345345

  • specific_symbol
    Payment identifier used for domestic payments in Czech Republic and Slovakia.
    Example: 4344445

  • issue_date
    Document issue date in format YYYY-MM-DD.
    Example: 2012-05-21

  • tax_date - is not provided by default
    Document tax date in format YYYY-MM-DD
    Example: 2012-05-21

  • due_date
    Document due date in format YYYY-MM-DD.
    Example: 2012-05-21

  • currency
    Document currency 3-character upercase format (ISO 4217 standard).
    Example: USD

  • currency_rate - is not provided by default
    Currency rate if used foreign currency (manually entered by user in web interface)
    Example: 1.0

  • text
    Compilation of item code and name pairs. Usable as source for items full text search.
    Example: I23423 Item...

  • customer_no - is not provided by default
    Customer number
    Example: 1234

  • purchase_order_no - is not provided by default
    Purchase order number. In general this is the order id of the supplier. Unique alpha numeric code identifying purchase order
    Example: 4321

  • reference - is not provided by default
    Reference. Additional reference. Can be used for purchase order number of the customer. Internal PO number of customer.
    Example: ref.:2131

  • delivery_note_no - is not provided by default
    Delivery note number
    Example: xxxx

  • card_no - is not provided by default
    Credit card number. The last 4 digits of Debit or Credit card used for payment.
    Example: ...4211

supplier

Check document type (PurchaseInvoice/SalesInvoice) for subject identification

  • name
    Company name
    Example: Dropper Inc.

  • id
    Company registration number data not provided by default
    Example: 73434366

  • tax_id
    Company registration TAX ID data not provided by default
    Example: 85445455

  • vat_id
    Company registration VAT ID / GST ID
    Example: EN645445654

  • street
    Street name and number data not provided by default
    Example: Franklin Street 5

  • city
    City data not provided by default
    Example: Boston

  • postal_code
    Postal code data not provided by default
    Example: 02130

  • country
    Country. Data not provided by default.
    Example: USA

  • bban
    Country specific bank account number - Basic Bank Account Number data not provided by default
    Example: 84939477347

  • bank_code
    Country specific bank code data not provided by default
    Example: 1100

  • bic
    Bank identifier Code (SWIFT code) data not provided by default
    Example: CEKOSKBXXXX

  • iban
    International Bank Account Number data not provided by default
    Example: SK3112000000198742637541

customer

Check document type (PurchaseInvoice/SalesInvoice) for subject identification

  • name
    Company name
    Example: Datamolino

  • id
    Company registration number data not provided by default
    Example: 53436562

  • tax_id
    Company registration TAX ID data not provided by default
    Example: 4548575

  • vat_id
    Company registration VAT ID
    Example: SK9488445

  • street
    Street name and number data not provided by default
    Example: Zochova 6

  • city
    City data not provided by default
    Example: Bratislava

  • postal_code
    Postal code data not provided by default
    Example: 81103

  • country
    Country. Data not provided by default.
    Example: SVK

  • bban
    Country specific bank account number - Basic Bank Account Number data not provided by default
    Example: 84939477347

  • bank_code
    Country specific bank code data not provided by default
    Example: 1100

  • bic
    Bank identifier Code (SWIFT code) data not provided by default
    Example: CEKOSKBXXXX

  • summary

Payment summary

  • payment_amount
    The total payable after deducting discounts, deposits and adding up additional costs and shipping. data not provided by default
    Example: 485.93

  • paid_deposits - data not provided by default
    Example: 0

  • rounding - data not provided by default
    Example: 0

  • sub_total
    Example: 404.94

  • vat_total
    Example: 80.99

  • total
    Example: 485.93

  • shipping
    Freight charges / Shipping. data not provided by default
    Example: 0.00

  • other_cost1
    Additional cost. Can be packaging fees, handling fees, etc. data not provided by default
    Example: 0.00

  • other_cost2
    Additional cost. Can be packaging fees, handling fees, etc. data not provided by default
    Example: 0.00

  • other_cost3
    Additional cost. Can be packaging fees, handling fees, etc. data not provided by default
    Example: 0.00

  • total_discount
    Total of discounts applied on the invoice line items. Captured if this is denoted in the summary of invoice.data not provided by default
    Example: 0.00

tax_lines

List of tax summary groupped by tax

  • name
    Example: Tax Group 1

  • percent
    Example: 20

  • sub_total
    Example: 404.94

  • vat_total
    Example: 80.99

  • total
    Example: 485.93

  • paid_deposits - deprecated
    Example: 0

items

List of line items

  • code
    Example: 07149140786

  • name
    Example: Droppper basic service

  • quantity
    Example: 1

  • unit
    Example: item

  • unit_price
    Example: 404.94

  • tax_rate
    Example: 20

  • subtotal
    Example: 404.94

  • tax
    Example: 80.99

  • total
    The line amount reflects the discounted price if a discount_rate has been used i.e total = quantity * unit_price * ((100 - discount_rate)/100)
    Example: 485.93

  • discount_rate
    Percentage. Discount on the line item. data not provided by default
    Example: 3.00

  • discount
    Discount amount on the line item. data not provided by default
    Example: 23.00


PLEASE NOTE:
Where the comment “data not provided by default” is present, contact our team to agree on specific user plan for your application, if your business case requires such information.

Where the comment “deprecated” appears, the feature is no longer supported. Contact us for more info.


Document types

Also known as sub-folders in web app UI (Purchases/Sales).

type Description
PurchaseInvoice Received document/invoice for your purchase
SalesInvoice Invoice for selling of your goods or services

Document states

state Description
uploaded new uploaded document
extracting document in processing (automated processing)
templating document in processing (manual processing)
repairing document in processing (manual processing)
ready document processing finished, data ready for export
not_ready document processing finished as not processed
parent document processing finished, document was divided into multiple child documents
trash deleted document (deleted by user or through API)
file_duplicate same file is already in folder (this detection is automated when uploaded through the UI or you can turn on this check when uploading through API)
data_duplicate document with same data is already in folder
exporting document is being exported to connected online accounting SW (only via Web interface)
auto_exporting document is being exported to connected online accounting SW (only via Web interface)
exported document was successfully exported to connected online accounting SW (only via Web interface)
auto_exported document was successfully exported to connected online accounting SW (only via Web interface)
export_error document export to integrated cloud accounting failed because of connection or validation issues

Document states after processing

New uploaded documents are automatically queued for processing and after processing there are possible these states:

state Description
ready processing successfully finished, document data are ready for processing
not_ready processing finished with error without data extraction, check attribute verificator_response for reason
parent result of processed document are new documents, original document was split into new documents. Request for parent document returns list of child documents and parent document is not available through API.
data_duplicate document with same data is already in folder (supplier name / invoice number combination)
file_duplicate same file is already in folder (this detection is automated when uploaded through the UI or you can turn on this check when uploading through API)

Attribute preview contains Amazon S3 link to processed document preview image of document first page. Link is valid for 30 seconds only.

Attribute original contains Amazon S3 link to processed document original file. Link is valid for 1 hour. If you want download original document as url safe base64 string, call Retrieve original file

Path parameters

Name Example Description
document_id - -

Headers

Name Example Description
Accept application/json -
Content-Type application/json -

Code examples

cURL

curl --request GET 'https://app.datamolino.com/api/v1_2/documents/98765' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer demo_access_token'

HTTP

GET /api/v1_2/documents/98765 HTTP/1.1
Host: app.datamolino.com
Accept: application/json
Content-Type: application/json
Authorization: Bearer demo_access_token

JavaScript Fetch

const response = await fetch("https://app.datamolino.com/api/v1_2/documents/98765", {
  method: "GET",
  headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer demo_access_token"
  },
});

const data = await response.json();

Node.js Axios

import axios from "axios";

const response = await axios({
  method: "get",
  url: "https://app.datamolino.com/api/v1_2/documents/98765",
  headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer demo_access_token"
  }
});

console.log(response.data);

Python Requests

import requests

url = "https://app.datamolino.com/api/v1_2/documents/98765"
headers = {
  "Accept": "application/json",
  "Content-Type": "application/json",
  "Authorization": "Bearer demo_access_token"
}

response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.json())

Ruby Net::HTTP

require 'json'
require 'net/http'

uri = URI("https://app.datamolino.com/api/v1_2/documents/98765")
request = Net::HTTP::Get.new(uri)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer demo_access_token"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end

puts JSON.parse(response.body)

Ruby on Rails

# app/services/datamolino_client.rb
require 'json'
require 'net/http'

class DatamolinoClient
  BASE_URL = "https://app.datamolino.com"

  def initialize(access_token: Rails.application.credentials.dig(:datamolino, :access_token))
@access_token = access_token
  end

  def request_fetch_document
uri = URI("#{BASE_URL}/api/v1_2/documents/98765")
request = Net::HTTP::Get.new(uri)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer #{@access_token}"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

JSON.parse(response.body)
  end
end

PHP Guzzle

<?php

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('GET', 'https://app.datamolino.com/api/v1_2/documents/98765', [
'headers' => json_decode('{"Accept":"application/json","Content-Type":"application/json","Authorization":"Bearer demo_access_token"}', true)
]);

echo $response->getBody();

Java OkHttp

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
.url("https://app.datamolino.com/api/v1_2/documents/98765")
.addHeader("Accept", "application/json")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer demo_access_token")
.method("GET", null)
.build();

Response response = client.newCall(request).execute();

C# HttpClient

using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://app.datamolino.com/api/v1_2/documents/98765");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer demo_access_token");

using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Go Native

client := &http.Client{}
req, err := http.NewRequest("GET", "https://app.datamolino.com/api/v1_2/documents/98765", nil)
if err != nil { panic(err) }
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer demo_access_token")

res, err := client.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()

body, err := io.ReadAll(res.Body)
if err != nil { panic(err) }
fmt.Println(string(body))

Swift URLSession

import Foundation

var request = URLRequest(url: URL(string: "https://app.datamolino.com/api/v1_2/documents/98765")!)
request.httpMethod = "GET"
request.setValue("application/json", forHTTPHeaderField: "Accept")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("Bearer demo_access_token", forHTTPHeaderField: "Authorization")

let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8)!)

Responses

200 OK

Content type: application/json; charset=utf-8

{
  "links": {
    "back": {
      "href": "https://beta.datamolino.com/api/v1_2/documents"
    },
    "self": {
      "href": "https://beta.datamolino.com/api/v1_2/documents/315940?access_token=demo_access_token"
    }
  },
  "documents": [
    {
      "links": {
        "self": {
          "href": "https://beta.datamolino.com/api/v1_2/documents/315940"
        }
      },
      "id": 315940,
      "type": "PurchaseInvoice",
      "created_at": "2019-11-05T10:41:06Z",
      "last_modified_at": "2019-11-05T10:44:52Z",
      "state": "ready",
      "comments_count": 2,
      "view_detail": "summary",
      "verificator_response": "ok",
      "parent_document_id": null,
      "preview": "/originals/preview/missing.png",
      "original": "https://files.example.com/datamolino-demo/original/demo-supplier-invoice.pdf?expires=3600&signature=demo_signature",
      "user_file_name": "12_20180427.000158.01.pdf",
      "invoice_type": 0,
      "bank_account": {
        "bban": "",
        "bank_code": "",
        "bic": null,
        "iban": null
      },
      "payment_options": {
        "bpay": {
          "biller_code": "122211",
          "customer_reference": "12222047002"
        }
      },
      "data": {
        "header": {
          "locale": "sk_SK",
          "invoice_text": "Cloud Services Subscription",
          "invoice_no": "INV-2026-00039",
          "sepa_reference": "",
          "variable_symbol": "",
          "specific_symbol": "",
          "issue_date": "2017-02-28",
          "tax_date": null,
          "due_date": null,
          "currency": "EUR",
          "currency_rate": "1.0",
          "text": " Cloud Services Subscription  Cloud Services Subscription",
          "customer_no": "",
          "purchase_order_no": "",
          "reference": "",
          "delivery_note_no": "",
          "card_no": ""
        }
      },
      "supplier": {
        "name": "Demo Supplier Ltd",
        "id": "",
        "tax_id": "",
        "vat_id": "IE6388047V",
        "street": "",
        "city": "",
        "postal_code": "",
        "country": "",
        "iban": null,
        "bic": null,
        "bban": null,
        "bank_code": null
      },
      "customer": {
        "name": "Demo Trading Ltd",
        "id": "",
        "tax_id": "",
        "vat_id": "SK2023832976",
        "street": "Zochova 6 - 8",
        "city": "Bratislava",
        "postal_code": "811 03",
        "country": "SVK",
        "iban": null,
        "bic": null,
        "bban": null,
        "bank_code": null
      },
      "summary": {
        "shipping": 0,
        "other_cost1": 0,
        "other_cost2": 0,
        "other_cost3": 0,
        "total_discount": 0,
        "payment_amount": 0,
        "paid_deposits": 0,
        "rounding": 0,
        "sub_total": 102,
        "vat_total": 0,
        "total": 102
      },
      "tax_lines": [
        {
          "id": 238676,
          "name": "Tax line name",
          "percent": 0,
          "sub_total": 102,
          "vat_total": 0,
          "total": 102,
          "paid_deposits": 0
        }
      ],
      "items": [
        {
          "id": 389633,
          "code": "",
          "name": "Demo Supplier Ltd",
          "quantity": 0,
          "unit": 0,
          "unit_price": 0,
          "tax_rate": 0,
          "subtotal": 96,
          "tax": 0,
          "total": 0,
          "discount_rate": 0,
          "discount": 0
        },
        {
          "id": 389634,
          "code": "",
          "name": "Demo Supplier Ltd",
          "quantity": 0,
          "unit": 0,
          "unit_price": 0,
          "tax_rate": 0,
          "subtotal": 6,
          "tax": 0,
          "total": 0,
          "discount_rate": 0,
          "discount": 0
        }
      ]
    }
  ]
}

Type to search…

↑↓ navigate↵ selectEsc close