This repository provides a collection of examples and tools for interacting with the Docloop Public API. It includes scripts for both API v1 and v2, using different tools like Bash and Hurl, along with a utility for testing webhooks.
├── resources/ # Sample documents for testing (PDFs)
├── tooling/ # Utility scripts (e.g., webhook listener)
├── v1/
│ └── bash/ # API v1 Bash examples
└── v2/
├── bash/ # API v2 Bash examples
└── hurl/ # API v2 Hurl test examples
To use these examples, you will need:
bashandcurlbase64(for document encoding)jq(optional, but highly recommended for parsing JSON responses)socat(optional, for the webhook listener tool)- Hurl (optional, for running Hurl tests)
API v2 simplifies authentication by using your API Key directly as a Bearer token.
- Navigate to
v2/bash/. - Copy
.env-distto.envand fill in yourAPI_KEY. - Run an extraction:
./create-extraction.sh <usecaseid> <documenttype> <filepath>
- Navigate to
v2/hurl/. - Copy
.env-distto.envand fill in yourAPI_KEY. - Run the extraction test:
./run-extraction.sh <usecaseid> <documenttype> <filepath>
API v1 requires an explicit authentication step to exchange an API Key for an access token.
- Navigate to
v1/bash/. - Edit
api-v1-example.shand replaceYOUR_API_KEYwith your actual key. - Run the script:
./api-v1-example.sh
If you need to test asynchronous extractions that send results to a webhook, you can use the provided listener:
- Navigate to
tooling/. - Start the listener:
./webhook-listener.sh 5555
- Use the public URL of this listener (e.g., via ngrok or a direct IP) as your
WEBHOOK_URLin your API requests.
The resources/ directory contains example documents you can use for testing:
example_invoice.pdf: A sample commercial invoice.example_transport_order.pdf: A sample road transport order.
For more detailed information, please refer to the README files in each subdirectory: