API Reference · Document Intelligence
Document Detection
Mendeteksi keberadaan dan jenis dokumen pada sebuah gambar.
POST
/api/v1/playground/document-detection
Authentication
Send a Firebase ID token from LUTUNG Google sign-in as a bearer token. There are no public API keys in this MVP; pilot developers request access from the LUTUNG team.
| Header | Value | |
|---|---|---|
Authorization | Bearer <Firebase ID token> | required |
Content-Type | multipart/form-data | required |
Content-Length | Request size in bytes | required |
Request body
| Field | Type | Description |
|---|---|---|
file required | binary | Image in JPEG or PNG. Max 5 MB and 25 megapixels. Type is verified server-side by decoding the image. |
Limits
10/minRequests per account
30 sProcessing timeout
5 MBMax file size
Concurrency is bounded; when the service is busy the API returns 503 SERVICE_UNAVAILABLE with a Retry-After header.
Example request
cURL
curl -X POST "https://<lutung-host>/api/v1/playground/document-detection" \
-H "Authorization: Bearer $LUTUNG_ID_TOKEN" \
-F "file=@image.jpg"
JavaScript
const form = new FormData();
form.append("file", fileInput.files[0]);
const res = await fetch("https://<lutung-host>/api/v1/playground/document-detection", {
method: "POST",
headers: { Authorization: `Bearer ${idToken}` },
body: form,
});
const result = await res.json();
Python
import requests
with open("image.jpg", "rb") as f:
res = requests.post(
"https://<lutung-host>/api/v1/playground/document-detection",
headers={"Authorization": f"Bearer {id_token}"},
files={"file": f},
timeout=40,
)
print(res.json())
Example response
Illustrative — field names under data must be confirmed against the deployed service contract.
200 OK application/json
{
"request_id": "req_example_001",
"status": "success",
"technology": "document-detection",
"data": {
"...": "fields as returned by the service (to be confirmed)"
}
}
Error codes
Errors use a consistent shape. Every response carries an X-Request-Id header — include it when reporting issues.
Error response
{"request_id": "req_…", "error": {"code": "RATE_LIMITED", "message": "Too many requests. Please try again later."}}
| Code | HTTP | Meaning / what to do |
|---|---|---|
INVALID_FILE | 400 · 411 · 415 | Unsupported, malformed or empty upload. Select a supported file and retry. |
FILE_TOO_LARGE | 413 | Upload exceeds the size or dimension limit. Reduce file size. |
UNAUTHORIZED | 401 | Missing, expired or invalid identity token. Sign in again. |
CONSENT_REQUIRED | 403 | Data-handling notice must be acknowledged before using a sensitive-document service. |
TRIAL_ALREADY_USED | 403 | Free trial consumed. Paid access is not available yet; contact the team for pilot access. |
TRIAL_IN_PROGRESS | 409 | Another trial request for this account is processing. Wait for it to finish. |
RATE_LIMITED | 429 | Request limit exceeded. Wait for the Retry-After interval. |
SERVICE_UNAVAILABLE | 503 | Provider unavailable, busy, or under maintenance. Retry later; do not submit repeatedly. |
PROCESSING_TIMEOUT | 504 | Processing exceeded the configured timeout. A trial is not consumed. |
INTERNAL_ERROR | 500 | Unexpected server failure. Report the request ID. |
Changelog
| v1 | Initial MVP release. Report issues via the Playground “Laporkan masalah” form. |