Poll an async request
curl --request GET \
--url https://api.usepatchwork.co/v1/requests/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.usepatchwork.co/v1/requests/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.usepatchwork.co/v1/requests/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"status": "success",
"data": {
"id": "<string>",
"product": "<string>",
"state": "pending",
"result": {
"result": "extracted",
"document": {
"media_type": "<string>",
"pages": 123
},
"template": "<string>",
"match": {
"name": "<string>",
"confidence": "high",
"alternatives": [
{
"template": "<string>",
"name": "<string>",
"confidence": "high"
}
]
},
"fields": {},
"missing": [
"<string>"
],
"extracted_at": "2023-11-07T05:31:56Z"
},
"error": {
"code": "<string>",
"message": "<string>"
}
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}Workbench
Poll an async request
Read a request’s current state, and its result or error once it lands.
GET
/
v1
/
requests
/
{id}
Poll an async request
curl --request GET \
--url https://api.usepatchwork.co/v1/requests/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.usepatchwork.co/v1/requests/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.usepatchwork.co/v1/requests/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"status": "success",
"data": {
"id": "<string>",
"product": "<string>",
"state": "pending",
"result": {
"result": "extracted",
"document": {
"media_type": "<string>",
"pages": 123
},
"template": "<string>",
"match": {
"name": "<string>",
"confidence": "high",
"alternatives": [
{
"template": "<string>",
"name": "<string>",
"confidence": "high"
}
]
},
"fields": {},
"missing": [
"<string>"
],
"extracted_at": "2023-11-07T05:31:56Z"
},
"error": {
"code": "<string>",
"message": "<string>"
}
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}Authorizations
Identify accepts a workspace API key (sk_…). Loom accepts either a short-lived session token (direct) or a workspace API key (relay).