Baian Partner API 1.4.0
Base URL: https://api.baian.ai/v1
Live transcription of one source audio feed per session (one teacher microphone), with optional translation and Quran reference detection. Hadith reference detection is opt-in where this environment supports it. Create a session from your server and give the returned source token to the teacher app, which publishes one microphone track to LiveKit. Read results by long-polling the events endpoint and send them on to your students yourself. Session data is private to your organization.
Lifecycle: a session moves from created to live when Baian processes its first source audio, to ending when a stop is requested, and then to ended. It can also finish as failed (it could not start) or expired.
Timing: a created session that records no results expires after 600 seconds. A live session that receives no new source audio for 300 seconds stops with end_reason source_lost. A session stops once it has processed max_session_seconds of audio (end_reason max_duration).
After a stop, Baian finishes processing the remaining audio. If that is not confirmed within 120 seconds, the session ends with completeness incomplete. If an allowance, duration or access limit stopped the session, end_reason keeps that reason; otherwise end_reason is agent_lost.
end_reason says why the session stopped. completeness and detail say whether results are missing and why. The two are independent: a session stopped normally (end_reason stopped) can still be incomplete if processing failed while it was finishing. If Baian ends a session itself without a stop request, end_reason is source_lost. When results are missing, the detail field of the session.ended event holds a reason code, for example source_provider_stalled or source_connection_closed (the teacher audio could not be transcribed), control_unavailable or heartbeat_503 (Baian lost contact with its own control service), retries_exhausted or queue_capacity_reached (not all results could be saved), or close_timeout. detail is open diagnostic text, not an enum, and new codes may appear.
Access: after you revoke an API key, every later request made with it returns 401. Sessions it created keep running; stop or read them with another key from the same organization or from the dashboard. A source token that was already issued can still be used to join until its expires_at (15 minutes after it was issued). If the organization is suspended, or the dashboard user who started a console session loses owner or admin access, running sessions stop within about 10 seconds and finish with end_reason access_revoked. If processing for a session is not running, this can take up to about 3 minutes. While the organization is suspended, every API key request returns 403 org_suspended. Reactivating the organization does not resume a stopped session.
Completeness: a session is complete only when every transcript segment has every requested translation, each requested reference check (quran_refs and hadith_refs) has a result other than failed, and no results were lost. Otherwise it is incomplete. missing_segment_ids lists the segments known to be missing results. It can be empty for an incomplete session when audio was lost before it became a segment, for example because transcription failed; detail then explains why.
Saved results in /events and /transcript contain only finished text. Baian sends each transcript.final segment once and never changes it. Its words come from speech recognition and can include words that were not yet confirmed when Baian committed the segment.
Reference events contain full snapshots. Later speech can produce another quran.references or hadith.references event for the same segment. Process events in seq order and replace that kind of reference list for segment_id. Keep the transcript text unchanged. Older results may omit reference_revision and reference_policy_version.
Hadith citations: when a hadith reference has citation.scheme print_edition, show the collection and citation.number, and name citation.edition where readers can find it. When citation is absent or null, show the collection and canonical_quote without a number. Older results can carry citation.scheme upstream_arabicnumber; treat that number as unverified. Never show record_number as a hadith number.
session.gap is sent only when teacher audio resumes after the source reconnected or processing restarted. It covers the time with no processed audio. Silences and pauses within continuous audio do not create gap events.
Timeline: start_ms, end_ms, from_ms and to_ms are integer milliseconds since session.created (created_at), including setup time and gaps. source_seconds counts processed source audio only.
Pilot limits: each monthly period that Baian activates for your organization includes 2,000 minutes of source audio and 2,500 minutes of total session running time, shared by every API key and the console. Running time is measured with server timestamps and includes setup, pauses and the final processing after a stop. GET /usage shows the period dates and the seconds remaining. New sessions are refused when there is no active period or when either limit is used up. Each session ends at the end of the period it started in, when the audio limit is reached, or at most eight hours after it was created. Use an empty output_langs array for a transcript-only class. Your organization needs translation enabled only when you request an output language. When a usage or time limit is reached, Baian stops the session and still saves its final results. Running sessions check their limits about every 10 seconds, with a backup check every minute, so concurrent sessions and final processing can use slightly more than the remaining seconds last reported. All audio used is still recorded, and overages are not charged automatically. Contact Baian to renew or add usage.
Retention: data for an ended session (events, transcript, metadata and the external class identifier) is deleted after your organization's retention period (retention_days, 30 days by default) or when you delete the session. For usage and safe retries, Baian retains the internal session and organization IDs, key ID for API-created sessions, status, timestamps, completeness, audio duration, original Idempotency-Key and request hash. Keep personal or sensitive data out of idempotency keys.
Delivery: poll GET /sessions/{id}/events for saved results. To show words as they are spoken, also open GET /sessions/{id}/partials. The preview stream has no cursor or history. There are no webhooks. Budget 600 requests per minute per API key. Cloudflare applies the limit approximately at each location. On 429 rate_limited, wait for the duration in Retry-After.
Authentication
Send Authorization: Bearer bn_live_… to authenticated endpoints (http bearer).
Organization API key (bn_live_...). Keep it on your server and never include it in browser or mobile app code.
The public OpenAPI file is available without a key.
Endpoints
Languages and usage
Supported languages
get /languages
Responses
| Status | Description | Body |
|---|---|---|
| 200 | LanguagesHeaders: X-Request-Id | Languages |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl "https://api.baian.ai/v1/languages" \
-H "Authorization: Bearer $BAIAN_API_KEY"Current organisation audio allowance
get /usage
Scope sessions:read. All API keys and console sessions share this allowance.
Responses
| Status | Description | Body |
|---|---|---|
| 200 | AllowanceHeaders: X-Request-Id | object |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl "https://api.baian.ai/v1/usage" \
-H "Authorization: Bearer $BAIAN_API_KEY"Sessions
Create a session
post /sessions
Scope sessions:write. Idempotent: sending the same Idempotency-Key with the same body returns the same session (200 with Idempotent-Replayed: true). Inspect session.status and source before connecting the microphone. A new session can return 201 with status failed, failure_code provisioning_failed and source set to null.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
Idempotency-Keyrequired | header | string | 1 to 200 characters |
Request body (CreateSession)
| Field | Type | Description |
|---|---|---|
external_session_idrequired | string | Your own identifier, for example a class ID. Only one open session can use a given value.1 to 200 characters |
input_langrequired | string | Main spoken language (see /languages). |
additional_input_langsoptional | string[] | null | Other spoken languages. Use ["ar"] for English teaching with Arabic quotations. Omit or send null for none. After normalization, duplicates and the main language are removed. Up to 3 additional languages may remain. |
output_langsoptional | string[] | null | Translation targets. Omit, send null or leave empty for a transcript only. Up to 5 distinct supported languages after normalization. |
quran_refsoptional | boolean | Detect Quran quotations in Arabic-script source text, whatever the main language.Default: true |
hadith_refsoptional | boolean | Match Arabic hadith quotations against a fixed version of the six-book corpus. For new sessions, request this only when /languages features.hadith_refs is true. Returns 503 feature_unavailable if disabled in this environment or 403 hadith_not_enabled if disabled for your organization. A match says nothing about authenticity or grading.Default: false |
metadataoptional | object | null | Up to 4 KB. Omission or null stores an empty object. Deleted with the class content. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Idempotent replayHeaders: X-Request-Id, Idempotent-Replayed | CreateSessionResponse |
| 201 | Session created. Check its status before connecting.Headers: X-Request-Id | CreateSessionResponse |
| 400 | Error. error.code is one of: validation_failed, idempotency_key_requiredHeaders: X-Request-Id | Error |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspended, usage_period_required, usage_limit_reached, runtime_limit_reached, translation_not_enabled, hadith_not_enabledHeaders: X-Request-Id | Error |
| 409 | Error. error.code is one of: idempotency_conflict, session_already_activeHeaders: X-Request-Id | Error |
| 410 | Error. error.code is one of: session_deletedHeaders: X-Request-Id | Error |
| 413 | Error. error.code is one of: payload_too_largeHeaders: X-Request-Id | Error |
| 429 | For rate_limited, wait at least Retry-After seconds. For concurrency_limit, wait for an active session to finish.Headers: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailable, feature_unavailableHeaders: X-Request-Id | Error |
curl -X POST "https://api.baian.ai/v1/sessions" \
-H "Authorization: Bearer $BAIAN_API_KEY" \
-H "Idempotency-Key: <idempotency-key>" \
-H "Content-Type: application/json" \
-d '{
"external_session_id": "class-2026-11-02-fiqh-101",
"input_lang": "en",
"additional_input_langs": [
"ar"
],
"output_langs": [],
"quran_refs": true,
"hadith_refs": false,
"metadata": {}
}'List sessions (newest first)
get /sessions
Scope sessions:read. Deleted sessions are omitted.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
statusoptional | query | Status | |
external_session_idoptional | query | string | |
limitoptional | query | integer | 1 to 100Default: 25 |
cursoroptional | query | string | next_cursor from the previous page. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | PageHeaders: X-Request-Id | SessionPage |
| 400 | Error. error.code is one of: validation_failedHeaders: X-Request-Id | Error |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl "https://api.baian.ai/v1/sessions" \
-H "Authorization: Bearer $BAIAN_API_KEY"Get a session
get /sessions/{id}
Scope sessions:read.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | SessionHeaders: X-Request-Id | SessionEnvelope |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 404 | Error. error.code is one of: not_foundHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl "https://api.baian.ai/v1/sessions/$ID" \
-H "Authorization: Bearer $BAIAN_API_KEY"Delete an ended session
delete /sessions/{id}
Scope sessions:write. Removes events, transcript, references, metadata and the external class identifier. The internal usage and retry record described under Retention remains. After deletion the session returns 404, and a create request with the same Idempotency-Key returns 410 session_deleted.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | DeletedHeaders: X-Request-Id | Deleted |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 404 | Error. error.code is one of: not_foundHeaders: X-Request-Id | Error |
| 409 | Error. error.code is one of: session_not_ended, cleanup_pendingHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl -X DELETE "https://api.baian.ai/v1/sessions/$ID" \
-H "Authorization: Bearer $BAIAN_API_KEY"Stop a session
post /sessions/{id}/stop
Scope sessions:write. Idempotent. The session usually moves to ending while Baian finishes the remaining audio, then to ended. If dispatch has started, a session can still be ending before audio arrives. If dispatch has not started, Stop ends it immediately. Keep polling events until terminal is true.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
| 202 | Stopping or already terminalHeaders: X-Request-Id | SessionEnvelope |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 404 | Error. error.code is one of: not_foundHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl -X POST "https://api.baian.ai/v1/sessions/$ID/stop" \
-H "Authorization: Bearer $BAIAN_API_KEY"Stream the current source transcript preview
get /sessions/{id}/partials
Scope events:read. Connect from your server, keeping the API key private. Each transcript.partial event replaces the current preview. Its data contains segment_id, language, text, and revision. An empty text clears that segment. Replace the preview when transcript.final with the same segment_id arrives from /events. Ignore previews for a segment already finalized. Reopen the stream after an ordinary close (up to 25 seconds per connection). A new connection receives the current preview if available. Previews can be dropped and are never included in /transcript or the event cursor.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Server-sent events with provisional source text. | — |
| 204 | Class ended. Keep reading /events until terminal is true. | — |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 404 | Error. error.code is one of: not_foundHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limited, too_many_readersHeaders: X-Request-Id | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailable, feature_unavailableHeaders: X-Request-Id | Error |
curl "https://api.baian.ai/v1/sessions/$ID/partials" \
-H "Authorization: Bearer $BAIAN_API_KEY"Teacher audio
Issue a new source (microphone) token
post /sessions/{id}/source-token
Scope sessions:write. Use this to reconnect the teacher. Available only while the session is created or live.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | TokenHeaders: X-Request-Id | SourceEnvelope |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 404 | Error. error.code is one of: not_foundHeaders: X-Request-Id | Error |
| 409 | Error. error.code is one of: session_not_activeHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl -X POST "https://api.baian.ai/v1/sessions/$ID/source-token" \
-H "Authorization: Bearer $BAIAN_API_KEY"Results
Read events (replayable, long-poll)
get /sessions/{id}/events
Scope events:read. Returns events with seq greater than after, in order. With wait above 0, the request waits up to wait seconds for at least one event or for the session to finish. Save next_after and pass it as after on the next request. terminal becomes true once the session is ended, failed or expired and every event has been returned.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) | |
afteroptional | query | integer | 0 to 9007199254740991Default: 0 |
limitoptional | query | integer | 1 to 500Default: 100 |
waitoptional | query | integer | 0 to 25Default: 0 |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | EventsHeaders: X-Request-Id | EventPage |
| 400 | Error. error.code is one of: validation_failedHeaders: X-Request-Id | Error |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 404 | Error. error.code is one of: not_foundHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl "https://api.baian.ai/v1/sessions/$ID/events" \
-H "Authorization: Bearer $BAIAN_API_KEY"Assembled transcript
get /sessions/{id}/transcript
Scope sessions:read.
Parameters
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string (uuid) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | TranscriptHeaders: X-Request-Id | Transcript |
| 401 | Error. error.code is one of: unauthorizedHeaders: X-Request-Id | Error |
| 403 | Error. error.code is one of: scope_forbidden, org_suspendedHeaders: X-Request-Id | Error |
| 404 | Error. error.code is one of: not_foundHeaders: X-Request-Id | Error |
| 429 | Error. error.code is one of: rate_limitedHeaders: X-Request-Id, Retry-After | Error |
| 500 | Error. error.code is one of: internal_errorHeaders: X-Request-Id | Error |
| 503 | Error. error.code is one of: partner_api_disabled, rate_limiter_unavailableHeaders: X-Request-Id | Error |
curl "https://api.baian.ai/v1/sessions/$ID/transcript" \
-H "Authorization: Bearer $BAIAN_API_KEY"Schemas
Common
Error
| Field | Type | Description |
|---|---|---|
errorrequired | object | |
error.coderequired | string | Stable machine-readable code. |
error.messagerequired | string | |
error.request_idrequired | string | |
error.session_idoptional | string | Included with session_already_active errors. |
Status
stringValues: "created", "live", "ending", "ended", "failed", "expired"
Languages
| Field | Type | Description |
|---|---|---|
inputrequired | object[] | |
input[].coderequired | string | |
input[].namerequired | string | |
outputrequired | object[] | |
output[].coderequired | string | |
output[].namerequired | string | |
output[].text_onlyrequired | boolean | Text output only (no speech). |
limitsrequired | object | |
limits.max_output_langsoptional | 5 | |
limits.max_additional_input_langsoptional | 3 | |
featuresoptional | object | |
features.hadith_refsoptional | boolean | Whether your organization can request hadith_refs=true in this environment. |
notesrequired | object |
Allowance
| Field | Type | Description |
|---|---|---|
starts_atrequired | string (date-time) | |
ends_atrequired | string (date-time) | |
allowance_secondsrequired | number | |
source_secondsrequired | number | |
remaining_secondsrequired | number | at least 0 |
runtime_allowance_secondsoptional | number | |
runtime_secondsoptional | number | |
runtime_remaining_secondsoptional | number | at least 0 |
activerequired | boolean |
Sessions
CreateSession
| Field | Type | Description |
|---|---|---|
external_session_idrequired | string | Your own identifier, for example a class ID. Only one open session can use a given value.1 to 200 characters |
input_langrequired | string | Main spoken language (see /languages). |
additional_input_langsoptional | string[] | null | Other spoken languages. Use ["ar"] for English teaching with Arabic quotations. Omit or send null for none. After normalization, duplicates and the main language are removed. Up to 3 additional languages may remain. |
output_langsoptional | string[] | null | Translation targets. Omit, send null or leave empty for a transcript only. Up to 5 distinct supported languages after normalization. |
quran_refsoptional | boolean | Detect Quran quotations in Arabic-script source text, whatever the main language.Default: true |
hadith_refsoptional | boolean | Match Arabic hadith quotations against a fixed version of the six-book corpus. For new sessions, request this only when /languages features.hadith_refs is true. Returns 503 feature_unavailable if disabled in this environment or 403 hadith_not_enabled if disabled for your organization. A match says nothing about authenticity or grading.Default: false |
metadataoptional | object | null | Up to 4 KB. Omission or null stores an empty object. Deleted with the class content. |
Source
| Field | Type | Description |
|---|---|---|
livekit_urlrequired | string | |
tokenrequired | string | LiveKit token. Use it to join the room and publish one microphone track only. It must be used to join within 15 minutes. |
identityrequired | string | |
expires_atrequired | string (date-time) |
SourceEnvelope
| Field | Type | Description |
|---|---|---|
sourcerequired | Source |
CreateSessionResponse
SessionEnvelope
| Field | Type | Description |
|---|---|---|
sessionrequired | Session |
SessionPage
| Field | Type | Description |
|---|---|---|
sessionsrequired | Session[] | |
next_cursorrequired | string | null |
Deleted
| Field | Type | Description |
|---|---|---|
deletedrequired | true | |
idrequired | string (uuid) |
Session
| Field | Type | Description |
|---|---|---|
idrequired | string (uuid) | |
external_session_idrequired | string | |
statusrequired | Status | Values: "created", "live", "ending", "ended", "failed", "expired" |
input_langrequired | string | |
additional_input_langsoptional | string[] | |
output_langsrequired | string[] | |
quran_refsrequired | boolean | |
hadith_refsoptional | boolean | Default: false |
metadataoptional | object | |
created_atrequired | string (date-time) | |
media_ready_atoptional | string (date-time) | null | |
last_audio_atoptional | string (date-time) | null | |
stop_requested_atoptional | string (date-time) | null | |
ended_atoptional | string (date-time) | null | |
end_reasonoptional | string | null | Values: "stopped", "source_lost", "max_duration", "expired", "agent_lost", "failed", "access_revoked", "usage_limit", "runtime_limit", "usage_period_ended", "translation_disabled" |
completenessoptional | string | null | Values: "complete", "incomplete" |
missing_segment_idsoptional | string[] | |
failure_codeoptional | string | null | Values: "provisioning_failed", "provisioning_abandoned" |
source_secondsrequired | number | Processed source audio seconds (excludes setup and gaps). |
max_session_secondsoptional | integer | |
max_elapsed_secondsoptional | integer | Maximum elapsed time from created_at, including setup and pauses. |
stop_reasonoptional | string | null | |
last_event_seqrequired | integer | |
created_viaoptional | string | Values: "api_key", "console" |
created_by_key_prefixoptional | string | null |
Results and events
QuranReference
| Field | Type | Description |
|---|---|---|
refrequired | string | "S:A" or "S:A-B", consistent with surah/ayah fields. |
surahrequired | integer | 1 to 114 |
ayah_startrequired | integer | at least 1 |
ayah_endrequired | integer | at least 1 |
matched_textoptional | string | |
raw_spanoptional | integer[] | Offsets in the final source text of this segment. Start is inclusive and end is exclusive. Count Unicode code points from zero, including vowel marks. In JavaScript, use Array.from(text).slice(start, end).join(''). Highlight only when 0 ≤ start < end ≤ the segment length in code points and the selected text equals matched_text. If the range is absent and the words appear twice, show the reference without a highlight.at most 2 items |
TranscriptFinal
A segment Baian has committed. It is sent once and never changed. Its words come from speech recognition and can include words that were not yet confirmed when it was committed.
| Field | Type | Description |
|---|---|---|
segment_idrequired | string | |
textrequired | string | |
languagerequired | string | The session input_lang, even when the segment contains another language. For example, Arabic quotation text in an English class still has language en. Baian does not identify the language of each segment. |
start_msoptional | integer | null | |
end_msoptional | integer | null |
TranslationFinal
| Field | Type | Description |
|---|---|---|
segment_idrequired | string | |
languagerequired | string | |
statusoptional | "complete" | |
textrequired | string |
TranslationFailed
| Field | Type | Description |
|---|---|---|
segment_idrequired | string | |
languagerequired | string | |
statusoptional | "failed" | |
reasonoptional | string | null |
QuranReferences
Full Quran reference snapshot for one segment. Later events replace this list; order by the outer event seq.
| Field | Type | Description |
|---|---|---|
reference_revisionoptional | integer | Optional snapshot revision, starting at zero when supported. Use the outer event seq for ordering and duplicate handling.0 to 9007199254740991 |
reference_policy_versionoptional | string | Version of the reference memory and update policy, when supported. Separate from selector_version and corpus_version.1 to 128 characters |
segment_idrequired | string | |
statusrequired | string | accepted includes at least one reference; other statuses include none. failed makes the session incomplete.Values: "accepted", "abstained", "failed", "no_candidates" |
referencesrequired | QuranReference[] | at most 50 items |
reasonoptional | string | null | |
selector_versionoptional | string | null |
HadithReference
| Field | Type | Description |
|---|---|---|
record_idrequired | string | Edition-specific ID, for example ara-bukhari:1. Read it together with corpus_version. It is not a universal hadith number. |
collectionrequired | string | Values: "bukhari", "muslim", "abudawud", "tirmidhi", "nasai", "ibnmajah" |
editionrequired | string | Named source edition, for example ara-muslim. |
record_numberrequired | string | Record number in the source dataset, which may differ from the usual citation number. In Muslim it is a running index. Do not display it as a hadith number. Use citation when it is present.at most 40 characters |
citationoptional | object | null | Hadith number to display, when one was checked. Absent or null means no checked number exists for this record: show the collection and canonical_quote without a number. |
| Print edition citationBaian found this record's text in a digital transcription of the named print edition, and that edition gives it this number. It is not a check against printed pages, and it says nothing about authenticity or grading. | ||
citation.numberrequired | string | Number of this hadith in the named print edition.at most 40 characters |
citation.schemerequired | "print_edition" | |
citation.editionrequired | string | Name of the print edition that gives this number.1 to 200 characters |
citation.verificationrequired | "edition_text_match" | |
| Unverified dataset citationSent by older sessions. The number was copied from the source dataset and has not been checked against any edition. Treat it as unverified. | ||
citation.numberrequired | string | Alternative number copied exactly from the source, including fractional variants. It has not been independently verified.at most 40 characters |
citation.schemerequired | "upstream_arabicnumber" | |
citation.verificationrequired | "unverified" | |
matched_textrequired | string | Exact substring of the raw transcript. It can contain speech recognition errors.1 to 5000 characters |
canonical_quoterequired | string | Excerpt copied from the matching record in the fixed corpus. It is separate from the speech recognition text.1 to 10000 characters |
match_typerequired | string | How the match compares with the normalized transcript text. It does not prove the exact spoken wording or authenticity.Values: "verbatim", "near_verbatim", "fragment" |
raw_spanoptional | integer[] | Offsets in the final source text of this segment. Start is inclusive and end is exclusive. Count Unicode code points from zero, including vowel marks. In JavaScript, use Array.from(text).slice(start, end).join(''). Highlight only when 0 ≤ start < end ≤ the segment length in code points and the selected text equals matched_text. If the range is absent and the words appear twice, show the reference without a highlight.at most 2 items |
HadithReferences
Full hadith reference snapshot for one segment. Later events replace this list; order by the outer event seq.
| Field | Type | Description |
|---|---|---|
reference_revisionoptional | integer | Optional snapshot revision, starting at zero when supported. Use the outer event seq for ordering and duplicate handling.0 to 9007199254740991 |
reference_policy_versionoptional | string | Version of the reference memory and update policy, when supported. Separate from selector_version and corpus_version.1 to 128 characters |
segment_idrequired | string | |
statusrequired | string | Only accepted includes references. If a session requested hadith matching, a failed or missing result makes it incomplete.Values: "accepted", "abstained", "failed", "no_candidates" |
referencesrequired | HadithReference[] | at most 20 items |
reasonoptional | string | null | |
selector_versionrequired | string | 1 to 128 characters |
corpus_versionrequired | string | null |
SessionGap
Sent when teacher audio resumes after the source reconnected or processing restarted. Not sent for pauses within continuous audio.
| Field | Type | Description |
|---|---|---|
from_msrequired | integer | |
to_msrequired | integer | |
reasonoptional | string | null |
SessionTerminal
| Field | Type | Description |
|---|---|---|
statusrequired | string | Values: "ended", "failed", "expired" |
reasonrequired | string | Values: "stopped", "source_lost", "max_duration", "expired", "agent_lost", "failed", "access_revoked", "usage_limit", "runtime_limit", "usage_period_ended", "translation_disabled" |
completenessrequired | string | Values: "complete", "incomplete" |
missing_segment_idsrequired | string[] | |
unacked_event_countoptional | integer | |
detailoptional | string | null | |
codeoptional | string | Only on session.failed. |
source_secondsrequired | number |
Event
| Field | Type | Description |
|---|---|---|
idrequired | string | evt_<session_id>_<seq> |
seqrequired | integer | at least 1 |
typerequired | string | Values: "session.created", "session.live", "transcript.final", "translation.final", "translation.failed", "quran.references", "hadith.references", "session.gap", "session.ended", "session.failed" |
session_idrequired | string (uuid) | |
external_session_idrequired | string | |
created_atrequired | string (date-time) | |
datarequired | object | Shape depends on type. |
One of:
objectobjectobjectobjectobjectobjectobjectobjectobjectobject
EventPage
TranscriptSegment
| Field | Type | Description |
|---|---|---|
segment_idrequired | string | |
textoptional | string | null | |
languageoptional | string | null | |
start_msoptional | integer | null | |
end_msoptional | integer | null | |
translationsrequired | object | |
translation_failuresrequired | object[] | |
translation_failures[].languagerequired | string | |
translation_failures[].reasonoptional | string | null | |
quran_statusoptional | string | null | Values: "accepted", "abstained", "failed", "no_candidates" |
quran_reasonoptional | string | null | |
quran_referencesrequired | QuranReference[] | |
selector_versionoptional | string | null | |
hadith_statusoptional | string | null | Values: "accepted", "abstained", "failed", "no_candidates" |
hadith_reasonoptional | string | null | |
hadith_referencesoptional | HadithReference[] | |
hadith_selector_versionoptional | string | null | |
hadith_corpus_versionoptional | string | null |
Transcript
| Field | Type | Description |
|---|---|---|
session_idrequired | string | |
external_session_idrequired | string | |
statusrequired | Status | Values: "created", "live", "ending", "ended", "failed", "expired" |
completenessrequired | string | null | Values: "complete", "incomplete" |
missing_segment_idsrequired | string[] | |
output_langsrequired | string[] | |
segmentsrequired | TranscriptSegment[] |