# client.caller_ids

> The caller_ids methods of the morevoice Python SDK: Numbers you hold elsewhere, verified by a call, to present as your calls' caller ID.

Numbers you hold elsewhere, verified by a call, to present as your calls' caller ID. These methods are on `client.caller_ids`, where `client` is a `MoreVoice` client (see [the Python SDK](https://docs.morevoice.ai/sdk/python/#connect)). On `AsyncMoreVoice` the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.

## `create()`

**Verify a caller ID.** Starts verifying a number you hold elsewhere (your office line, a mobile) so your calls can present it. We call `phone_number` from our verification line and ask the person who answers to type the 6-digit `verification_code` of this answer on the phone's keypad: show it to them (the call never says it). The outcome arrives as `caller_id.verified` or `caller_id.failed`, or read it with GET /v1/caller_ids/{id}; the code works for 10 minutes and for one entry. A verified number can then be the `caller_id` of POST /v1/calls and of campaigns, also on MoreVoice Telephony.

Limits: 3 calls a day per number, 10 a day and 3 in any 10 minutes per organisation (429 `rate_limited`, `details.scope`). Refused: a number not in E.164, an emergency or premium-rate number (400 `parameter_invalid`); one of your own numbers or one already verified (409 `caller_id_exists`). The request is not replayed under an Idempotency-Key (its answer holds the code): a retry starts a new verification, and the older one fails as `superseded`. Live keys only.

```python
# client.caller_ids
def create(self, body: _m.CallerIdCreateParamsInput | Mapping[str, Any], *, more_voice_version: str | Unset = UNSET) -> _m.CallerId
```

`client.caller_ids.create()` · `await async_client.caller_ids.create()` · `POST /caller_ids` · [API reference](https://docs.morevoice.ai/api/operations/caller_ids_create/)

### Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `phone_number` | `string` | yes | The number to verify, in E.164 (e.g. +97235550100). Not one of your own numbers (those need no verification), an emergency number or a premium-rate number. |
| `friendly_name` | `string` | no | Your name for the number, shown in lists. |
| `language` | `"he" \| "en"` | no | The language our call speaks first (then the other one). Default `he`. |

### Returns

`CallerId`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The caller ID's ID. |
| `object` | `"caller_id"` | Always `caller_id`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `phone_number` | `string` | The number, in E.164. |
| `friendly_name` | `string \| null` | Your name for the number, or null. |
| `status` | `"pending" \| "verified" \| "failed"` | `pending`: our call is on its way, or waits for the code (10 minutes at most). `verified`: the number can be the `caller_id` of your calls and campaigns. `failed`: see `failure_reason`; start a new verification to try again. |
| `failure_reason` | `"wrong_code" \| "no_answer" \| "no_input" \| "expired" \| "call_failed" \| "superseded" \| null` | Why it failed: `wrong_code`, `no_answer` (the call was not answered), `no_input` (answered, nothing typed), `expired` (10 minutes passed), `call_failed` (we could not place the call), `superseded` (a newer verification of the number started). null unless `failed`. |
| `method` | `"call" \| "attestation"` | `call`: verified by our call. `attestation`: an administrator attested ownership in the dashboard (usable on your own SIP connections only, not on MoreVoice Telephony). |
| `verification_code` | `string \| null` | Only in the answer to POST /v1/caller_ids: the 6-digit code to show the person who will answer our call, who types it on the phone's keypad. null everywhere else (we keep only a hash of it). |
| `expires_at` | `string \| null` | While `pending`: when the code stops working. null otherwise. |
| `verified_at` | `string \| null` | When the number was verified, or null. |
| `created` | `string` | When the verification started. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

caller_id = client.caller_ids.create({
    "friendly_name": "Head office",
    "phone_number": "+97235550100",
})
print(caller_id)
```

## `delete()`

**Delete a caller ID.** Your calls can no longer present the number; a pending verification stops (its code no longer works). Verify the number again to use it later.

```python
# client.caller_ids
def delete(self, id: str, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.DeletedCallerId
```

`client.caller_ids.delete()` · `await async_client.caller_ids.delete()` · `DELETE /caller_ids/{id}` · [API reference](https://docs.morevoice.ai/api/operations/caller_ids_delete/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `str` | yes | A caller id verification ID (`cid_…`). |

### Returns

`DeletedCallerId`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The deleted caller ID's ID. |
| `object` | `"caller_id"` | Always `caller_id`. |
| `deleted` | `true` | — |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

deleted_caller_id = client.caller_ids.delete("cid_7Hk2Lm9Qp")
print(deleted_caller_id)
```

## `list()`

**List caller IDs.** Your caller IDs, newest first: verified, pending and failed ones. Deleted ones are not listed. Live keys only.

```python
# client.caller_ids
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.CallerId]
```

`client.caller_ids.list()` · `await async_client.caller_ids.list()` · `GET /caller_ids` · [API reference](https://docs.morevoice.ai/api/operations/caller_ids_list/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | no | How many objects to return, 1–100 (default 20). |
| `starting_after` | `string` | no | A cursor (`next_cursor`) or object ID: return the objects after it (older). |
| `ending_before` | `string` | no | A cursor or object ID: return the objects before it (newer). |

### Returns

A page of results (`CallerIdList`): `data`, `has_more` and `next_cursor`.

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

for caller_id in client.caller_ids.list():
    print(caller_id)
```

## `retrieve()`

**Retrieve a caller ID.** Returns the `CallerId` object. Answers `404` with the code `resource_missing` when nothing has this ID in this organisation and mode.

```python
# client.caller_ids
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.CallerId
```

`client.caller_ids.retrieve()` · `await async_client.caller_ids.retrieve()` · `GET /caller_ids/{id}` · [API reference](https://docs.morevoice.ai/api/operations/caller_ids_retrieve/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `str` | yes | A caller id verification ID (`cid_…`). |

### Returns

`CallerId`:

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The caller ID's ID. |
| `object` | `"caller_id"` | Always `caller_id`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `phone_number` | `string` | The number, in E.164. |
| `friendly_name` | `string \| null` | Your name for the number, or null. |
| `status` | `"pending" \| "verified" \| "failed"` | `pending`: our call is on its way, or waits for the code (10 minutes at most). `verified`: the number can be the `caller_id` of your calls and campaigns. `failed`: see `failure_reason`; start a new verification to try again. |
| `failure_reason` | `"wrong_code" \| "no_answer" \| "no_input" \| "expired" \| "call_failed" \| "superseded" \| null` | Why it failed: `wrong_code`, `no_answer` (the call was not answered), `no_input` (answered, nothing typed), `expired` (10 minutes passed), `call_failed` (we could not place the call), `superseded` (a newer verification of the number started). null unless `failed`. |
| `method` | `"call" \| "attestation"` | `call`: verified by our call. `attestation`: an administrator attested ownership in the dashboard (usable on your own SIP connections only, not on MoreVoice Telephony). |
| `verification_code` | `string \| null` | Only in the answer to POST /v1/caller_ids: the 6-digit code to show the person who will answer our call, who types it on the phone's keypad. null everywhere else (we keep only a hash of it). |
| `expires_at` | `string \| null` | While `pending`: when the code stops working. null otherwise. |
| `verified_at` | `string \| null` | When the number was verified, or null. |
| `created` | `string` | When the verification started. |

### Example

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

caller_id = client.caller_ids.retrieve("cid_7Hk2Lm9Qp")
print(caller_id)
```
