BORA Access API
The BORA API connects your system to BORA Access, the device that recognizes the palm of the hand at the turnstile. This reference covers the 12 endpoints of the proof of concept: users, palm enrollment, passages, devices and the Mailbox.
Build with AIIntegrate BORA Access with one prompt.Overview
BORA authenticates passengers by the palm of the hand, in two moments: enrollment, once, at the Enrollment Totem, and every trip, at the turnstile, with BORA Access. The operator runs account-based ticketing: accounts, balance and charging live in the ABT backend (the operator Backend), and passengers use the ABT app to buy credits, see the balance and board with a QR code. The ABT backend talks to the BORA API. All data in transit and at rest is encrypted.
Enrollment
- The passenger already has an account in the ABT app and the ABT backend.
- The ABT backend creates the user in the BORA API, with the account id in
external_refand the optionalcpf. - The ABT backend opens an enrollment and gets a QR code and a short code. The ABT app shows them to the passenger.
- At the Enrollment Totem, the passenger scans the QR code (or types the short code), accepts the consent on the Totem screen and places the palms. The consent is recorded automatically with the enrollment.
- The ABT backend checks the enrollment and marks the palm as active in the app.
- The palm reaches every BORA Access through the Mailbox: the ABT backend fetches the Inbox and delivers it to the Validator Devices.
At the turnstile
BORA Access sits at the turnstile and recognizes the palm offline. It sends a signed Verdict over the USB cable to the operator's Validator Device, which checks the account in the ABT backend (balance, blocks, fare category) and opens the turnstile. BORA Access has no screen: it lights its LED, and the messages show on the Validator Device display. You reconcile the passages with GET /v1/verdicts.
This reference covers the endpoints your backend calls in the proof of concept.
Basic flow
- Create the user with the user's key in your system in
external_ref, plus the optionalcpf. - Open enrollment and show the QR code or the short code in the ABT app.
- Check the enrollment until
completed. - Run the Mailbox: fetch the Inbox of each device, deliver it to the Validator Device and deliver the Outbox.
- List passages to reconcile.
Base URL
Every endpoint starts with /v1. Request and response bodies are JSON (UTF-8). Dates are RFC 3339, in UTC, with milliseconds.
| environment | URL | state |
|---|---|---|
| Production | https://api.bora.id | coming soon |
| Local | http://127.0.0.1:8710 | reference server |
Connect the device
BORA ACCESS GATE 01 connects to the Validator Device with one USB cable. No driver or SDK is needed for the Validator Device to recognize it.
Cable
- One USB 2.0 cable, USB-A to USB-A, from the data port of BORA ACCESS GATE 01 to a USB-A port of the Validator Device.
- The Validator Device is the USB host. BORA ACCESS GATE 01 is the USB device and has its own power supply: it does not draw power from the Validator Device.
Recognition
BORA ACCESS GATE 01 shows up as a standard USB serial port (USB CDC-ACM class):
- Linux (production): the kernel
cdc_acmdriver (CONFIG_USB_ACM) creates/dev/ttyACM0. If ModemManager is installed, tell it to ignore the port (udev ruleENV{ID_MM_DEVICE_IGNORE}="1"). - Windows 10 and 11 (for testing): the built-in driver creates a
COMport. - Serial settings: raw, 8 data bits, no parity, 115200 baud (nominal; USB is not limited by it).
What happens after you plug it in
- The Validator Device sees the new serial port.
- BORA ACCESS GATE 01 opens an encrypted session over that port (protocol BORA-LINK/1), using the keys paired by BORA at installation.
- The two sides exchange their identification and keep a heartbeat every 2 seconds. The light turns purple: ready.
- For each passage, BORA ACCESS GATE 01 sends a signed Verdict; the Validator Device decides (balance, blocks) and answers with the decision and the light to show.
On the Validator Device
Choose one:
- BORA agent (recommended): a single program, with no dependencies, that runs on the Validator Device (Linux, ARM or x86). It handles the USB port, the encryption and the protocol. Your software talks to it locally: it receives each Verdict with the
external_refand answers allow or deny. - Your own implementation: BORA provides the BORA-LINK/1 specification, test vectors and a conformance suite.
BORA installs and pairs each device at the station.
Authentication
Every partner endpoint requires the Authorization header with your API key:
Authorization: Bearer bora_test_<key_id>_<secret>Each API key belongs to one organization (your company's account at BORA); users, devices, keys and passages are isolated per organization.
The key has the format bora_<environment>_<key_id>_<secret>. bora_test_ keys are test keys: same API, with data separate from production. bora_live_ keys work in production. Today the BORA team issues test keys on request.
Each key has scopes, and each endpoint states the scope it needs: subjects:read, subjects:write, devices:read, devices:write and verdicts:read. The endpoint GET /v1/health is public.
Keep the key in an environment variable (BORA_API_KEY), never in code. A missing or invalid key returns 401 unauthenticated.
curl "https://api.bora.id/v1/subjects?limit=1" \
-H "Authorization: Bearer $BORA_API_KEY"import os
import requests
BASE = "https://api.bora.id"
r = requests.get(
f"{BASE}/v1/subjects",
headers={
"Authorization": f"Bearer {os.environ['BORA_API_KEY']}",
},
params={
"limit": 1
},
timeout=10,
)
r.raise_for_status()
print(r.json())const BASE = "https://api.bora.id";
const res = await fetch(`${BASE}/v1/subjects?limit=1`, {
headers: {
"Authorization": `Bearer ${process.env.BORA_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${res.status} ${data.code}`);
console.log(data);Errors
The API uses the usual HTTP codes: 2xx is success, 4xx is an error in the request and 5xx is a server error. Each endpoint lists its success responses and its own errors. The common errors below can happen on any call.
Every error comes as application/problem+json (RFC 9457) with a stable code. Handle errors by code. The detail is text for humans and can change.
{
"type": "https://bora.id/transport/documentation#erro-insufficient_scope",
"title": "Insufficient scope",
"status": 403,
"code": "insufficient_scope",
"detail": "The API key does not have the subjects:write scope.",
"instance": "req_01J9Z8X7W6V7",
"retryable": false
}Common errors
| code | status | when | retry? |
|---|---|---|---|
| Authentication | |||
unauthenticated | 401 | missing, invalid or revoked API key | no |
forbidden | 403 | the key has no access to the resource | no |
insufficient_scope | 403 | API key without the scope of the route | no |
livemode_mismatch | 403 | test key on a live resource or the other way around | no |
| Request | |||
malformed_json | 400 | the body is not valid JSON | no |
invalid_request | 400 | query parameter or header with the wrong format | no |
payload_too_large | 413 | body above the limit | no |
unsupported_media_type | 415 | wrong Content-Type | no |
validation_failed | 422 | JSON outside the contract; details in errors[] | no |
| Rate limit | |||
rate_limited | 429 | rate limit | yes, after Retry-After |
| Server | |||
internal_error | 500 | internal error | yes |
service_unavailable | 503 | maintenance or overload | yes, after Retry-After |
| Device | |||
device_overheated | 503 | The device paused palm recognition because it is too hot. It resumes automatically when it cools down. | yes |
Rate limits
| who | limit |
|---|---|
| API key, reads | 100 req/s, burst of 200 |
| API key, writes | 20 req/s, burst of 40 |
POST /v1/enrollment-sessions | 60 per minute per organization |
Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. A 429 carries Retry-After: wait that many seconds before retrying. The limits are still a proposal and will be tuned with real load.
Other error codes
Codes that only some endpoints return, such as 404 for an unknown ID or 409 for a conflict. Each endpoint lists the statuses it can return.
Show the 13 other codes
| code | status | when | retry? |
|---|---|---|---|
invalid_cursor | 400 | invalid cursor or from another list | no |
subject_not_found | 404 | user not found | no |
device_not_found | 404 | device not found | no |
verdict_not_found | 404 | passage not found | no |
enrollment_session_not_found | 404 | enrollment not found | no |
external_ref_conflict | 409 | external_ref already used in your organization | no |
cpf_conflict | 409 | CPF already linked to another active user of your organization | no |
cursor_expired | 410 | cursor outside the retention | no |
external_ref_looks_like_cpf | 422 | the external_ref looks like a CPF; use the account id (the CPF goes in the cpf field) | no |
onboard_ref_looks_like_cpf | 422 | the onboard_ref looks like a CPF | no |
external_ref_invalid | 422 | external_ref outside your organization's format; the detail states the format | no |
cpf_invalid | 422 | CPF outside the format: 11 digits, no punctuation, with valid check digits | no |
use_search_endpoint | 422 | lookup by external_ref in the URL when the key is the CPF; use POST /v1/subjects/search | no |
Users
Each user is identified by external_ref, the user's key in your system. It follows your organization's format: numeric by default, the user's CPF, or a custom pattern agreed with BORA. The optional cpf field takes 11 digits only, with no dots, dashes or spaces, and valid check digits; it prevents duplicate users and stays encrypted. The palm comes later, in enrollment.
Create user
/v1/subjectsCreates the user, still without a palm (status pending_enrollment). Identify the user by external_ref, the user's key in your system, in your organization's format. The cpf is optional. Palm enrollment comes later, with POST /v1/enrollment-sessions.
Authentication: API key with the scope subjects:write.
Parameters
Client correlation ID (echoed in the response). If absent, BORA generates one.
^[A-Za-z0-9._:-]{1,64}$.Request body application/json
Unique key of the user in your system (for example the account number). It follows your organization's format: numeric by default (digits only, up to 32), the user's CPF (11 digits, no punctuation) or a custom pattern agreed with BORA. Outside the format, the API returns 422 external_ref_invalid with the expected format. If the key is the CPF, look users up with POST /v1/subjects/search.
^[A-Za-z0-9._:@-]{1,128}$.Optional. The user's CPF: 11 digits, no dots, dashes or spaces, with valid check digits. Otherwise the API returns 422 cpf_invalid. It prevents duplicate users, stays encrypted and never comes back in responses.
^[0-9]{11}$.Optional. A reference of yours that comes back in accepted passages. Do not use a CPF or a name.
^[A-Za-z0-9._:+/=-]{1,128}$.Responses
| status | meaning |
|---|---|
| 201 | User created. |
| 409 | Conflict with the current state. |
Common errors: see Errors.
List users
/v1/subjectsWith external_ref, returns 0 or 1 user. If your organization's key is the CPF, use POST /v1/subjects/search, because the CPF does not go in the URL.
Authentication: API key with the scope subjects:read.
Parameters
Unique key of the user in your system (for example the account number). It follows your organization's format: numeric by default (digits only, up to 32), the user's CPF (11 digits, no punctuation) or a custom pattern agreed with BORA. Outside the format, the API returns 422 external_ref_invalid with the expected format. If the key is the CPF, look users up with POST /v1/subjects/search.
^[A-Za-z0-9._:@-]{1,128}$.pending_enrollment, active, blocked.50.Opaque cursor (the next_cursor of the previous page).
^[A-Za-z0-9_=-]+$.Responses
| status | meaning |
|---|---|
| 200 | Page of users. |
| 410 | Resource or history past retention. |
Common errors: see Errors.
Search user
/v1/subjects/searchSame lookup as GET /v1/subjects?external_ref=, with the value in the request body. Use it when your organization's key is the CPF. Returns 0 or 1 user.
Authentication: API key with the scope subjects:read.
Parameters
Client correlation ID (echoed in the response). If absent, BORA generates one.
^[A-Za-z0-9._:-]{1,64}$.Request body application/json
Unique key of the user in your system (for example the account number). It follows your organization's format: numeric by default (digits only, up to 32), the user's CPF (11 digits, no punctuation) or a custom pattern agreed with BORA. Outside the format, the API returns 422 external_ref_invalid with the expected format. If the key is the CPF, look users up with POST /v1/subjects/search.
^[A-Za-z0-9._:@-]{1,128}$.Responses
| status | meaning |
|---|---|
| 200 | 0 or 1 user. |
Common errors: see Errors.
Get user
/v1/subjects/{subject_id}Authentication: API key with the scope subjects:read.
Parameters
Responses
| status | meaning |
|---|---|
| 200 | The user. |
| 404 | Resource not found. |
Common errors: see Errors.
Enrollment
Palm enrollment happens at the Enrollment Totem (screen and palm module). Your ABT backend opens the enrollment, the ABT app shows the QR code or the short code to the passenger and you follow the result. Consent is collected and recorded on the Totem screen during enrollment. See the enrollment flow.
Open enrollment
/v1/enrollment-sessionsOpens palm enrollment for a user you already created. Returns the qr_payload, which the ABT app shows as a QR code, and the short_code, to type at the Enrollment Totem. At the Totem, the passenger accepts the consent on the screen and places the palms; the consent is recorded automatically. Limit: 60 enrollments opened per minute per organization.
Authentication: API key with the scope subjects:write.
Request body application/json
Unique key of the user in your system (for example the account number). It follows your organization's format: numeric by default (digits only, up to 32), the user's CPF (11 digits, no punctuation) or a custom pattern agreed with BORA. Outside the format, the API returns 422 external_ref_invalid with the expected format. If the key is the CPF, look users up with POST /v1/subjects/search.
^[A-Za-z0-9._:@-]{1,128}$.L, R. From 1 to 2 items. Default: ["L", "R"].Optional. Limits the enrollment to one Enrollment Totem. Without it, any Totem of your organization can complete it.
^[A-Za-z0-9._:-]{1,64}$.300.Responses
| status | meaning |
|---|---|
| 201 | Enrollment opened. |
| 404 | Resource not found. |
| 409 | Conflict with the current state. |
Common errors: see Errors.
Get enrollment
/v1/enrollment-sessions/{session_id}Enrollment status. If the capture did not work, failure_code comes as capture_rejected: open a new enrollment.
Authentication: API key with the scope subjects:read.
Parameters
Responses
| status | meaning |
|---|---|
| 200 | Enrollment status. |
| 404 | Resource not found. |
Common errors: see Errors.
Passages
Each passage is a Verdict signed by the device, with the Validator Device decision when it arrives. Use it to reconcile with your backend and to dispute charges.
List passages
/v1/verdictsPassages recorded by the devices, with the user (subject_id and external_ref, only on accept) and the Validator Device decision when it arrives. Newest first. Available for 13 months.
Authentication: API key with the scope verdicts:read.
Parameters
^[A-Za-z0-9._:-]{1,64}$.^[A-Za-z0-9._:-]{1,64}$.Recognition result: accept, reject or abstain.
accept, reject, abstain.complete: passage reconciled. awaiting_decision: the Validator Device decision is missing. awaiting_passage: the turnstile was released and the rotation confirmation is missing. outcome_unknown: the passage result was lost. conflict: the passage records do not match each other.
complete, awaiting_decision, awaiting_passage, outcome_unknown, conflict.Inclusive start (decided_at).
Exclusive end (decided_at).
desc, asc. Default: "desc".50.Opaque cursor (the next_cursor of the previous page).
^[A-Za-z0-9_=-]+$.Responses
| status | meaning |
|---|---|
| 200 | Page of passages. |
| 410 | Resource or history past retention. |
Common errors: see Errors.
Get passage
/v1/verdicts/{verdict_id}The passage with the proof signed by the device and, when they arrived, the decision and the rotation recorded by the Validator Device. Use it to reconcile with your backend and to dispute a charge.
Authentication: API key with the scope verdicts:read.
Parameters
Passage id.
^[0-9a-f]{32}$.Responses
| status | meaning |
|---|---|
| 200 | The passage with the proof. |
| 404 | Resource not found. |
Common errors: see Errors.
Devices
Both devices are BORA ACCESS: the gate, BORA ACCESS GATE 01 (kind: gate), sits at the turnstile; the totem, BORA ACCESS TOTEM 01 (kind: totem), is the Enrollment Totem. Gate ids start with gate- and totem ids with totem-. The gate has no screen: it lights its LED, and the messages show on the Validator Device display.
List devices
/v1/devicesAuthentication: API key with the scope devices:read.
Parameters
active, revoked, wiped.^[A-Za-z0-9._:-]{1,64}$.gate, totem.50.Opaque cursor (the next_cursor of the previous page).
^[A-Za-z0-9_=-]+$.Responses
| status | meaning |
|---|---|
| 200 | Page of devices. |
Common errors: see Errors.
Mailbox
BORA prepares records for each device. Your backend fetches them from the Inbox and delivers them to the Validator Device, which passes them to BORA Access. Records coming back from the device go to the Outbox. Records are encrypted end to end.
Fetch the Inbox
/v1/devices/{device_id}/inboxRecords BORA prepared for this device. Your backend fetches them here and delivers them to the Validator Device, which passes them to BORA Access. Always ask from the last delivered seq (after_seq) and deliver them in order.
Authentication: API key with the scope devices:read.
Parameters
Device id. Starts with gate- (BORA ACCESS GATE 01, at the turnstile) or totem- (BORA ACCESS TOTEM 01, the Enrollment Totem).
^[A-Za-z0-9._:-]{1,64}$.Returns only records with a seq greater than this one. Default 0 (from the start).
0.50.Responses
| status | meaning |
|---|---|
| 200 | Records pending for the device, in seq order. |
| 404 | Resource not found. |
Common errors: see Errors.
Deliver the Outbox
/v1/devices/{device_id}/outboxRecords coming back from the device. The Validator Device receives them from BORA Access, and your backend delivers them here as received. acked_upto_seq tells how far BORA has received. Sending the same record again is fine.
Authentication: API key with the scope devices:write.
Parameters
Device id. Starts with gate- (BORA ACCESS GATE 01, at the turnstile) or totem- (BORA ACCESS TOTEM 01, the Enrollment Totem).
^[A-Za-z0-9._:-]{1,64}$.Request body application/json
^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$."ed25519".^[0-9a-f]{32}$.^[A-Za-z0-9+/]{86}==$.^[A-Za-z0-9+/]{139}=$.Responses
| status | meaning |
|---|---|
| 200 | Result per record. |
| 404 | Resource not found. |
Common errors: see Errors.
System
Public endpoint, no API key: the service status.
Service status
/v1/healthPublic endpoint, no API key.
Responses
| status | meaning |
|---|---|
| 200 | Service is up. |
Common errors: see Errors.