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

# Custom Twilio Integration

> Connect Luly to your own Twilio account

## Overview

Enterprise customers can connect their own Twilio account to Luly. Easily bring over your existing phone numbers, integrations, and more.

Pre-requisites:

* Your own Twilio account

## Step 1: Creating an Encrypted Key with your Twilio Credentials

1. Go to your [Twilio Console](https://www.twilio.com/login?g=%2Fconsole%3F\&t=2b1c98334b25c1a785ef15b6556396290e3c704a9b57fc40687cbccd79c46a8c) and get your Account SID and Auth Token.
2. create an  `encrypted_key` by [sending an API request](https://docs.luly.ai/api-reference/twilioAccounts/create) to Luly.

This is the only time that your encrypted\_key will be returned to you. Make sure to store it securely, and new keys will need to be generated if lost.

## Step 2: Using the Encrypted Key in Outbound Calls

Include `encrypted_key` in the headers (in addition to the `Authorization` header) of your API requests, and we’ll use that account’s credentials to make the call.

For example:

```javascript Example
{
    "Authorization": "abc",
    "encrypted_key": "bcd"
}
```

Note:

* You can set your `from` number in the API request - this will need to be a number owned by that Twilio account (and not one purchased through Luly).
* By default, we’ll send calls from a randomly selected number in the specified Twilio account if a `from` is not specified.

## Step 3: Uploading Inbound numbers

1. Go to your [Twilio Console](https://www.twilio.com/login?g=%2Fconsole%3F\&t=2b1c98334b25c1a785ef15b6556396290e3c704a9b57fc40687cbccd79c46a8c) and get your your Twilio phone number(s).
2. Upload your numbers [through the API](https://docs.luly.ai/api-reference/twilioAccounts/upload)

We’ll validate that these numbers are owned by that account and add them to your Luly account.

## Step 4: Configuring Inbound Numbers/Webhooks

Note: When updating inbound numbers, the headers need to the include the `encrypted_key` in addition to the `Authorization` header. Doing so makes sure the updates are applied to the correct Twilio account

Once you update an inbound number through the [Dev Portal](https://portal.luly.ai/) or [API](https://docs.luly.ai/api-reference/inbound/update), that number will be automatically configured to run on Luly’s infrastructure. No additional steps are required!
