Docs
Api reference

Twilio

POST
/api/twilio

Request Body

application/x-www-form-urlencoded

TypeScript Definitions

Use the request body type in TypeScript.

body?string

URL-encoded form data from Twilio

Response Body

application/json

curl -X POST "https://example.com/api/twilio" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'string'
{  "success": true,  "message": "string"}
POST
/api/twilio/send-message

Sends an SMS message from a restaurant phone number. Restricted to Super Admin/Agent. Automatically resolves and uses the restaurant's custom credentials or falls back to platform credentials with error 21606 handling.

Header Parameters

x-agent-secret*string

Super Admin/Agent secret key

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/twilio/send-message" \  -H "x-agent-secret: string" \  -H "Content-Type: application/json" \  -d '{    "from": "string",    "to": "string",    "message": "string"  }'
{  "success": true,  "messageSid": "string",  "fallbackUsed": true}
GET
/api/twilio/my-available-numbers

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/api/twilio/my-available-numbers"
{  "success": true,  "numbers": [    {      "phone_number": "string",      "friendly_name": "string",      "region": "string",      "locality": "string",      "iso_country": "string",      "capabilities": {        "voice": true,        "sms": true,        "mms": true      }    }  ],  "mock": true}
POST
/api/twilio/my-purchase-number

Provisions a phone number on the restaurant's own Twilio account and saves it to their profile.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/api/twilio/my-purchase-number" \  -H "Content-Type: application/json" \  -d '{    "phoneNumber": "string"  }'
{  "success": true,  "phone_number": "string",  "friendly_name": "string",  "sid": "string"}
GET
/api/twilio/my-incoming-numbers

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/api/twilio/my-incoming-numbers"
{  "success": true,  "numbers": [    {      "phone_number": "string",      "friendly_name": "string",      "sid": "string"    }  ]}
GET
/api/twilio/available-numbers

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/api/twilio/available-numbers"
{  "success": true,  "numbers": [    {      "phone_number": "string",      "friendly_name": "string",      "region": "string",      "locality": "string",      "iso_country": "string",      "capabilities": {        "voice": true,        "sms": true,        "mms": true      }    }  ],  "mock": true}
POST
/api/twilio/purchase-number

Provisions a phone number on Twilio and configures VoiceUrl/SmsUrl from server environment variables.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/api/twilio/purchase-number" \  -H "Content-Type: application/json" \  -d '{    "phoneNumber": "string"  }'
{  "success": true,  "phone_number": "string",  "friendly_name": "string",  "sid": "string",  "voice_url": "string",  "sms_url": "string",  "mock": true}