BORADocs
API Reference

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

Enrollment: ABT app, ABT backend, BORA API and Enrollment TotemABT APPpassenger: account,credits and QR codeABT BACKENDoperator: accounts,balance and chargingBORA APIcloud: enrollments,gallery and passagesENROLLMENT TOTEMscreen and palm module,consent on screenoperatornetworkHTTPSAPI keyHTTPSdevice keythe passenger shows the QR code or the short code at the Enrollment TotemSame flow, verticalABT APPpassenger: account,credits and QR codeABT BACKENDoperator: accounts,balance and chargingBORA APIcloud: enrollments,gallery and passagesENROLLMENT TOTEMscreen and palm module,consent on screenoperator networkHTTPS API keyHTTPS device keyQR code or short code
Enrollment happens once. Balance, blocks and charging stay in the ABT backend; BORA only keeps the palm.
  1. The passenger already has an account in the ABT app and the ABT backend.
  2. The ABT backend creates the user in the BORA API, with the account id in external_ref and the optional cpf.
  3. The ABT backend opens an enrollment and gets a QR code and a short code. The ABT app shows them to the passenger.
  4. 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.
  5. The ABT backend checks the enrollment and marks the palm as active in the app.
  6. 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.

Backend and BORA API over HTTPS; BORA Access and Validator Device over the USB cable; Mailbox from the BORA API to the deviceBORA APIcloud: enrollments,gallery and passagesABT BACKENDoperator: accounts,balance and chargingVALIDATOR DEVICEdecides and opensthe turnstileBORA ACCESSat the turnstile, readsthe palm offlineHTTPSAPI keyoperatornetworkUSB cableBORA-LINK/1Same flow, verticalBORA APIcloud: enrollments,gallery and passagesABT BACKENDoperator: accounts,balance and chargingVALIDATOR DEVICEdecides and opensthe turnstileBORA ACCESSat the turnstile, readsthe palm offlineHTTPS API keyoperator networkUSB cable BORA-LINK/1Mailbox: encrypted records from BORA to the device
The USB cable uses the BORA-LINK/1 protocol and does not go through the API. The Mailbox carries the records BORA prepares for each device; they are encrypted end to end.

This reference covers the endpoints your backend calls in the proof of concept.

Basic flow

  1. Create the user with the user's key in your system in external_ref, plus the optional cpf.
  2. Open enrollment and show the QR code or the short code in the ABT app.
  3. Check the enrollment until completed.
  4. Run the Mailbox: fetch the Inbox of each device, deliver it to the Validator Device and deliver the Outbox.
  5. 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.

environmentURLstate
Productionhttps://api.bora.idcoming soon
Localhttp://127.0.0.1:8710reference 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_acm driver (CONFIG_USB_ACM) creates /dev/ttyACM0. If ModemManager is installed, tell it to ignore the port (udev rule ENV{ID_MM_DEVICE_IGNORE}="1").
  • Windows 10 and 11 (for testing): the built-in driver creates a COM port.
  • Serial settings: raw, 8 data bits, no parity, 115200 baud (nominal; USB is not limited by it).

What happens after you plug it in

  1. The Validator Device sees the new serial port.
  2. BORA ACCESS GATE 01 opens an encrypted session over that port (protocol BORA-LINK/1), using the keys paired by BORA at installation.
  3. The two sides exchange their identification and keep a heartbeat every 2 seconds. The light turns purple: ready.
  4. 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_ref and 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:

HTTP
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"

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.

JSON
{
  "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

codestatuswhenretry?
Authentication
unauthenticated401missing, invalid or revoked API keyno
forbidden403the key has no access to the resourceno
insufficient_scope403API key without the scope of the routeno
livemode_mismatch403test key on a live resource or the other way aroundno
Request
malformed_json400the body is not valid JSONno
invalid_request400query parameter or header with the wrong formatno
payload_too_large413body above the limitno
unsupported_media_type415wrong Content-Typeno
validation_failed422JSON outside the contract; details in errors[]no
Rate limit
rate_limited429rate limityes, after Retry-After
Server
internal_error500internal erroryes
service_unavailable503maintenance or overloadyes, after Retry-After
Device
device_overheated503The device paused palm recognition because it is too hot. It resumes automatically when it cools down.yes

Rate limits

wholimit
API key, reads100 req/s, burst of 200
API key, writes20 req/s, burst of 40
POST /v1/enrollment-sessions60 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
codestatuswhenretry?
invalid_cursor400invalid cursor or from another listno
subject_not_found404user not foundno
device_not_found404device not foundno
verdict_not_found404passage not foundno
enrollment_session_not_found404enrollment not foundno
external_ref_conflict409external_ref already used in your organizationno
cpf_conflict409CPF already linked to another active user of your organizationno
cursor_expired410cursor outside the retentionno
external_ref_looks_like_cpf422the external_ref looks like a CPF; use the account id (the CPF goes in the cpf field)no
onboard_ref_looks_like_cpf422the onboard_ref looks like a CPFno
external_ref_invalid422external_ref outside your organization's format; the detail states the formatno
cpf_invalid422CPF outside the format: 11 digits, no punctuation, with valid check digitsno
use_search_endpoint422lookup by external_ref in the URL when the key is the CPF; use POST /v1/subjects/searchno

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

POST/v1/subjects

Creates 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

X-Request-Idstringheader

Client correlation ID (echoed in the response). If absent, BORA generates one.

Up to 64 characters. Format: ^[A-Za-z0-9._:-]{1,64}$.

Request body application/json

external_refstringrequired

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.

Format: ^[A-Za-z0-9._:@-]{1,128}$.
cpfstring

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.

Format: ^[0-9]{11}$.
onboard_refstring

Optional. A reference of yours that comes back in accepted passages. Do not use a CPF or a name.

Format: ^[A-Za-z0-9._:+/=-]{1,128}$.

Responses

statusmeaning
201User created.
409Conflict with the current state.

Common errors: see Errors.

List users

GET/v1/subjects

With 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

external_refstringquery

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.

Format: ^[A-Za-z0-9._:@-]{1,128}$.
statusstringquery
Values: pending_enrollment, active, blocked.
limitintegerquery
From 1 to 200. Default: 50.
cursorstringquery

Opaque cursor (the next_cursor of the previous page).

Up to 512 characters. Format: ^[A-Za-z0-9_=-]+$.

Responses

statusmeaning
200Page of users.
410Resource or history past retention.

Common errors: see Errors.

Search user

POST/v1/subjects/search

Same 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

X-Request-Idstringheader

Client correlation ID (echoed in the response). If absent, BORA generates one.

Up to 64 characters. Format: ^[A-Za-z0-9._:-]{1,64}$.

Request body application/json

external_refstringrequired

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.

Format: ^[A-Za-z0-9._:@-]{1,128}$.

Responses

statusmeaning
2000 or 1 user.

Common errors: see Errors.

Get user

GET/v1/subjects/{subject_id}

Authentication: API key with the scope subjects:read.

Parameters

subject_idstring (uuid)pathrequired

Responses

statusmeaning
200The user.
404Resource 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

POST/v1/enrollment-sessions

Opens 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

subject_idstring (uuid)required: one of the two
external_refstringrequired: one of the two

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.

Format: ^[A-Za-z0-9._:@-]{1,128}$.
hands_requiredarray of string
Items: L, R. From 1 to 2 items. Default: ["L", "R"].
device_idstring

Optional. Limits the enrollment to one Enrollment Totem. Without it, any Totem of your organization can complete it.

Format: ^[A-Za-z0-9._:-]{1,64}$.
expires_in_sinteger
From 60 to 900. Default: 300.

Responses

statusmeaning
201Enrollment opened.
404Resource not found.
409Conflict with the current state.

Common errors: see Errors.

Get enrollment

GET/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

session_idstring (uuid)pathrequired

Responses

statusmeaning
200Enrollment status.
404Resource 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

GET/v1/verdicts

Passages 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

device_idstringquery
Format: ^[A-Za-z0-9._:-]{1,64}$.
gate_idstringquery
Format: ^[A-Za-z0-9._:-]{1,64}$.
subject_idstring (uuid)query
decisionstringquery

Recognition result: accept, reject or abstain.

Values: accept, reject, abstain.
reconciliationstringquery

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.

Values: complete, awaiting_decision, awaiting_passage, outcome_unknown, conflict.
fromstring (date-time)query

Inclusive start (decided_at).

tostring (date-time)query

Exclusive end (decided_at).

orderstringquery
Values: desc, asc. Default: "desc".
limitintegerquery
From 1 to 200. Default: 50.
cursorstringquery

Opaque cursor (the next_cursor of the previous page).

Up to 512 characters. Format: ^[A-Za-z0-9_=-]+$.

Responses

statusmeaning
200Page of passages.
410Resource or history past retention.

Common errors: see Errors.

Get passage

GET/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

verdict_idstringpathrequired

Passage id.

Format: ^[0-9a-f]{32}$.

Responses

statusmeaning
200The passage with the proof.
404Resource 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

GET/v1/devices

Authentication: API key with the scope devices:read.

Parameters

statusstringquery
Values: active, revoked, wiped.
gate_idstringquery
Format: ^[A-Za-z0-9._:-]{1,64}$.
kindstringquery
Values: gate, totem.
limitintegerquery
From 1 to 200. Default: 50.
cursorstringquery

Opaque cursor (the next_cursor of the previous page).

Up to 512 characters. Format: ^[A-Za-z0-9_=-]+$.

Responses

statusmeaning
200Page 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

GET/v1/devices/{device_id}/inbox

Records 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_idstringpathrequired

Device id. Starts with gate- (BORA ACCESS GATE 01, at the turnstile) or totem- (BORA ACCESS TOTEM 01, the Enrollment Totem).

Format: ^[A-Za-z0-9._:-]{1,64}$.
after_seqintegerquery

Returns only records with a seq greater than this one. Default 0 (from the start).

Minimum 0. Default: 0.
limitintegerquery
From 1 to 200. Default: 50.

Responses

statusmeaning
200Records pending for the device, in seq order.
404Resource not found.

Common errors: see Errors.

Deliver the Outbox

POST/v1/devices/{device_id}/outbox

Records 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_idstringpathrequired

Device id. Starts with gate- (BORA ACCESS GATE 01, at the turnstile) or totem- (BORA ACCESS TOTEM 01, the Enrollment Totem).

Format: ^[A-Za-z0-9._:-]{1,64}$.

Request body application/json

recordsarray of MailboxRecordrequired
From 1 to 32 items.
records[].postobjectrequired
records[].ct_b64stringrequired
Format: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$.
records[].algstringrequired
Fixed value: "ed25519".
records[].signer_kidstringrequired
Format: ^[0-9a-f]{32}$.
records[].sig_b64stringrequired
Format: ^[A-Za-z0-9+/]{86}==$.
records[].signer_cert_b64string
Format: ^[A-Za-z0-9+/]{139}=$.

Responses

statusmeaning
200Result per record.
404Resource not found.

Common errors: see Errors.

System

Public endpoint, no API key: the service status.

Service status

GET/v1/health

Public endpoint, no API key.

Responses

statusmeaning
200Service is up.

Common errors: see Errors.

Go to website