Standard REST API for capturing SMS and WhatsApp OTP payloads in your sandboxes.
Captures an OTP message payload, resolves destination number to your sandbox project, stores the message, and extracts verification codes.
| Header | Type | Description |
|---|---|---|
| Authorization | string (required) | Bearer token containing your project API key (e.g. Bearer otptrap_live_...) |
| Content-Type | string (required) | application/json |
| Field | Type | Description |
|---|---|---|
| to | string (required) | Virtual testing number in E.164 format (e.g. +6281234567890) |
| channel | string (required) | Must be either "sms" or "whatsapp" |
| message | string (required) | The full message text (max 2,000 characters) |
| sender | string (optional) | Sender name or identifier (e.g. “MyApp”) |
| metadata | object (optional) | Custom JSON payload (max 4KB size) |
curl -X POST https://otp.gas.pm/api/v1/messages \
-H "Authorization: Bearer otptrap_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"to": "+6281234567890",
"channel": "sms",
"message": "Your verification code is 482193",
"sender": "MyApp",
"metadata": { "requestId": "req_1001" }
}'Already using an official SDK like Twilio, Vonage, Meta WhatsApp, Bird, or unofficial gateways like Fonnte?
OTP TRAP provides native endpoint emulation. You can simply change your provider base URL (e.g. from https://api.twilio.com to https://otp.gas.pm/api/provider/twilio) without modifying your payload structure or auth parameters.
POST https://otp.gas.pm/api/provider/twilio/2010-04-01/Accounts/{AccountSid}/Messages.json
| Status | Code | Meaning |
|---|---|---|
201 Created | captured | Message successfully logged to project inbox |
401 Unauthorized | INVALID_API_KEY | Missing, invalid, or revoked API key |
404 Not Found | DESTINATION_NOT_FOUND | The recipient number is not assigned to this project sandbox |
422 Unprocessable | VALIDATION_ERROR | Malformed payload or non-E.164 phone format |
429 Rate Limited | RATE_LIMITED | Exceeded 120 requests/min per API key |