Receive Update Events
Polling Requests
Getting Started

Getting Started: Polling Requests

Endpoint Description

This endpoint allows you to poll for new event updates without relying on webhook notifications. You can periodically query the endpoint to retrieve any documents that have been updated since your last sync.

Request Example

GET {baseUrl}/api/v1/document/poll?last_synced_at=2024-06-01T01:00:00
Content-Type: application/json
Authorization: "Bearer {access_token}"

Request Parameters

KeyRequiredTypeDescription
last_synced_atNoStringThe timestamp of the last time events were synced or polled.

Success Response

The response contains an array of document objects. Each document in the array includes the following fields:

KeyDescription
document_idThe unique identifier of the document in CamInvoice.
updated_atThe timestamp when the document was last updated.
typeThe event type, indicating whether the document was "SEND" or "RECEIVE".

Note: Upon receiving a document_id, you can retrieve the XML version of the document via Download XML document.

Error Response

If the request fails, you may receive an error response like this:

HTTP Status Code: 401 Unauthorized

KeyDescription
errorThe error code indicating what went wrong.
error_descriptionDescribes the issue, such as "Invalid client credentials" if authentication fails.

Example Usage

You can use curl to poll for updated documents:

curl "{baseUrl}/api/v1/document/poll?last_synced_at=2024-06-01T01:00:00" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {access_token}"

This approach serves as an alternative to using webhooks for event notifications, allowing you to periodically check for updates on your own schedule.