API Reference

Message Ingestion API

Standard REST API for capturing SMS and WhatsApp OTP payloads in your sandboxes.

OpenAPI 3.0 Spec
POST
/api/v1/messages

Captures an OTP message payload, resolves destination number to your sandbox project, stores the message, and extracts verification codes.

Headers
HeaderTypeDescription
Authorizationstring (required)Bearer token containing your project API key (e.g. Bearer otptrap_live_...)
Content-Typestring (required)application/json
Request Body Fields
FieldTypeDescription
tostring (required)Virtual testing number in E.164 format (e.g. +6281234567890)
channelstring (required)Must be either "sms" or "whatsapp"
messagestring (required)The full message text (max 2,000 characters)
senderstring (optional)Sender name or identifier (e.g. “MyApp”)
metadataobject (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" }
  }'
Response Status & Error Codes
StatusCodeMeaning
201 Created
capturedMessage successfully logged to project inbox
401 Unauthorized
INVALID_API_KEYMissing, invalid, or revoked API key
404 Not Found
DESTINATION_NOT_FOUNDThe recipient number is not assigned to this project sandbox
422 Unprocessable
VALIDATION_ERRORMalformed payload or non-E.164 phone format
429 Rate Limited
RATE_LIMITEDExceeded 120 requests/min per API key