Quick start
To get started working with the API, you will first need to grab the API key.
After that we can make requests to any API endpoint (given that you pass in the correct parameters).
In this guide, I will show you how to authenticate and analyze a PDF document.
Step 1: Grabbing the API Key
PdfDodo uses a API keys to allow you to access the API. You can get your API key by going to the “Settings” section.
After retrieving your API key, you can pass the token to the API in the HTTP Authorization Header using X-API-KEY
.
X-API-KEY: <apikey>
Step 2: Upload the document
The next step after we have successfully grabbed our API key, we can upload our document and then call the analyze endpoint to get the data.
Make sure to add X-API-KEY
in the Authorization Header.
To upload our PDF file, we can do this in curl
as follows:
curl -X POST \
-H "Content-Type: multipart/form-data" \
-H "x-api-key: YOUR_API_KEY" \
-F "file=@/path/to/your/file.pdf" \
https://https://app.pdfdodo.com/api/uploadfile
The response will be a JSON result. For example:
{
"documentId": "123e4567-e89b-12d3-a456-426614174000",
"documentName": "your-test-file.pdf"
}
Keep note of the documentId
.
Step 3: Analyze the document
The last step is to do a GET
request to the analyze endpoint, /api/analyze
, to get the document data.
For example, lets say our document id is 123e4567-e89b-12d3-a456-426614174000
, we can do the following curl
command to analyze and get the document data:
curl -X GET \
-H "x-api-key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
"https://app.pdfdodo.com/api/analyze?documentid=123e4567-e89b-12d3-a456-426614174000"
This will give you a JSON response of the data in your PDF:
{
"tables": [
{
"title": "The title of your table",
"tableId": "a0f229f6-ade7-4637-bbff-e31fbbd64ec5",
"pageNumber": 1,
"rows": [
[
"0",
"Money In ",
"$1,880.00 "
],
[
"1",
"Money Out ",
"$150.25 "
],
[
"2",
"You Received ",
"$1,729.75 "
]
],
"left": 0.6953286,
"top": 0.2655254,
"width": 0.2580709,
"height": 0.11655326,
"mergedTables": []
}
]
}
Success!
In this quick start guide, we went over on how to get your API Key to authenticate, upload our PDF and finally extracting the data from the PDF file.