import requests
import json
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
url = 'https://api.va.landing.ai/v1/ade/parse/jobs'
# Set the model (optional)
data = {
'model': 'dpt-2-latest'
}
# Upload a document
document = open('document.pdf', 'rb')
files = {'document': document}
response = requests.post(url, files=files, data=data, headers=headers)
print(response.json())curl -X POST 'https://api.va.landing.ai/v1/ade/parse/jobs' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'document=@document.pdf' \
-F 'model=dpt-2-latest' # Set the model (optional)const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('document', fs.createReadStream('document.pdf'));
// Set the model (optional)
form.append('model', 'dpt-2-latest');
axios.post('https://api.va.landing.ai/v1/ade/parse/jobs', form, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
...form.getHeaders()
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));{
"job_id": "12345678-1234-1234-1234-123456789012"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}ADE Parse Jobs
Parse documents asynchronously.
This endpoint creates a job that handles the processing for both large documents and large batches of documents.
For EU users, use this endpoint:
https://api.va.eu-west-1.landing.ai/v1/ade/parse/jobs.
import requests
import json
headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}
url = 'https://api.va.landing.ai/v1/ade/parse/jobs'
# Set the model (optional)
data = {
'model': 'dpt-2-latest'
}
# Upload a document
document = open('document.pdf', 'rb')
files = {'document': document}
response = requests.post(url, files=files, data=data, headers=headers)
print(response.json())curl -X POST 'https://api.va.landing.ai/v1/ade/parse/jobs' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'document=@document.pdf' \
-F 'model=dpt-2-latest' # Set the model (optional)const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('document', fs.createReadStream('document.pdf'));
// Set the model (optional)
form.append('model', 'dpt-2-latest');
axios.post('https://api.va.landing.ai/v1/ade/parse/jobs', form, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
...form.getHeaders()
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));{
"job_id": "12345678-1234-1234-1234-123456789012"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Your unique API key for authentication.
Get your API key here: https://va.landing.ai/settings/api-key.
If using the EU endpoint, get your API key here: https://va.eu-west-1.landing.ai/settings/api-key.
Body
A file to be parsed. The file can be a PDF or an image. See the list of supported file types here: https://docs.landing.ai/ade/ade-file-types. Either this parameter or the document_url parameter must be provided.
The URL to the file to be parsed. The file can be a PDF or an image. See the list of supported file types here: https://docs.landing.ai/ade/ade-file-types. Either this parameter or the document parameter must be provided.
Was this page helpful?