All API requests require authentication using a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Required | Unique request identifier for tracking |
input.file | string | Required | Base64 encoded document file (PDF, PNG, JPG) |
input.corpusName | string | Required | Name of the corpus to use for processing |
input.saveOODToRepository | string | Optional | Repository identifier to save out-of-distribution (unknown) documents |
input.metadata | object | Optional | Custom metadata to attach to the request |
input.supervision | object | Optional | Supervision data for training or evaluation |
input.useThresholds | boolean | Optional | Enable unknown document detection using similarity thresholds (default: false) |
callback | string | Optional | URL for async callback (webhook) |
{
"status": "OK",
"requestId": "request-123",
"timestamp": "2024-01-01T00:00:00.000Z",
"duration": "2.45",
"model": "gpt-4-vision",
"metadata": {},
"pages": [
{
"page": 1,
"documentType": "Invoice",
"documentTypeVariant": "Standard",
"pageLayout": "invoice-standard-page1",
"attributes": [
{
"item": "Invoice Number",
"text": "INV-2024-001",
"bbox_2d": [
100,
50,
250,
70
],
"namedEntity": "invoice_number"
}
],
"image_height": 1100,
"image_width": 850,
"matchInfo": {
"documentPageId": "layout-123",
"layoutId": "layout-123",
"maxSim": 0.95
}
},
{
"page": 2,
"documentType": "unknown",
"documentTypeVariant": null,
"pageLayout": null,
"attributes": [],
"isUnknown": true,
"unknownReason": "Below class similarity threshold (0.42 < 0.65)",
"confidence": 0.42,
"nearestMatch": {
"documentType": "Receipt",
"similarity": 0.42
}
}
]
}{
"status": "processed",
"requestId": "request-123",
"callbackUrl": "https://your-callback-url.com/webhook"
}Same format as synchronous response above
| Status Code | Error Type | Example Response |
|---|---|---|
| 401 | Unauthorized | {"error": "Unauthorized: Invalid API key"} |
| 400 | Bad Request | {"error": {"requestId": "123", "message": "Missing required field: input.file"}} |
| 500 | Server Error | {"error": {"requestId": "123", "message": "Internal processing error"}} |
curl -X POST https://api.docugym.com/api/resolvesync \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "request-123",
"input": {
"file": "BASE64_ENCODED_FILE_CONTENT",
"corpusName": "your-corpus-name",
"saveOODToRepository": "my-repo-key",
"metadata": {
"source": "api-test",
"timestamp": "2024-01-01T00:00:00Z"
}
},
"callback": "https://your-callback-url.com/webhook"
}'Enable unknown document detection by setting input.useThresholds: true in your request.
When enabled, the system uses two-stage rejection:
Unknown documents will have isUnknown: true with an explanation and nearest match information.
Authentication - API key is validated against your organization
Document Classification - Each page is analyzed and classified against known document layouts in your corpus
Unknown Detection - When useThresholds is enabled, documents below similarity thresholds are marked as unknown
Layout Matching - Pages are matched to specific layouts with similarity scores
Entity Extraction - Based on the identified layout, relevant fields and entities are extracted
Response Generation - Structured data is returned with bounding boxes and confidence scores
© 2025 Frank Sommers. All rights reserved.