API Reference · Document Intelligence

Document Detection

Mendeteksi keberadaan dan jenis dokumen pada sebuah gambar.

Beta Free · no LUTUNG Credits Try in Playground →

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.

HeaderValue
AuthorizationBearer <Firebase ID token>required
Content-Typemultipart/form-datarequired
Content-LengthRequest size in bytesrequired

Request body

FieldTypeDescription
file requiredbinary 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."}}
CodeHTTPMeaning / what to do
INVALID_FILE400 · 411 · 415Unsupported, malformed or empty upload. Select a supported file and retry.
FILE_TOO_LARGE413Upload exceeds the size or dimension limit. Reduce file size.
UNAUTHORIZED401Missing, expired or invalid identity token. Sign in again.
CONSENT_REQUIRED403Data-handling notice must be acknowledged before using a sensitive-document service.
TRIAL_ALREADY_USED403Free trial consumed. Paid access is not available yet; contact the team for pilot access.
TRIAL_IN_PROGRESS409Another trial request for this account is processing. Wait for it to finish.
RATE_LIMITED429Request limit exceeded. Wait for the Retry-After interval.
SERVICE_UNAVAILABLE503Provider unavailable, busy, or under maintenance. Retry later; do not submit repeatedly.
PROCESSING_TIMEOUT504Processing exceeded the configured timeout. A trial is not consumed.
INTERNAL_ERROR500Unexpected server failure. Report the request ID.

Changelog

v1Initial MVP release. Report issues via the Playground “Laporkan masalah” form.