e-copedia hjælpecenter

Documents API — Developer Guide

Sidst opdateret:
Skrevet af Charles J

Overview

The Documents API lets you upload, retrieve, and manage PDF and image documents attached to accounting vouchers in e-conomic. It is the recommended integration point for any workflow that involves programmatically handling supplier invoices, receipts, or other accounting documents.

Uploading a Document

Documents are uploaded as multipart/form-data. The API supports PDF, JPG, and PNG file types.

Example Request

POST /documentsapi/{version}/AttachedDocuments

Response

A successful upload returns 201 Created with the assigned document number in the body:

{ "number": 555807902 }

The Location response header will point to the newly created document resource, for example:

Location:
https://apis.e-conomic.com/documentsapi/{version}/AttachedDocuments/555807902

You can use this number to retrieve or delete the document later.

Retrieving a Single Document

GET /documentsapi/{version}/AttachedDocuments/{number}

To download the raw PDF:

GET /documentsapi/{version}/AttachedDocuments/{number}/pdf

Retrieving Documents Not Yet Attached

Documents that have been uploaded to the inbox but not yet attached to any voucher will have no voucherNumber assigned. You can retrieve all such documents by filtering for a null voucherNumber on the GET /AttachedDocuments endpoint:

GET /documentsapi/{version}/AttachedDocuments?filter=voucherNumber$eq:$null:

This returns all document numbers in the inbox that are not yet linked to a voucher.

Once you have the document numbers, you can download each document's PDF

individually:

GET /documentsapi/{version}/AttachedDocuments/{number}/pdf

Deleting a Document

DELETE /documentsapi/{version}/AttachedDocuments/{number}

For bulk deletion, use the /deletebulk endpoint and pass a list of document numbers in the request body.

Notes and Known Constraints

  • Voucher lookups are scoped by accountingYear and voucherNumber. Journal number is not part of the key, so two vouchers with the same number in different journals within the same accounting year are treated as the same voucher from the document attachment perspective.

  • Upload requests can take significant time to process, particularly for larger files. There is a hard timeout of 5 minutes on upload requests. If you are uploading many documents concurrently, consider limiting parallelism to avoid timeouts.

  • Document retrieval does not include retrieval of sales documents (quotes, orders, invoices, reminders). These documents must be retrieved via their own separate endpoints currently available only via RESTAPI.

  • Documents can only be attached to existing voucherNumbers.

Var denne artikel nyttig?