Skip to main content
Use Mocean through Corsair: one client, typed API calls. Create an API token in the Mocean dashboard under API Account and store it as the account key. Requests authenticate with Authorization: Bearer, and every /rest/2 call asks Mocean for JSON, since the default is XML.
  • Errors. Mocean answers many failures with HTTP 202 and a body status, and the same number means different things per API: 1 is a bad token for SMS but throttling for Verify. The plugin throws core’s ApiError with the HTTP status the body status means: 429 throttled (retried with backoff), 401 bad token, 402 out of credit, 503 system down, 500 system error, 400 for a bad request. Some failures come as real HTTP 400/404 with the same { status, err_msg } body; those keep their HTTP status. The original code is on error.body.status. Error messages are URL-decoded and have phone numbers masked; request bodies are never kept.
  • Sends report per receiver. sms.send returns one row per receiver with its own status and msgid; a failed row (28 invalid number) does not fail the others. voice.dial does the same in calls[].
  • Costs. Sends, verify requests and resends, calls and WhatsApp messages spend credit and are destructive. lookup.request also spends prepaid credit but only returns data, so it stays read like other metered reads.
  • Numbers and prices. price and credit_deducted come back as numbers although the reference says strings; status codes on voice routes can come back as strings. mocean_mcc and mocean_mnc go together (either one alone answers status 46).
  • Scheduling is Malaysia time. mocean_schedule is YYYY-MM-DD hh:mm:ss in GMT+8.
  • Downloads. voice.recording and whatsapp.downloadMedia return the file (base64 with its type and size). A status answer instead of a file becomes an error.
  • Callbacks are not received. Delivery reports, inbound SMS, call events, WhatsApp events and asynchronous number lookups go to URLs you host; Mocean does not sign them, and this plugin has no webhooks. The number lookup result arrives as a PUT to mocean_nl_url; delivery reports arrive as a PUT to mocean_dlr_url.
  • WhatsApp and voice need a WhatsApp Business sender or voice enabled on the Mocean account; without it those routes answer 401 or 403.
What you get:
  • 20 typed API operations

Setup

1

Install

2

Add the plugin

corsair.ts
With multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.
3

Choose authentication

4

Connect a tenant

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.

Example API calls

Read the account balance
Send an SMS
See the full list on the API page.

What’s next

API reference

Every mocean.api.* operation with input and output types.

Connect / OAuth

createLink, Hub delivery, and tenant connect flows.

Use with agents

Expose this plugin’s operations as MCP tools.