> ## Documentation Index
> Fetch the complete documentation index at: https://lava.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio

> Twilio REST API for programmable SMS/MMS messaging, voice calls, OTP phone verification (Verify), and phone-number intelligence (Lookup), all against the user's own Twilio account and phone numbers.

Twilio REST API for programmable SMS/MMS messaging, voice calls, OTP phone verification (Verify), and phone-number intelligence (Lookup), all against the user's own Twilio account and phone numbers. Use when an agent needs to text or call a real phone number, run a verification-code flow, check message delivery status, or validate and enrich a phone number with line-type data. Users connect their Account SID and Auth Token from the Twilio Console; Twilio bills their account directly.

14 example endpoints available through Lava's AI Gateway. See the [Twilio API docs](https://www.twilio.com/docs/usage/api) for full documentation.

<Warning>This provider requires your own credentials — connect your API key or OAuth account before use.</Warning>

<Info>This is a **catch-all provider** — any valid URL under `https://api.twilio.com` is supported. Twilio REST API across four hosts. Classic messaging/voice: [https://api.twilio.com/2010-04-01/Accounts/\&#123;AccountSid\&#125;/\&#123;resource\&#125;.json](https://api.twilio.com/2010-04-01/Accounts/\&#123;AccountSid\&#125;/\&#123;resource\&#125;.json) — write the literal \{AccountSid} placeholder; the gateway substitutes the connected account. Common resources: Messages.json (send/list SMS and MMS), Messages/\{MessageSid}.json (status/delete), Calls.json (place/list calls; pass a TwiML Url param), IncomingPhoneNumbers.json (owned numbers), Balance.json. Verification: [https://verify.twilio.com/v2/Services](https://verify.twilio.com/v2/Services) and Services/\{ServiceSid}/Verifications + VerificationCheck. Phone intelligence: [https://lookups.twilio.com/v2/PhoneNumbers/\&#123;E164Number\&#125;?Fields=line\_type\_intelligence](https://lookups.twilio.com/v2/PhoneNumbers/\&#123;E164Number\&#125;?Fields=line_type_intelligence). Messaging services: [https://messaging.twilio.com/v1/Services](https://messaging.twilio.com/v1/Services). Send request bodies as ordinary JSON; the gateway re-encodes them to the form-urlencoded format Twilio expects. Parameter names are PascalCase (To, From, Body, MediaUrl). List endpoints paginate with PageSize plus the returned next\_page\_uri. Bare Account resources and Keys/SigningKeys endpoints are not routed (credential surfaces). See [https://www.twilio.com/docs/usage/api](https://www.twilio.com/docs/usage/api) for the full reference. The endpoints below are curated examples.</Info>

## Endpoints

### Send an SMS or MMS message. From must be a Twilio number (or Messaging Service SID via MessagingServiceSid) on the connected account; add MediaUrl for MMS.

**POST** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json', {
      body: {
    "To": "+15558675310",
    "From": "+15552229999",
    "Body": "Hello from Twilio!"
    },
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FMessages.json" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"To":"+15558675310","From":"+15552229999","Body":"Hello from Twilio!"}'
    ```
  </Tab>
</Tabs>

### List sent and received messages, filterable by To, From, and DateSent; paginate with PageSize.

**GET** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json?PageSize=20` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json?PageSize=20', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FMessages.json%3FPageSize%3D20" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Fetch a single message by SID, including delivery status and error code.

**GET** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}.json` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}.json', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FMessages%2F%7BMessageSid%7D.json" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Delete a message record from the account's message log.

**DELETE** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}.json` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}.json', { method: 'DELETE' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X DELETE "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FMessages%2F%7BMessageSid%7D.json" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json"
    ```
  </Tab>
</Tabs>

### Place an outbound voice call. Url must point to TwiML instructions for the call (or pass Twiml inline).

**POST** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json', {
      body: {
    "To": "+15558675310",
    "From": "+15552229999",
    "Url": "https://demo.twilio.com/docs/voice.xml"
    },
    });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FCalls.json" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"To":"+15558675310","From":"+15552229999","Url":"https://demo.twilio.com/docs/voice.xml"}'
    ```
  </Tab>
</Tabs>

### List voice calls with status and duration, filterable by To, From, and StartTime.

**GET** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json?PageSize=20` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls.json?PageSize=20', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FCalls.json%3FPageSize%3D20" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### List the phone numbers owned by the connected account, with their SMS/voice capabilities.

**GET** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FIncomingPhoneNumbers.json" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Fetch the account's current Twilio balance and currency.

**GET** `https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Balance.json` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Balance.json', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.twilio.com%2F2010-04-01%2FAccounts%2F%7BAccountSid%7D%2FBalance.json" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Validate and enrich a phone number (E.164). Add Fields=line\_type\_intelligence for carrier/line-type data (Twilio charges per data package).

**GET** `https://lookups.twilio.com/v2/PhoneNumbers/+15558675310?Fields=line_type_intelligence` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://lookups.twilio.com/v2/PhoneNumbers/+15558675310?Fields=line_type_intelligence', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Flookups.twilio.com%2Fv2%2FPhoneNumbers%2F%2B15558675310%3FFields%3Dline_type_intelligence" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### List the Verify services configured on the account.

**GET** `https://verify.twilio.com/v2/Services` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://verify.twilio.com/v2/Services', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fverify.twilio.com%2Fv2%2FServices" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

### Send a verification code to a phone number via sms, call, whatsapp, or email through an existing Verify service.

**POST** `https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://verify.twilio.com/v2/Services/{ServiceSid}/Verifications', { body: {"To":"+15558675310","Channel":"sms"} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fverify.twilio.com%2Fv2%2FServices%2F%7BServiceSid%7D%2FVerifications" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"To":"+15558675310","Channel":"sms"}'
    ```
  </Tab>
</Tabs>

### Check a verification code the user received; status "approved" means the code matched.

**POST** `https://verify.twilio.com/v2/Services/{ServiceSid}/VerificationCheck` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://verify.twilio.com/v2/Services/{ServiceSid}/VerificationCheck', { body: {"To":"+15558675310","Code":"123456"} });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST "https://api.lava.so/v1/forward?u=https%3A%2F%2Fverify.twilio.com%2Fv2%2FServices%2F%7BServiceSid%7D%2FVerificationCheck" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{"To":"+15558675310","Code":"123456"}'
    ```
  </Tab>
</Tabs>

### Delete a Verify service by SID.

**DELETE** `https://verify.twilio.com/v2/Services/{ServiceSid}` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://verify.twilio.com/v2/Services/{ServiceSid}', { method: 'DELETE' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl -X DELETE "https://api.lava.so/v1/forward?u=https%3A%2F%2Fverify.twilio.com%2Fv2%2FServices%2F%7BServiceSid%7D" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY" \
      -H "Content-Type: application/json"
    ```
  </Tab>
</Tabs>

### List Messaging Services (sender pools with A2P registration) on the account.

**GET** `https://messaging.twilio.com/v1/Services` — Free

<Tabs>
  <Tab title="SDK">
    ```typescript theme={null}
    const data = await lava.gateway('https://messaging.twilio.com/v1/Services', { method: 'GET' });
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.lava.so/v1/forward?u=https%3A%2F%2Fmessaging.twilio.com%2Fv1%2FServices" \
      -H "Authorization: Bearer $LAVA_SECRET_KEY"
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="All Providers" icon="grid" href="/gateway/supported-providers">
    Browse all supported AI providers
  </Card>

  <Card title="Forward Proxy" icon="route" href="/gateway/forward-proxy">
    Learn how to construct proxy URLs and authenticate requests
  </Card>
</CardGroup>
