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 fieldTypeDescription
filefileRequired. The media file to upload
poolNumberIdstringRequired. 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

StatusCodeDescription
400FILE_TOO_LARGEFile exceeds the 25 MB limit
403BYON_ONLYAn ak_ App key is required (account pk_ rejected)
422NO_CREDENTIALSThe 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
FieldTypeDescription
tokenstringRequired. The single-use signup JWT
codestringRequired. 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
}
FieldTypeDescription
ticketstringLets the hosted page resume this signup. Valid for 7 days, so the customer can reopen the page and finish later
attemptsLeftnumberRegistration attempts left
blockedUntilstring | nullISO 8601 time when retries resume, when status is blocked
registrationErrorstring | nullWhy registration didn't finish, in English
registrationErrorCodestring | nullStable 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" }
StatuscodeWhenExample message
400link_expiredMissing or invalid token"Missing or invalid token"
400invalid_requestMissing or invalid code, or invalid JSON"Missing or invalid authorization code"
401link_expiredToken invalid, expired (15-min TTL), or already used"Invalid or expired token", "Token already used"
403subscription_requiredApp owner has no active subscription"App owner subscription required to onboard numbers"
404number_not_foundThe token's App no longer exists"App not found"
409number_already_connectedPhone number already connected to an App"This phone number is already connected to an App"
409number_in_poolPhone number already in the pool"This phone number is already in the pool"
500onboarding_failedUnexpected 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

TermMeaning
AppYour application in PipesBot. It owns your BYON numbers, holds one API key (ak_) and one webhook URL. See Creating an App
ak_ keyAn App API key. Use it for everything BYON: sending, templates, number health, WebSocket
pk_ keyYour account API key. Used with sandbox numbers
poolNumberIdThe 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
BYONBring Your Own Number: your own or your customers' WhatsApp Business numbers, connected through Embedded Signup
WABAWhatsApp Business Account. Owned by your customer's Meta business portfolio. Templates and Meta billing live there
CoexistenceRunning the same number in the WhatsApp Business app and on the Cloud API. See Coexistence
BSUIDBusiness-scoped user ID, used by WhatsApp for users who hide their phone number behind a username. See BSUIDs
Sandbox numberA shared PipesBot number for testing and light personal use (5 sends/day). Formerly called "pool number". See Sandbox

On this page