const options = {
method: 'GET',
headers: {
'x-api-key': '<your-api-key>',
'Content-Type': 'application/json',
},
};
fetch('https://api.getomni.ai/jobs?status=COMPLETE&page=1&size=10', options)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
{
"jobs": [
{
"jobId": "123e4567-e89b-12d3-a456-426614174001",
"completedAt": "2023-09-10T15:30:45.123Z",
"createdAt": "2023-09-10T15:29:45.123Z",
"requestBody": {
"documentUrl": "https://example.com/document.pdf"
},
"responseBody": {
"ocr": {
"pages": [],
}
"extracted": {
"name": "John Doe",
"amount": "1500"
}
},
"status": "COMPLETE",
"statusUpdatedAt": "2023-09-10T15:30:45.123Z",
"extractId": "123e4567-e89b-12d3-a456-426614174002",
"pagesProcessed": 2
}
],
"pagination": {
"currentPage": 1,
"pageSize": 10,
"totalCount": 42,
"totalPages": 5,
"nextPage": 2,
"previousPage": null
}
}
Retrieve a list of jobs with filtering and pagination
const options = {
method: 'GET',
headers: {
'x-api-key': '<your-api-key>',
'Content-Type': 'application/json',
},
};
fetch('https://api.getomni.ai/jobs?status=COMPLETE&page=1&size=10', options)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
{
"jobs": [
{
"jobId": "123e4567-e89b-12d3-a456-426614174001",
"completedAt": "2023-09-10T15:30:45.123Z",
"createdAt": "2023-09-10T15:29:45.123Z",
"requestBody": {
"documentUrl": "https://example.com/document.pdf"
},
"responseBody": {
"ocr": {
"pages": [],
}
"extracted": {
"name": "John Doe",
"amount": "1500"
}
},
"status": "COMPLETE",
"statusUpdatedAt": "2023-09-10T15:30:45.123Z",
"extractId": "123e4567-e89b-12d3-a456-426614174002",
"pagesProcessed": 2
}
],
"pagination": {
"currentPage": 1,
"pageSize": 10,
"totalCount": 42,
"totalPages": 5,
"nextPage": 2,
"previousPage": null
}
}
IN_PROGRESS
,
COMPLETE
, CANCELLED
, ERROR
, PAUSED
, PENDING
, RETRY
APPROVED
,
REJECTED
, PENDING
, CANCELLED
Show jobs
IN_PROGRESS
, COMPLETE
,
CANCELLED
, ERROR
, PAUSED
, PENDING
, RETRY
APPROVED
,
REJECTED
, PENDING
, CANCELLED
Show pagination
const options = {
method: 'GET',
headers: {
'x-api-key': '<your-api-key>',
'Content-Type': 'application/json',
},
};
fetch('https://api.getomni.ai/jobs?status=COMPLETE&page=1&size=10', options)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));
{
"jobs": [
{
"jobId": "123e4567-e89b-12d3-a456-426614174001",
"completedAt": "2023-09-10T15:30:45.123Z",
"createdAt": "2023-09-10T15:29:45.123Z",
"requestBody": {
"documentUrl": "https://example.com/document.pdf"
},
"responseBody": {
"ocr": {
"pages": [],
}
"extracted": {
"name": "John Doe",
"amount": "1500"
}
},
"status": "COMPLETE",
"statusUpdatedAt": "2023-09-10T15:30:45.123Z",
"extractId": "123e4567-e89b-12d3-a456-426614174002",
"pagesProcessed": 2
}
],
"pagination": {
"currentPage": 1,
"pageSize": 10,
"totalCount": 42,
"totalPages": 5,
"nextPage": 2,
"previousPage": null
}
}