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

# Connect a number to your agent

> Create an application that points at your answer URL and attach a Plivo number to it.

Route incoming calls to your voice agent by attaching a number to a Plivo application. An application stores webhook URLs: HTTP endpoints Plivo requests during a call. Its answer URL returns your `<Stream>` XML.

Before you start, [log in](https://plivo.com/docs/cli/install.md#log-in-with-a-browser), rent a voice-enabled number, and deploy a public answer URL. Test it with [simulate](https://plivo.com/docs/cli/voice-agent/test-websocket.md#simulate-a-call-to-your-answer-url). Then create the application, using your URL:

```bash theme={null}
plivo account applications create --app-name my-agent \
  --answer-url https://agent.example.com/plivo/answer --answer-method POST -o json
```

Put `data.app_id` from the result in place of `"<app_id>"`, and your rented number in place of `14155551234`:

```bash theme={null}
plivo numbers update 14155551234 --app-id "<app_id>" --dry-run
plivo numbers update 14155551234 --app-id "<app_id>"
plivo voice streams readiness 14155551234
```

> [!WARNING]
>
> The second command changes routing immediately and does not require `--yes`. The preview shows the current binding: save the previous application or trunk ID first. To restore it, run `numbers update` with the saved `--app-id` or `--trunk-id`.

The readiness check places no call. To move to a new server later, update the application's URLs; every number attached to it uses the new URL. Searching, buying and compliance are on the [Numbers](https://plivo.com/docs/cli/apis/numbers.md) page.

## Applications

An application holds the webhook URLs Plivo calls for a number. Attach numbers with `plivo numbers update --app-id`, and update its URLs without touching the number. Global options such as `--profile` and `-o json` are in [Configuration](https://plivo.com/docs/cli/configure.md#global-flags).

| Command | What it does |
| - | - |
| `plivo account applications create` | Create a new application |
| `plivo account applications delete` | Delete an application (requires --yes) |
| `plivo account applications get` | Get application details |
| `plivo account applications list` | List applications |
| `plivo account applications update` | Update an application |

> [accordion] plivo account applications create
>
> `plivo account applications create [flags]`
>
> | Flag | Description |
> | - | - |
> | `--answer-method <value>` | GET\|POST (default "POST") |
> | `--answer-url <value>` | webhook for incoming calls (required) |
> | `--app-name <value>` | application name (required) |
> | `--default-number-app` | set as default for new numbers |
> | `--explain` | narrate in plain English before executing |
> | `--fallback-answer-url <value>` | backup webhook if answer-url fails |
> | `--hangup-url <value>` | webhook for call hangup |
> | `--log-incoming-messages` | log inbound SMS content (default true) |
> | `--message-url <value>` | webhook for inbound SMS |

> [accordion] plivo account applications delete
>
> `plivo account applications delete <app_id> [flags]`
>
> | Flag | Description |
> | - | - |
> | `--cascade` | delete the app's endpoints too; --cascade=false keeps them (default true) |
> | `--new-endpoint-application <value>` | with --cascade=false, the app\_id the endpoints move to |
>
> By default the app's endpoints are deleted with it. `--cascade=false` keeps them, detached from any app; add `--new-endpoint-application <app_id>` to move them to another app instead:
>
> ```bash theme={null}
> plivo account applications delete "<app_id>" --cascade=false --new-endpoint-application "<other_app_id>" --yes
> ```

> [accordion] plivo account applications get
>
> `plivo account applications get <app_id>`

> [accordion] plivo account applications list
>
> `plivo account applications list [flags]`
>
> | Flag | Description |
> | - | - |
> | `--all` | fetch every page (stops after 100 pages) |
> | `--limit <integer>` | results per page (1-20) (default 20) |
> | `--offset <integer>` | pagination offset |

> [accordion] plivo account applications update
>
> `plivo account applications update <app_id> [flags]`
>
> | Flag | Description |
> | - | - |
> | `--answer-method <value>` | GET\|POST |
> | `--answer-url <value>` | new answer URL |
> | `--app-name <value>` | new application name |
> | `--hangup-url <value>` | new hangup URL |
> | `--message-url <value>` | new message URL |
