# HTTP API reference

Integrate from any server language that supports HTTPS and JSON.

## Base URL and headers

Append /api/v1/sdk to your assigned Identomic HTTPS origin. Use Authorization: Bearer followed by the appropriate key. Set Content-Type: application/json on JSON POST requests.

## Supported module IDs

- fingerprints — Contactless fingerprints
- face_capture — Face photo
- face_liveness — Live selfie
- passport_photo — Passport photo page
- passport_nfc — Passport chip
- id_card_capture — TD1 ID card
- face_comparison — Face comparison

## Read module availability

GET /configuration takes a publishable key and returns project, environment, and modules. Availability depends on the grant, owner preference, remaining allowance and an effective production rate. Availability may change before authorization.

## Authorize a session

POST /sessions takes a secret key with authorize scope. Use 1–128 ASCII letters, digits, periods, underscores, colons or hyphens in the idempotency key. HTTP 201 creates a session. HTTP 200 returns the original active session on a matching retry. The token expires after five minutes.

```json
{ "module": "fingerprints", "idempotencyKey": "operation-123:fingerprints" }
```

## Session response

Send the token back to the authorized mobile caller. Keep tokens and response bodies out of logs. The capture token is scoped to its organization, environment and module.

```json
{
  "sessionId": "<session UUID>",
  "sessionToken": "<signed session token>",
  "expiresAt": "<ISO 8601 UTC timestamp>"
}
```

## Claim from a mobile SDK

POST /sessions/claim takes a publishable key and JSON fields module, sessionToken, and attemptId (UUID). The provided mobile SDK calls this endpoint automatically. It returns sessionId. A retry with the same attempt ID is idempotent. A separate attempt against the same session returns SESSION_ALREADY_CLAIMED.

## Report the final outcome

POST /outcomes takes a secret key with outcome scope. Accepted outcomes are completed, cancelled, and failed. An identical retry succeeds. A different final outcome returns OUTCOME_CONFLICT. Reporting can occur after token expiry.

```json
{ "sessionId": "<session UUID>", "outcome": "completed" }
```

## Other endpoints

GET /jwks provides the public Ed25519 verification key. POST /sandbox/key-pair uses a sandbox secret with authorize scope to return its paired publishable key, project and sandbox environment. The sandbox-only endpoint supports the demo backend.

## Transaction counting and throttling

Each successful authorization consumes one unit for that module. Four fingerprints count as one authorization. Configuration, claiming, retries of a matching authorization and outcome reporting add no units. Production records the rate effective at authorization in UTC. Per-key limits are 120 configuration reads, 120 authorizations and 240 outcome reports per minute.

## Error handling

- 400 INVALID_REQUEST — correct the request before retrying.
- 401 INVALID_KEY or INVALID_SESSION_TOKEN — check the key and environment, or request a fresh session for an expired token.
- 403 INSUFFICIENT_KEY_SCOPE, ORGANIZATION_SUSPENDED, ENVIRONMENT_DISABLED, MODULE_DISABLED or SESSION_SCOPE_MISMATCH — resolve the indicated credential, access or token mismatch.
- 404 SESSION_NOT_FOUND — check the environment and original session ID.
- 409 QUOTA_EXHAUSTED or PRICE_REQUIRED — check remaining allowance and the effective production rate.
- 409 IDEMPOTENCY_CONFLICT, SESSION_EXPIRED, SESSION_ALREADY_CLAIMED or OUTCOME_CONFLICT — reconcile the original operation before initiating a new one.
- 429 RATE_LIMITED — back off and use the same idempotency key when retrying. For timeouts or transient 5xx errors, use bounded retries with the same key.
