# Twilio Routing Reference

**App name:** `twilio`
**Base URL proxied:** `api.twilio.com`

## API Path Pattern

```
/twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/{resource}.json
```

**Important:** Most Twilio endpoints require your Account SID in the path. Get it from `/Accounts.json`.

## Common Endpoints

### Accounts

#### List Accounts
```bash
GET /twilio/[REDACTED_PHONE]/Accounts.json
```

#### Get Account
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}.json
```

### Messages (SMS/MMS)

#### List Messages
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Messages.json
```

#### Send Message
```bash
POST /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Messages.json
Content-Type: application/x-www-form-urlencoded

To=+[REDACTED_PHONE]&From=+[REDACTED_PHONE]&Body=Hello%20from%20Twilio!
```

#### Get Message
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Messages/{MessageSid}.json
```

#### Delete Message
```bash
DELETE /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Messages/{MessageSid}.json
```

### Calls (Voice)

#### List Calls
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Calls.json
```

#### Make Call
```bash
POST /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Calls.json
Content-Type: application/x-www-form-urlencoded

To=+[REDACTED_PHONE]&From=+[REDACTED_PHONE]&Url=https://example.com/twiml
```

#### Get Call
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Calls/{CallSid}.json
```

#### End Call
```bash
POST /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Calls/{CallSid}.json
Content-Type: application/x-www-form-urlencoded

Status=completed
```

### Phone Numbers

#### List Incoming Phone Numbers
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/IncomingPhoneNumbers.json
```

#### Get Phone Number
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/IncomingPhoneNumbers/{PhoneNumberSid}.json
```

#### Update Phone Number
```bash
POST /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/IncomingPhoneNumbers/{PhoneNumberSid}.json
Content-Type: application/x-www-form-urlencoded

FriendlyName=Updated%20Name
```

### Applications

#### List Applications
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Applications.json
```

#### Create Application
```bash
POST /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Applications.json
Content-Type: application/x-www-form-urlencoded

FriendlyName=My%20App&VoiceUrl=https://example.com/voice
```

#### Delete Application
```bash
DELETE /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Applications/{ApplicationSid}.json
```

### Queues

#### List Queues
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Queues.json
```

#### Create Queue
```bash
POST /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Queues.json
Content-Type: application/x-www-form-urlencoded

FriendlyName=Support%20Queue&MaxSize=100
```

### Usage Records

#### List Usage Records
```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Usage/Records.json
```

## Pagination

Uses page-based pagination:

```bash
GET /twilio/[REDACTED_PHONE]/Accounts/{AccountSid}/Messages.json?PageSize=50&Page=0
```

**Parameters:**
- `PageSize` - Results per page (default: 50)
- `Page` - Page number (0-indexed)

Response includes `next_page_uri` for fetching next page.

## Notes

- All endpoints require `/[REDACTED_PHONE]/` API version prefix
- Request bodies use `application/x-www-form-urlencoded` (not JSON)
- Phone numbers must be in E.164 format (+[REDACTED_PHONE])
- SID prefixes: AC (account), SM/MM (messages), CA (calls), PN (phone numbers), AP (applications), QU (queues)
- POST is used for both creating and updating resources
- DELETE returns 204 No Content on success

## Resources

- [Twilio API Overview](https://www.twilio.com/docs/usage/api)
- [Messages API](https://www.twilio.com/docs/messaging/api/message-resource)
- [Calls API](https://www.twilio.com/docs/voice/api/call-resource)