API Reference
Health checks and low-level endpoints (Meta media upload, embedded-signup completion).
Low-level and operational endpoints that support the main messaging, webhook, and BYON flows.
Health checks
Two unauthenticated liveness endpoints return 200 with { "status": "ok" }. No API key is required. Use them for uptime monitoring.
GET /v1/messages/health
GET /v1/media/health{ "status": "ok" }POST /v1/media/upload/meta
Uploads a file to Meta's resumable upload API and returns a template media handle for use in template HEADER components. This is a BYON / App endpoint — it requires an ak_ App key. Account (pk_) keys are rejected with 403 BYON_ONLY.
POST /v1/media/upload/meta
Authorization: Bearer ak_your_app_key
Content-Type: multipart/form-data| Form field | Type | Description |
|---|---|---|
file | file | Required. The media file to upload |
poolNumberId | string | Required. BYON number whose WABA credentials are used |
- Max file size: 25 MB. Larger files return
400 FILE_TOO_LARGE. - The endpoint proxies Meta's two-step resumable upload and returns Meta's handle.
- This endpoint is not rate-limited and emits no rate-limit headers.
Response
{ "handle": "h:abc123..." }Reference the returned handle in a template header's example.header_handle. See Template Management.
Errors
| Status | Code | Description |
|---|---|---|
400 | FILE_TOO_LARGE | File exceeds the 25 MB limit |
403 | BYON_ONLY | An ak_ App key is required (account pk_ rejected) |
422 | NO_CREDENTIALS | The BYON number has no Meta access token configured |
The response body uses a nested shape: { "error": { "code": "...", "message": "..." } }. Raw errors returned by Meta are passed through unchanged.
POST /v1/apps/onboard
Completes Meta Embedded Signup. This is a public endpoint (no API key) — it is called by the hosted signup page after Meta returns an authorization code. The token is the one-time JWT minted by POST /v1/apps/token.
POST /v1/apps/onboard
Content-Type: application/json| Field | Type | Description |
|---|---|---|
token | string | Required. The single-use signup JWT |
code | string | Required. Meta authorization code from the signup dialog |
On success the server: verifies the JWT and consumes its single-use JTI, checks the App owner has an active subscription, rejects duplicate phone numbers, exchanges the code with Meta, discovers the WABA and phone details, creates the BYON number, and subscribes the WABA to webhooks (rolling back the number if the subscription fails).
Response
Returns 201 in both cases below. When the number is ready to use:
{
"status": "active",
"numberId": "pn_abc123",
"phoneNumber": "+1 555-123-4567",
"redirectUrl": "https://yourapp.com/onboarding/complete"
}On the hosted page, the user is then redirected to redirectUrl with ?numberId=<id>&phone=<number> appended. A number.onboarded webhook is also fired to the App's webhook URL.
When the number was created but needs one more step, status is pending, needs_pin or blocked (see number statuses), redirectUrl is null, and the response adds the fields the hosted page needs to finish:
{
"status": "needs_pin",
"numberId": "pn_abc123",
"phoneNumber": "+1 555-123-4567",
"redirectUrl": null,
"ticket": "<JWT>",
"attemptsLeft": 9,
"blockedUntil": null,
"registrationError": null,
"registrationErrorCode": null
}| Field | Type | Description |
|---|---|---|
ticket | string | Lets the hosted page resume this signup. Valid for 7 days, so the customer can reopen the page and finish later |
attemptsLeft | number | Registration attempts left |
blockedUntil | string | null | ISO 8601 time when retries resume, when status is blocked |
registrationError | string | null | Why registration didn't finish, in English |
registrationErrorCode | string | null | Stable code for registrationError: registration_failed or registration_retry_later |
The customer stays on the hosted page until the number is ready. The redirect and the number.onboarded webhook happen at that point.
Errors
Errors return a flat body with the HTTP status. error is always in English, and code is a stable value you can match on:
{ "error": "Token already used", "code": "link_expired" }| Status | code | When | Example message |
|---|---|---|---|
400 | link_expired | Missing or invalid token | "Missing or invalid token" |
400 | invalid_request | Missing or invalid code, or invalid JSON | "Missing or invalid authorization code" |
401 | link_expired | Token invalid, expired (15-min TTL), or already used | "Invalid or expired token", "Token already used" |
403 | subscription_required | App owner has no active subscription | "App owner subscription required to onboard numbers" |
404 | number_not_found | The token's App no longer exists | "App not found" |
409 | number_already_connected | Phone number already connected to an App | "This phone number is already connected to an App" |
409 | number_in_pool | Phone number already in the pool | "This phone number is already in the pool" |
500 | onboarding_failed | Unexpected failure | "We couldn't connect this number. Please try again." |
A failure outside this endpoint's own handling can come back without a code, so treat the field as optional.
Glossary
| Term | Meaning |
|---|---|
| App | Your application in PipesBot. It owns your BYON numbers, holds one API key (ak_) and one webhook URL. See Creating an App |
ak_ key | An App API key. Use it for everything BYON: sending, templates, number health, WebSocket |
pk_ key | Your account API key. Used with sandbox numbers |
poolNumberId | The ID (an opaque string) of any number connected to PipesBot, BYON numbers included. The /v1/pool-numbers/{id} paths take it, and both the number.onboarded event and /v1/numbers call it numberId. Same value |
| BYON | Bring Your Own Number: your own or your customers' WhatsApp Business numbers, connected through Embedded Signup |
| WABA | WhatsApp Business Account. Owned by your customer's Meta business portfolio. Templates and Meta billing live there |
| Coexistence | Running the same number in the WhatsApp Business app and on the Cloud API. See Coexistence |
| BSUID | Business-scoped user ID, used by WhatsApp for users who hide their phone number behind a username. See BSUIDs |
| Sandbox number | A shared PipesBot number for testing and light personal use (5 sends/day). Formerly called "pool number". See Sandbox |