Externe koppeling | API Documentation
The Bookie has an API available for limited functionality.
Subjetcs
Authentication
Authentication is via OAuth2. Before you can get started, a client_id and client_secret must be requested from The Bookie. This can be done through the email address development@thebookie.nl. We need a name of the application requesting access and a redirect url, to which, after successfully linking to an account, can be redirected.
To begin the authorization flow go to the following endpoint:
https://backend.thebookie.nl/nl/o/authorize/?response_type=code&client_id=e7ah0e13Plz9sIV4Aj9fLkL4saNDQdYIn1CPKVEa&redirect_uri=http://test.redirect.url/
You will now see the following screen asking for user authorization. If the user has access to multiple administrations, you will be asked which administration the user wants to grant access for.

As the redirect_url in this example, we used http://test.redirect.url/. After successful authorization, you should now get the following url:
http://test.redirect.url/?code=uVqLxiHDKIirldDZQfSnDsmYW1Abj2&admin_id=3496
The authorization code is valid for 60 seconds.
Note: The Bookie's OAuth2 authorization differs from standard in that in addition to returning an authorization code, it also returns an admin_id as a parameter. This admin_id is important because it is used in almost all requests.
Now an access token can be requested. The following cURL command can be used as an example:
curl -X POST \
-H "Cache-Control: no-cache" \
-H "Content-Type: application/x-www-form-urlencoded" \
"https://backend.thebookie.nl/nl/o/token/" \
-d "client_id=e7ah0e13Plz9sIV4Aj9fLkL4saNDQdYIn1CPKVEa" \
-d "client_secret=jfOGDUhTSF8LaqwzqHZ3fMFVzf3YXpz8GQXXcJidWCX247WZnHk5hgYtrPkDFlbL8d1Clj4PzHFrezpy1lN5U2QO79vQnYJMfkpo0OLht3xepDZSD0PGgyIb4rdAQSVi" \
-d "code=uVqLxiHDKIirldDZQfSnDsmYW1Abj2" \
-d "redirect_uri=http://test.redirect.url/" \
-d "grant_type=authorization_code" \
-d "admin_id=3496"
You should get the following response:
{ "access_token": "jooqrnOrNa0BrNWlg68u9sl6SkdFZg", "expires_in": 36000, "token_type": "Bearer", "scope": "read write", "refresh_token": "HNvDQjjsnvDySaK0miwG4lttJEl9yD" }
To access resources you use the access token. For example:
curl \
-H "Authorization: Bearer jooqrnOrNa0BrNWlg68u9sl6SkdFZg" \
-X GET https://backend.thebookie.nl/nl/api/e1/resource
Refresh Token
curl -X POST \
-H "Cache-Control: no-cache" \
-H "Content-Type: application/x-www-form-urlencoded" \
"https://backend.thebookie.nl/nl/o/token/" \
-d "client_id=e7ah0e13Plz9sIV4Aj9fLkL4saNDQdYIn1CPKVEa" \
-d "client_secret=jfOGDUhTSF8LaqwzqHZ3fMFVzf3YXpz8GQXXcJidWCX247WZnHk5hgYtrPkDFlbL8d1Clj4PzHFrezpy1lN5U2QO79vQnYJMfkpo0OLht3xepDZSD0PGgyIb4rdAQSVi" \
-d "refresh_token=HNvDQjjsnvDySaK0miwG4lttJEl9yD" \
-d "redirect_uri=http://test.redirect.url/" \
-d "grant_type=refresh_token" \
-d "admin_id=3496"
Contacts
Lijst
Endpoint:
GET https://backend.thebookie.nl/nl/api/e1/contacts/?admin_id=admin_id
Url parameters:
- admin_id (verplicht)
- search (zoeken op bedrijfsnaam)
- is_client (True/False filteren op klant)
- is_supplier (True/False filteren op leverancier)
DETAIL / UPDATE / PATCH / DELETE
Endpoint:
GET https://backend.thebookie.nl/nl/api/e1/contacts/contact_id/
Url parameters:
- contact_id (INT verplicht)
response:
{
"id": 97645,
"organisation_name": "Gladiool Tuinarchitecten",
"street": "",
"street_number": "",
"street_number_addition": null,
"extra_address_line": "",
"postal_code": "",
"town": "",
"country": "",
"organisation_kvk_number": null,
"organisation_btw_number": null,
"is_supplier": true,
"is_client": true,
"email": null,
"telephone_number": null,
"mobile_number": null,
"status": 1,
"first_name": null,
"last_name": null,
"associated_ledger_account": [],
"btw_shifted_preset": "NONE",
"total_sales_amount_excl_btw": 0,
"total_sales_amount_payable": 0,
"total_purchase_amount_excl_btw": 0,
"total_purchase_amount_payable": 0,
"extra_info": ""
}
Aanmaken
Endpoint:
POST https://backend.thebookie.nl/nl/api/e1/contacts/create/
Example:
{
"admin_id": 3496,
"organisation_name": "Gladiool Tuinarchitecten",
"street": "Waterstraat",
"street_number": "9999",
"street_number_addition": null,
"extra_address_line": null,
"postal_code": "3511BW",
"town": "Utrecht",
"country": null,
"organisation_kvk_number": null,
"organisation_btw_number": null,
"is_supplier": true,
"is_client": true,
"email": "ricky@gladiool.nl",
"telephone_number": null,
"mobile_number": null,
"first_name": "Ricky",
"last_name": "Gladiool",
"extra_info": ""
}
Sales invoices
Lijst
Endpoint:
GET https://backend.thebookie.nl/nl/api/e1/sales-journals/?admin_id=admin_id
Url parameters:
- admin_id (verplicht)
- search (zoeken op bedrijfsnaam)
- invoice_number (zoeken op factuurnnummer
Aanmaken
Endpoint:
POST https://backend.thebookie.nl/nl/api/e1/sales-journals/create/
Example:
{
"admin_id": 3496,
"contact_id": 10689,
"invoice_number": 2021231,
"invoice_date": "2021-10-12",
"btw_shifted": "NONE",
"journal_entry_lines": [
{
"description": "Boekregel 1",
"btw_type": "PROCENT_21",
"amount": "1200.0",
"quantity": "2.00"
}
],
"attachment": null,
}
btw_shifted opties: ["NONE", "NON_EU", "EU"]
btw_type opties: ["PROCENT_9", "PROCENT_21", "PROCENT_0"]
Optionally, a PDF can be included as an attachment. This is in the form of a Base64 encoded string. More info.
DETAIL / UPDATE / PATCH / DELETE
Endpoint:
https://backend.thebookie.nl/nl/api/e1/sales-journals/id/
To edit entry lines, the id of the entry line must be included. If you do not do this, a new book line will be added to the invoice. To delete an entry line from the sales invoice, "deleted": true must be added. The following example adds one line to the invoice and deletes one in a single call.
{
"journal_entry_lines": [
{
"id": 12312312,
"deleted": true
},
{
"description": "Boekregel 2",
"btw_type": "PROCENT_9",
"amount": "10.0",
"quantity": "1.00"
}
]
}
Sales invoices payments
In fact, when an invoice is paid, a memorial entry is created. There is a special endpoint for this for convenience, which facilitates the request.
GET https://backend.thebookie.nl/nl/api/e1/sales-journals/id/payments/
Returns a list of payments (journal entries) associated with the invoice.
POST https://backend.thebookie.nl/nl/api/e1/sales-journals/id/payments/create/
Registering payment for sales invoice
Example reguest:
{
"amount": "120.00",
"date": "2021-10-13"
}
Response:
{ "status": "payment successfully created" }
By default, the payment is posted to general ledger account 1300 - Accounts Receivable. Optionally, a general ledger account number can be added to the request to make the posting to a different general ledger account number.
{
"amount": "120.00",
"date": "2021-10-13",
"ledger_account_number": 2110
}
When the full outstanding amount of the invoice is paid, the status of the invoice will automatically change to “Paid.”
Expenses
Lijst
Endpoint:
GET https://backend.thebookie.nl/nl/api/e1/purchase-journals/?admin_id=admin_id
Url parameters:
- admin_id (verplicht)
- search (zoeken op bedrijfsnaam, boeknummer of betalingskenmerk)
- working_year: Filteren op jaar
- working_period: Filteren op kwartaal
- amount_from: bedragen groter dan
- amount_until: bedragen kleiner dan
Aanmaken
Endpoint:
POST https://backend.thebookie.nl/nl/api/e1/purchase-journals/create/
Example:
{
"admin_id": 3496,
"contact_id": 10689,
"payment_ref": 2021231,
"invoice_date": "2021-10-12",
"btw_shifted": "NONE",
"journal_entry_lines": [
{
"description": "Boekregel 1",
"btw_type": "PROCENT_21",
"amount": "1200.0",
"amount_btw": "252.0",
"master_ledger_account": 4140,
}
],
"attachment": null
}
btw_shifted opties: ["NONE", "NON_EU", "EU"]
btw_type opties: ["PROCENT_9", "PROCENT_21", "PROCENT_0"]
Optionally, a PDF can be included as an attachment. This is in the form of a Base64 encoded string. More info.
Reverse Billing
In the case of Reverse Billing, the purchase invoice contains sales. A revenue account is then associated with the booking line, (8002: Sales 21%, 8001: Sales low/9% or 8000 Sales exempt from VAT).
Also, reverse_billing: true; must be included in the request body.
Example:
{
"admin_id": 3496,
"contact_id": 10689,
"payment_ref": 2021231,
"invoice_date": "2021-10-12",
"btw_shifted": "NONE",
"reverse_billing": true,
"journal_entry_lines": [
{
"description": "Boekregel 1",
"btw_type": "PROCENT_21",
"amount": "1000.0",
"amount_btw": "210.0",
"master_ledger_account": 8002,
}
]
}
DETAIL / UPDATE / PATCH / DELETE
Endpoint:
https://backend.thebookie.nl/nl/api/e1/purchase-journals/id/
To edit entry lines, the id of the entry line must be included. If you do not do this, a new book line will be added to the invoice. To delete a book line from the purchase invoice, "deleted": true must be added. The following example adds one line to the invoice and deletes one in a single call.
{
"journal_entry_lines": [
{
"id": 12312312,
"deleted": true
},
{
"description": "Boekregel 2",
"btw_type": "PROCENT_9",
"amount": "10.0",
"amount_btw": "0.90",
"master_ledger_account": 4140,
}
]
}
General ledger accounts
Lijst
Endpoint:
GET https://backend.thebookie.nl/nl/api/e1/ledger/?admin_id=admin_id
Url parameters:
- admin_id (verplicht)
- master_ledger_account (INT grootboekrekeing nummer)
DETAIL
GET https://backend.thebookie.nl/nl/api/e1/ledger/id/
Memorial
Lijst
Endpoint:
GET https://backend.thebookie.nl/nl/api/e1/general-journals/?admin_id=admin_id
Url parameters:
- admin_id (verplicht
DETAIL
GET https://backend.thebookie.nl/nl/api/e1/general-journals/id/
Was dit artikel nuttig?