### Get Ledger Example (JSON) Source: https://api.e-boekhouden.nl/swagger/v1/swagger Provides an example of a successful response when retrieving ledger information. This includes the ledger's ID, code, description, category, and group. ```JSON {"code":"E123","description":"This serves as an example.","category":"BAL","group":"01234"} ``` -------------------------------- ### Session Response Example Source: https://api.e-boekhouden.nl/swagger/v1/swagger Example of a successful response when starting a session, containing the session token and its expiry time. ```json { "token": "SESSION_TOKEN_HERE", "expiresIn": 3600 } ``` -------------------------------- ### E-Boekhouden API: Get Ledgers Example Source: https://api.e-boekhouden.nl/swagger/v1/swagger Provides an example of how a successful response for retrieving ledgers might look, including item details and a count. ```json { "items": [ { "id": 1, "code": "7000", "description": "Inkopen" } ], "count": 1 } ``` -------------------------------- ### Invoice Creation Example Source: https://api.e-boekhouden.nl/swagger/v1/swagger Provides an example JSON payload for creating an invoice, including invoice details and an array of invoice items with their respective properties. ```json { "id":1000, "invoiceNumber":"F00001", "relationId":1500, "date":"2025-09-14", "reference":"Reference", "termOfPayment":14, "inExVat":"EX", "templateId":2100, "emailTemplateId":1100, "totalExcl":121.00, "totalAmount":131.89, "vatAmount":10.89, "urlPdfFile": "", "items":[ { "quantity":2.0, "amount":2.0, "unitId":1, "code":"PRD001", "productId":101, "description":"Product A", "pricePerUnit":50.00, "vatCode":"HOOG_VERK_21", "vatAmount":10.50, "ledgerId":3001, "costCenterId":4001, "discountAmount":5.00 } ] } ``` -------------------------------- ### Not Found Response Example (404) Source: https://api.e-boekhouden.nl/swagger/v1/swagger An example of a response when a requested cost center is not found. Similar to the bad request response, it provides detailed error information. ```json { "errors": { "object.field": [ "Field is missing." ] }, "type": "validation", "propertyName": "object.field", "code": "EXAMPLE_001", "title": "Field is missing.", "message": "Extended error information.", "status": 400, "traceId": "ABCDEF-123456." } ``` -------------------------------- ### Create Cost Center API Request Example Source: https://api.e-boekhouden.nl/swagger/v1/swagger Provides an example of a request to create a new cost center. It includes the necessary fields like description, parent ID, and active status. Error codes related to cost center creation are also referenced. ```json { "description": "Buy", "parentId": 12, "active": true } ``` -------------------------------- ### Bad Request Response Example - POST /v1/session Source: https://api.e-boekhouden.nl/swagger/v1/swagger Illustrates a 'Bad Request' response for the session start endpoint, detailing validation errors. ```json { "errors": { "object.field": [ "Field is missing." ] }, "type": "validation", "propertyName": "object.field", "code": "EXAMPLE_001", "title": "Field is missing.", "message": "Extended error information.", "status": 400, "traceId": "ABCDEF-123456." } ``` -------------------------------- ### Mutation Example and Error Response Source: https://api.e-boekhouden.nl/swagger/v1/swagger Demonstrates a successful mutation example with an ID, type, date, ledger ID, and invoice details. Also shows a 404 Not Found error response structure, including error details, type, property name, code, title, message, status, and trace ID. ```json { "description": "VAT totals for this mutation per VAT code" } } } }, "description": "VAT totals for this mutation per VAT code" } } }, "example": {"id":12,"type":2,"date":"0001-01-01","ledgerId":1,"inExVat":"IN","invoiceNumber":"INV-001","entryNumber":"VOU-001"} } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" }, "example": {"errors":{"object.field":["Field is missing."]},"type":"validation","propertyName":"object.field","code":"EXAMPLE_001","title":"Field is missing.","message":"Extended error information.","status":400,"traceId":"ABCDEF-123456.")} } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [ "EB.WebAPI.Core.Attributes.EbAuthAttribute" ] } ] } }, "/v1/mutation/invoice/outstanding": { "get": { "tags": [ "Mutation" ], "description": "Get all outstanding invoices.", "operationId": "GetOutstandingInvoices", "parameters": [ { "name": "limit", "in": "query", "description": "The number of items to retrieve.", "schema": { "maximum": 2000, "minimum": 1, "type": "integer", "format": "int32" } }, { "name": "offset", "in": "query", "description": "The number of items to skip.", "schema": { "minimum": 0, "type": "integer", "format": "int32" } }, { "name": "credDeb", "in": "query", "description": "Retrieve creditors (`C`) or debtors (`D`).", "required": true, "schema": { "maxLength": 1, "type": "string", "format": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "title": "OutstandingInvoicesList", "properties": { "items": { "type": "array", "items": { "title": "OutstandingInvoiceListItem", "properties": { "date": { "type": "object", "description": "Invoice date.", "format": "date" }, "mutationId": { "type": "integer", "description": "The ID of the invoice mutation.", "format": "int32" }, "invoiceNumber": { "type": "string", "description": "The invoice number. To keep your code ready for future API versions it is recommended to use `mutationId` instead.", "format": "string", "deprecated": true }, "relationId": { "type": "integer", "description": "The ID of the relation.", "format": "int32" }, "relationCode": { "type": "string", "description": "The code of the relation. To keep your code ready for future API versions it is recommended to use `relationId` instead.", "format": "string", "deprecated": true }, "company": { "type": "string", "description": "Company name.", "format": "string" }, "totalAmount": { "type": "number", "description": "The invoice amount, including VAT." }, "paidAmount": { ``` -------------------------------- ### Integer Filtering Examples Source: https://api.e-boekhouden.nl/swagger/index Provides examples of filtering for integer parameters (int32, int64). Supports equality, inequality, greater/less than comparisons, and range queries. ```http ?parameter=5 ``` ```http ?parameter[not_eq]=5 ``` ```http ?parameter[gt]=5 ``` ```http ?parameter[gte]=5 ``` ```http ?parameter[lt]=5 ``` ```http ?parameter[lte]=5 ``` ```http ?parameter[range]=5,10 ``` -------------------------------- ### Get Administrations - GET /v1/administration Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves a list of all administrations managed by the authenticated user. Supports pagination via `limit` and `offset` query parameters. ```text GET /v1/administration?limit=100&offset=0 ``` -------------------------------- ### Get Products API Definition Source: https://api.e-boekhouden.nl/swagger/v1/swagger Defines the GET endpoint for retrieving product information. It allows filtering by product code and pagination using limit and offset parameters. The response includes details such as product ID, code, description, pricing, and VAT information. ```json { "get": { "tags": [ "Product" ], "description": "Get all products.", "operationId": "GetProducts", "parameters": [ { "name": "limit", "in": "query", "description": "The number of items to retrieve.", "schema": { "maximum": 2000, "minimum": 1, "type": "integer", "format": "int32" } }, { "name": "offset", "in": "query", "description": "The number of items to skip.", "schema": { "minimum": 0, "type": "integer", "format": "int32" } }, { "name": "code", "in": "query", "description": "The code of the product.", "schema": { "type": "string", "format": "filter-string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "title": "ProductList", "properties": { "items": { "type": "array", "items": { "title": "ProductListItem", "properties": { "id": { "type": "integer", "description": "The ID of the product.", "format": "int32" }, "code": { "type": "string", "description": "The code of the product.", "format": "string" }, "description": { "type": "string", "description": "The description of the product.", "format": "string" }, "unitId": { "type": "integer", "description": "The unit ID of the product.", "format": "int32" }, "active": { "type": "boolean", "description": "Whether the product is active." }, "groupId": { "type": "integer", "description": "The group ID of the product.", "format": "int32" }, "purchasePriceExcl": { "type": "number", "description": "The purchase price (excluding VAT) of the product." }, "priceExcl": { "type": "number", "description": "The price (excluding VAT) of the product." }, "priceIncl": { "type": "number", "description": "The price (including VAT) of the product." }, "vat": { "type": "string", "description": "The VAT code of the product.", "format": "string" }, "ledgerId": { "type": "integer", "description": "The ledger ID of the product." } } } } } } } } } } } } ``` -------------------------------- ### Get Products Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves a list of all products. Supports filtering by product code and pagination using limit and offset. ```APIDOC ## GET /v1/product ### Description Retrieves a list of all products. Supports filtering by product code and pagination. ### Method GET ### Endpoint /v1/product ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of items to retrieve (max 2000). - **offset** (integer) - Optional - The number of items to skip. - **code** (string) - Optional - The code of the product to filter by. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **items** (array) - List of product items. - **id** (integer) - The ID of the product. - **code** (string) - The code of the product. - **description** (string) - The description of the product. - **unitId** (integer) - The unit ID of the product. - **active** (boolean) - Indicates if the product is active. - **groupId** (integer) - The group ID of the product. - **purchasePriceExcl** (number) - The purchase price excluding VAT. - **priceExcl** (number) - The price excluding VAT. - **priceIncl** (number) - The price including VAT. - **vat** (string) - The VAT code for the product. - **ledgerId** (integer) - The ledger ID associated with the product. #### Response Example ```json { "items": [ { "id": 1, "code": "PROD001", "description": "Example Product", "unitId": 1, "active": true, "groupId": 1, "purchasePriceExcl": 50.00, "priceExcl": 75.00, "priceIncl": 90.75, "vat": "21%", "ledgerId": 1001 } ] } ``` ``` -------------------------------- ### Mutation Request Example (JSON) Source: https://api.e-boekhouden.nl/swagger/v1/swagger An example JSON payload for creating a mutation. It includes details like ledger ID, dates, invoice information, and an array of rows, each with its own ledger ID, VAT code, and amount. The 'inExVat' field indicates whether the amount includes VAT. ```json { "type": 2, "date": "2025-09-14", "ledgerId": 10111230, "invoiceNumber": "INV-001", "entryNumber": "VOU-001", "termOfPayment": 14, "inExVat": "IN", "description": "Example description", "relationId": 1, "rows": [ { "ledgerId": 2, "vatCode": "LAAG_VERK_9", "amount": 12.20 }, { "ledgerId": 3, "vatCode": "LAAG_VERK_9", "amount": 14.40 } ] } ``` -------------------------------- ### GET /v1/product/{id} Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves a specific product by its ID. Provides details such as code, description, pricing, and associated IDs. ```APIDOC ## GET /v1/product/{id} ### Description Retrieves a specific product by its ID. This endpoint returns detailed information about a product, including its code, description, pricing, and relevant IDs like unit, group, ledger, and cost center. ### Method GET ### Endpoint /v1/product/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the product. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **id** (integer) - The ID of the product. - **code** (string) - The code of the product. - **description** (string) - The description of the product. - **unitId** (integer) - The unit ID of the product. - **active** (boolean) - Whether the product is active. - **groupId** (integer) - The group ID of the product. - **purchasePriceExcl** (number) - The purchase price (excluding VAT) of the product. - **priceExcl** (number) - The price (excluding VAT) of the product. - **priceIncl** (number) - The price (including VAT) of the product. - **vat** (string) - The VAT code of the product. - **ledgerId** (integer) - The ledger ID of the product. - **costCenterId** (integer) - The cost center ID of the product. #### Response Example ```json { "id": 1, "code": "Fiets001", "description": "Fiets", "unitId": 1, "active": true, "groupId": 1, "purchasePriceExcl": 100.00, "priceExcl": 150.00, "priceIncl": 150.00, "vat": "VERK_HOOG", "ledgerId": 1, "costCenterId": 1 } ``` #### Error Response (400) - **errors** (object) - Contains validation errors for the request. - **type** (string) - The type of error. - **propertyName** (string) - The name of the property that caused the error. - **code** (string) - An error code. - **title** (string) - A short description of the error. - **message** (string) - Extended error information. - **status** (integer) - The HTTP status code. - **traceId** (string) - A unique identifier for the request trace. #### Error Response Example (400) ```json { "errors": { "object.field": [ "Field is missing." ] }, "type": "validation", "propertyName": "object.field", "code": "EXAMPLE_001", "title": "Field is missing.", "message": "Extended error information.", "status": 400, "traceId": "ABCDEF-123456." } ``` #### Error Response (401) - Description: Unauthorized. The request lacks valid authentication credentials. ``` -------------------------------- ### Create Invoice Request Example Source: https://api.e-boekhouden.nl/swagger/v1/swagger This example demonstrates the JSON payload structure for creating a new invoice. It includes details such as invoice number, relation ID, dates, payment terms, and itemized entries. It also shows optional fields for email and direct debit. ```json { "invoiceNumber": "F00001", "relationId": 1500, "date": "2025-09-14", "termOfPayment": 14, "inExVat": "EX", "templateId": 2100, "emailTemplateId": 1700, "reference": "Reference", "print": false, "email": { "fromEmail": "", "fromName": "", "subject": "", "body": "", "attachUbl": false, "invoiceUbl": false }, "directDebit": { "directDebit": false, "iban": "", "mandateType": "", "mandateId": "", "mandateSignedDate": "2025-09-14", "name": "", "city": "", "descriptionLine1": "", "descriptionLine2": "", "descriptionLine3": "" }, "mutation": { "description": "", "checkPaymentReference": true, "paymentReference": "REF00123", "ledgerId": 1100 }, "invoiceEntry": { "description": "", "checkPaymentReference": true, "paymentReference": "REF00123", "ledgerId": 1100 }, "items": [ { "quantity": 0.0, "amount": 0.0, "unitId": 0, "code": "", "productId": 0, "description": "", "pricePerUnit": 0.00, "vatCode": "HOOG_VERK_21", "ledgerId": 0, "costCenterId": 0, "discountAmount": 0.00, "discountPercentage": 0.0 } ] } ``` -------------------------------- ### GET /v1/administration Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves a list of all administrations managed by the authenticated user. ```APIDOC ## GET /v1/administration ### Description Get all administrations managed by the authorized accountant. ### Method GET ### Endpoint /v1/administration ### Parameters #### Query Parameters - **limit** (integer) - Optional - The number of items to retrieve. (minimum: 1, maximum: 2000) - **offset** (integer) - Optional - The number of items to skip. (minimum: 0) ### Response #### Success Response (200) - The response contains a list of administrations, where each administration object has the following properties: - **id** (string) - The unique identifier for the administration. - **name** (string) - The name of the administration. - **type** (string) - The type of the administration. #### Response Example ```json { "administrations": [ { "id": "admin-123", "name": "Example Company", "type": "Company" } ] } ``` ``` -------------------------------- ### POST /v1/session Source: https://api.e-boekhouden.nl/swagger/v1/swagger Starts a new session with the e-Boekhouden API. The returned session token can be used for subsequent authenticated requests. ```APIDOC ## POST /v1/session ### Description Starts a new session. The response session token can be used as the `Authorization` header. ### Method POST ### Endpoint /v1/session ### Parameters #### Request Body - **accessToken** (string) - Required - Your secret API-token. - **source** (string) - Required - Code to identify your integration. (maxLength: 10, pattern: ^[\w_ ]{1,10}$) - Error codes for source: - API_SESSION_001: Source is missing. - API_SESSION_002: Source does not match pattern. ### Request Example ```json { "accessToken": "YOUR_API_TOKEN", "source": "MyIntegration" } ``` ### Response #### Success Response (200) - **token** (string) - Your session token. Add this as the "Authorization" header to your requests. - **expiresIn** (integer) - The number of seconds until the token expires. #### Response Example ```json { "token": "YOUR_SESSION_TOKEN", "expiresIn": 3600 } ``` #### Error Response (400) - **errors** (object) - Details about validation errors. - **type** (string) - Type of the error. - **propertyName** (string) - The name of the property that caused the error. - **code** (string) - Error code. - **title** (string) - A short description of the error. - **message** (string) - Extended error information. - **status** (integer) - HTTP status code. - **traceId** (string) - Unique identifier for the request trace. #### Error Response Example (400) ```json { "errors": { "accessToken": [ "Field is missing." ] }, "type": "validation", "propertyName": "accessToken", "code": "EXAMPLE_001", "title": "Field is missing.", "message": "Extended error information.", "status": 400, "traceId": "ABCDEF-123456." } ``` #### Error Response (403) - Schema reference to SecurityError. ``` -------------------------------- ### GET /v1/emailtemplate Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves a list of all available email templates. Supports pagination with limit and offset parameters. ```APIDOC ## GET /v1/emailtemplate ### Description Get all email templates. ### Method GET ### Endpoint /v1/emailtemplate ### Parameters #### Query Parameters - **limit** (integer) - Optional - The number of items to retrieve. - **offset** (integer) - Optional - The number of items to skip. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **items** (array) - A list of email templates, each with id, name, useInvoice, useQuote, and useMailing. - **count** (integer) - The number of retrieved items. #### Response Example ```json { "items": [ { "id": 1, "name": "EmailSjabloon", "useInvoice": true, "useQuote": false, "useMailing": false } ], "count": 1 } ``` #### Error Response (400) - **errors** (object) - Contains validation errors. - **type** (string) - The type of the error. - **propertyName** (string) - The name of the property that caused the error. - **code** (string) - An error code. - **title** (string) - A short description of the error. - **message** (string) - A more detailed error message. - **status** (integer) - The HTTP status code. - **traceId** (string) - A unique identifier for the request trace. #### Error Response Example (400) ```json { "errors": { "object.field": [ "Field is missing." ] }, "type": "validation", "propertyName": "object.field", "code": "EXAMPLE_001", "title": "Field is missing.", "message": "Extended error information.", "status": 400, "traceId": "ABCDEF-123456." } ``` #### Error Response (401) - **description** (string) - Unauthorized #### Error Response Example (401) ```json { "description": "Unauthorized" } ``` ``` -------------------------------- ### GET /v1/costcenter Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves a list of all cost centers. Supports filtering by parent ID and description, and pagination using limit and offset. ```APIDOC ## GET /v1/costcenter ### Description Get all cost centers. ### Method GET ### Endpoint /v1/costcenter ### Parameters #### Query Parameters - **limit** (integer) - Optional - The number of items to retrieve (max 2000, min 1). - **offset** (integer) - Optional - The number of items to skip (min 0). - **parentId** (string) - Optional - The parent ID of the cost center. - **description** (string) - Optional - The description of the cost center. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **items** (array) - An array of cost center objects. - **id** (integer) - The ID of the cost center. - **description** (string) - The description of the cost center. - **parentId** (integer) - The parent ID of the cost center. - **active** (boolean) - Whether the cost center is active. - **count** (integer) - The number of retrieved items. #### Response Example ```json { "items": [ { "id": 1, "description": "Buy", "parentId": 12, "active": true } ], "count": 1 } ``` ``` -------------------------------- ### Start Session - POST /v1/session Source: https://api.e-boekhouden.nl/swagger/v1/swagger Initiates a new user session. Requires an access token and a source identifier. The response provides a session token valid for a specified duration, to be used in subsequent requests. ```json { "accessToken": "YOUR_SECRET_API_TOKEN", "source": "YOUR_INTEGRATION_CODE" } ``` -------------------------------- ### GET /v1/ledger/{id}/balance Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves the balance for a specific ledger, with optional filters for cost center, start date, and end date. ```APIDOC ## GET /v1/ledger/{id}/balance ### Description Get the balance on the given ledger with optional filters. ### Method GET ### Endpoint /v1/ledger/{id}/balance ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the ledger. #### Query Parameters - **costCenterId** (integer) - Optional - The ID of the cost center. - **from** (string, format: date) - Optional - Show the balance starting from this date. When provided, the resulting balance is the difference over the period, rather than the actual balance. - **to** (string, format: date) - Optional - Shows the active balance at this date. This date is inclusive. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **code** (string) - The code of the ledger. - **type** (string) - The type of the ledger. - **balance** (number) - The balance based on the sum of all mutations on the ledger. #### Response Example ```json { "example": {"code":"1001","type":"DEB","balance":500.00} } ``` #### Error Response (400) - **errors** (object) - Contains a map of field errors. - **type** (string) - The type of error. - **propertyName** (string) - The name of the property that caused the error. - **code** (string) - The error code. - **title** (string) - A short description of the error. - **message** (string) - Extended error information. - **status** (integer) - The HTTP status code. - **traceId** (string) - A unique identifier for the request trace. #### Error Response Example (400) ```json { "example": {"errors":{"object.field":["Field is missing."]},"type":"validation","propertyName":"object.field","code":"EXAMPLE_001","title":"Field is missing.","message":"Extended error information.","status":400,"traceId":"ABCDEF-123456."} } ``` ``` -------------------------------- ### Get Linked Administrations Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves a list of administrations linked to the authorized user's administration. Supports pagination with limit and offset parameters. Returns an array of administration items, each with a GUID and company name, along with the total count. ```json { "tags": [ "Administration" ], "description": "Get all administrations that are linked to the authorized administration.
Please note that this endpoint will always return administrations linked to the administration of the user that created the API credentials.", "operationId": "GetLinkedAdministrations", "parameters": [ { "name": "limit", "in": "query", "description": "The number of items to retrieve.", "schema": { "maximum": 2000, "minimum": 1, "type": "integer", "format": "int32" } }, { "name": "offset", "in": "query", "description": "The number of items to skip.", "schema": { "minimum": 0, "type": "integer", "format": "int32" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "title": "AdministrationList", "properties": { "items": { "type": "array", "items": { "title": "AdministrationListItem", "properties": { "guid": { "type": "object", "description": "The unique identifier of the administration." }, "company": { "type": "string", "description": "The company name of the administration.", "format": "string" } } } }, "count": { "type": "integer", "description": "The number of retrieved items.", "format": "int32" } } }, "example": {"items":[{"guid":"00000000-0000-0000-0000-000000000000","company":"Company Name"}],"count":1} } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" }, "example": {"errors":{"object.field":["Field is missing."]},"type":"validation","propertyName":"object.field","code":"EXAMPLE_001","title":"Field is missing.","message":"Extended error information.","status":400,"traceId":"ABCDEF-123456.")} } } }, "401": { "description": "Unauthorized" } }, "security": [ { "bearer": [ "EB.WebAPI.Core.Attributes.EbAuthAttribute" ] } ] } ``` -------------------------------- ### Get Ledger Balance with Filters - Python Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves the balance of a ledger by its ID, with optional filters for cost center, start date, and end date. The balance represents the sum of all mutations on the ledger within the specified period or up to a given date. Requires authentication via bearer token. ```python import requests from datetime import date BASE_URL = "https://api.e-boekhouden.nl/v1" def get_ledger_balance(auth_token, ledger_id, cost_center_id=None, from_date=None, to_date=None): """ Retrieves the balance of a ledger with optional filters. Args: auth_token (str): The bearer token for authentication. ledger_id (int): The ID of the ledger. cost_center_id (int, optional): The ID of the cost center. from_date (date, optional): The start date for the balance calculation. to_date (date, optional): The end date for the balance calculation. Returns: dict: A dictionary representing the ledger balance, or None if an error occurs. """ url = f"{BASE_URL}/v1/ledger/{ledger_id}/balance" headers = { "Authorization": f"Bearer {auth_token}" } params = {} if cost_center_id: params['costCenterId'] = cost_center_id if from_date: params['from'] = from_date.isoformat() if to_date: params['to'] = to_date.isoformat() try: response = requests.get(url, headers=headers, params=params) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) return response.json() except requests.exceptions.RequestException as e: print(f"Error retrieving ledger balance: {e}") return None if __name__ == "__main__": token = "YOUR_AUTH_TOKEN" # Replace with your actual token ledger_id_to_fetch = 123 cost_center_filter = 45 start_date = date(2023, 1, 1) end_date = date.today() balance_data = get_ledger_balance(token, ledger_id_to_fetch, cost_center_id=cost_center_filter, from_date=start_date, to_date=end_date) if balance_data: print(f"Ledger Balance: {balance_data}") # Access fields like: balance_data['code'], balance_data['type'], balance_data['balance'] else: print("Failed to get ledger balance.") ``` -------------------------------- ### Get Ledger Balance with Filters - Java Source: https://api.e-boekhouden.nl/swagger/v1/swagger Retrieves the balance of a ledger by its ID, with optional filters for cost center, start date, and end date. The balance represents the sum of all mutations on the ledger within the specified period or up to a given date. Requires authentication via bearer token. ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.LocalDate; public class LedgerBalanceClient { private static final String BASE_URL = "https://api.e-boekhouden.nl/v1"; private final HttpClient httpClient; private final String authToken; public LedgerBalanceClient(String authToken) { this.httpClient = HttpClient.newHttpClient(); this.authToken = authToken; } public String getLedgerBalance(int ledgerId, Integer costCenterId, LocalDate fromDate, LocalDate toDate) { StringBuilder urlBuilder = new StringBuilder(BASE_URL + "/v1/ledger/" + ledgerId + "/balance?"); if (costCenterId != null) { urlBuilder.append("costCenterId=").append(costCenterId).append("&"); } if (fromDate != null) { urlBuilder.append("from=").append(fromDate.toString()).append("&"); } if (toDate != null) { urlBuilder.append("to=").append(toDate.toString()).append("&"); } // Remove trailing '&' if present if (urlBuilder.charAt(urlBuilder.length() - 1) == '&') { urlBuilder.deleteCharAt(urlBuilder.length() - 1); } HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(urlBuilder.toString())) .header("Authorization", "Bearer " + authToken) .GET() .build(); try { HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); // Handle response based on status code if (response.statusCode() == 200) { return response.body(); // JSON string of LedgerBalance } else { // Handle errors (e.g., 404 Not Found, 401 Unauthorized) System.err.println("Error retrieving ledger balance: " + response.statusCode() + " - " + response.body()); return null; } } catch (Exception e) { e.printStackTrace(); return null; } } public static void main(String[] args) { String token = "YOUR_AUTH_TOKEN"; // Replace with your actual token LedgerBalanceClient client = new LedgerBalanceClient(token); // Example usage: int ledgerId = 123; Integer costCenter = 45; LocalDate from = LocalDate.of(2023, 1, 1); LocalDate to = LocalDate.now(); String balanceJson = client.getLedgerBalance(ledgerId, costCenter, from, to); if (balanceJson != null) { System.out.println("Ledger Balance: " + balanceJson); // Parse the JSON to access code, type, and balance fields } else { System.out.println("Failed to get ledger balance."); } } } ``` -------------------------------- ### Product API Source: https://api.e-boekhouden.nl/swagger/index Endpoints for retrieving product information. ```APIDOC ## GET /v1/product ### Description Retrieves a list of products. ### Method GET ### Endpoint /v1/product ### Response (No specific response details provided in the source text) ``` ```APIDOC ## GET /v1/product/{id} ### Description Retrieves a specific product by its ID. ### Method GET ### Endpoint /v1/product/{id} #### Path Parameters - **id** (string) - Required - The unique identifier of the product. ``` -------------------------------- ### E-Boekhouden API: Create Ledger Request Example Source: https://api.e-boekhouden.nl/swagger/v1/swagger Demonstrates the expected JSON payload for creating a new ledger entry, including mandatory fields like code and description, and optional fields like category and group. ```json { "code": "E123", "description": "This serves as an example.", "category": "BAL", "group": "01234" } ``` -------------------------------- ### Bad Request Response Example Source: https://api.e-boekhouden.nl/swagger/v1/swagger This example demonstrates a 'Bad Request' response (HTTP 400). It typically indicates validation errors, providing details about the specific fields that are missing or invalid. ```json { "errors": { "object.field": [ "Field is missing." ] }, "type": "validation", "propertyName": "object.field", "code": "EXAMPLE_001", "title": "Field is missing.", "message": "Extended error information.", "status": 400, "traceId": "ABCDEF-123456." } ``` -------------------------------- ### POST /api/v1/ledger Source: https://api.e-boekhouden.nl/swagger/v1/swagger Creates a new ledger with the provided details. ```APIDOC ## POST /api/v1/ledger ### Description Creates a new ledger entry in the system. ### Method POST ### Endpoint /api/v1/ledger ### Parameters #### Request Body - **code** (string) - Required - The code for the new ledger. Max length: 50. Error codes: LEDG_001 (missing), LEDG_002 (too long). - **description** (string) - Required - The description for the new ledger. Max length: 100. Error codes: LEDG_003 (missing), LEDG_004 (too long). - **category** (string) - Optional - The category of the ledger (e.g., "BAL"). - **group** (string) - Optional - The group the ledger belongs to. Max length: 50. Error codes: LEDG_007 (missing). ### Request Example ```json { "code": "E123", "description": "This serves as an example.", "category": "BAL", "group": "01234" } ``` ### Response #### Success Response (201) - **id** (integer) - The ID of the newly created ledger. #### Response Example ```json { "id": 123 } ``` #### Error Response (400) - **errors** (object) - Contains details about the validation errors. - **type** (string) - The type of error. - **propertyName** (string) - The name of the field with the error. - **code** (string) - The error code. - **title** (string) - A short title for the error. - **message** (string) - A detailed error message. - **status** (integer) - The HTTP status code. - **traceId** (string) - A unique identifier for the request trace. #### Error Response Example ```json { "errors": { "object.field": [ "Field is missing." ] }, "type": "validation", "propertyName": "object.field", "code": "EXAMPLE_001", "title": "Field is missing.", "message": "Extended error information.", "status": 400, "traceId": "ABCDEF-123456." } ``` ```