OpenAPI & Agent Access
This page is the entry point for automated tools. The web pages explain business semantics; machines should read the OpenAPI spec and JSON Schemas first rather than inferring types from examples.
Machine-readable surface
| Resource | Location | Best for |
|---|---|---|
| OpenAPI 3.1 (YAML) | /openapi.yaml | Code generation, IDE tooling, contract validation — the primary artifact |
| OpenAPI 3.1 (JSON) | /openapi.json | Loading directly from a program instead of a generator CLI |
| Agent index | /llms.txt | A short table of contents an agent can read first to decide what to fetch next |
| Full Markdown corpus | /llms-full.txt | Every page concatenated — roughly 100K tokens, so only load it whole if your agent's context window can absorb that; otherwise prefer llms.txt plus individual pages |
| Single-page Markdown | "View Markdown" at the top right of any page, or /markdown/<page-id>.md | Loading just the one page you're working from, to keep context usage down |
| Webhook JSON Schemas | see below | Validating or generating types for inbound webhook payloads |
API base URL: https://api.bluehola.com.
Using this with an AI coding agent
Quick start
- Point your agent at
https://docs.bluehola.com/llms.txtfirst — it is small (under 50 lines) and links to the guides and endpoint pages that actually matter, rather than dumping the whole corpus into context. - Have it fetch
https://docs.bluehola.com/openapi.yamlbefore writing any request/response types. The spec is the source of truth for field names, required-ness and enums; the prose guides are the source of truth for asynchronous behaviour, retries and billing — neither one alone is complete (see Contract precedence). - For a single task against one part of the API, skip the full corpus and load only the relevant endpoint page's Markdown (the "View Markdown" link at the top of every page) plus the OpenAPI spec. That is usually enough context to implement one feature correctly.
Example prompts
These are meant to be copied into Claude Code, Codex, Cursor or similar tools more or less as-is.
Read https://docs.bluehola.com/openapi.yaml and generate a TypeScript client
for POST /v1/messages. Use the MessageRequest oneOf/discriminator on `type`
to produce a discriminated union instead of one loose object type. Every
call must accept an idempotencyKey and send it as the Idempotency-Key
header (see https://docs.bluehola.com/markdown/reference/idempotency.md for
why this is required, not optional). Do not invent fields that aren't in
the schema.
Read https://docs.bluehola.com/markdown/guides/webhook-integration.md and
implement an Express handler for our webhook endpoint. It must verify
X-Webhook-Signature-256 as an HMAC-SHA256 of the *raw* request body before
parsing JSON, reject on mismatch, and dispatch on X-Webhook-Event using the
JSON Schemas at https://docs.bluehola.com/schemas/webhooks/ for each event's
shape. De-duplicate on X-Delivery-Id, since delivery is at-least-once.
Read https://docs.bluehola.com/markdown/guides/error-codes.md and write a
fetch wrapper for our API client. Retry only when the response body's
error.retryable is true, using exponential backoff with jitter. Do not
retry on any other error, and do not reuse this logic for webhook
delivery retries — the webhook retry schedule is fixed and controlled by
the platform, not the caller (see
https://docs.bluehola.com/markdown/reference/idempotency.md).
Each prompt links back to the guide it depends on deliberately: the OpenAPI spec alone tells an agent what a request looks like, not when to send it, when to retry it, or how billing settles — that context lives in the linked guides, and an agent that skips them tends to produce code that compiles but is subtly wrong (retrying non-retryable errors, missing the idempotency key, or double-handling webhook retries the platform already handles).
Contract precedence
When different materials appear to disagree, resolve it in this order:
- OpenAPI / webhook JSON Schema: field types, required relationships, enums and response structures.
- The relevant endpoint page: asynchronous behaviour, idempotency, state machines, billing and recovery.
- Example code: for getting started only — never treat it as a complete schema.
POST /v1/messages already uses oneOf and discriminator to describe each message type; relationships such as media id / link being mutually exclusive, and at least one of to / toUserId being required, are encoded in the schema too. type may be omitted and is treated as text, but new integrations should always send it explicitly.
What the spec doesn't cover
The OpenAPI document describes shapes, not behaviour. Before generating code against an endpoint, an agent should also have read whichever of these apply:
| Concern | Where it's documented |
|---|---|
Whether a 202 means delivered, and how to track the real outcome | Sending Messages & Tracking Status |
| Which failures are safe to retry, and which aren't | Error Codes |
| Idempotency keys, at-least-once webhook delivery, the fixed webhook retry schedule | Idempotency & Retries |
| Request-rate and size limits, and what happens past each one | Rate Limits & Quotas |
| When a charge is settled versus reversed | Billing & Credit Line |
None of this is encoded in the schema's types — it's business behaviour that only exists in prose, and skipping it is the most common way generated code ends up technically-correct but wrong in production.
Webhook schemas
Webhooks ship a separate JSON Schema per event type:
messagestatuschangeprobejob.completedjob.failedusage.updatedwebhook.verificationcontact.identity_changedcontact.info_sharedmarketing.preference_updatedphone_number.username_updated
The receiving side must still verify the raw request body's signature as described in Webhook Integration before performing schema validation and event dispatch.
Language of the specification
Every description in openapi.yaml and openapi.json is translated to English during synchronization, including request and response fields, parameters, component schemas and error responses. An agent can use these descriptions for English code comments. Some upstream summary and x-notes text still appears in Chinese; use the English endpoint pages for behavioral guidance. Field names, types, enums and required relationships are unchanged.
How this is kept up to date
The public specification is synced from the API service's /portal/openapi.json; this docs repository only fills in precise schemas still missing from the outward-facing machine contract. After updating, maintainers run:
npm run openapi:sync
npm run build
The build generates llms.txt, the full Markdown corpus and a standalone Markdown file for every page; the docs check blocks any release that is missing a key message schema, a webhook schema or a download entry point.