# Update a connection

`PATCH https://api.morevoice.ai/v1/connections/{id}`

Changes the fields you send; the rest is kept. `password` is write-only: a string replaces it, null removes it.

Authenticate with a secret API key: `Authorization: Bearer $MOREVOICE_API_KEY`.

Operation ID: `connections_update`.

## Parameters

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | A connection ID (`conn_…`). |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `MoreVoice-Version` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |

## Request body

Optional, `application/json`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `answer_inbound` | `boolean` | no | — |
| `auth_username` | `string` | no | — |
| `backend` | `"native" \| "freeswitch"` | no | — |
| `caller_ids` | `string[]` | no | — |
| `codecs` | `("pcma" \| "pcmu")[]` | no | — |
| `default_caller_id` | `string \| ""` | no | The caller ID used when a call names none (empty: none). |
| `display_name` | `string` | no | — |
| `enabled` | `boolean` | no | — |
| `host` | `string` | no | The carrier's SIP host (a name or an IP address). |
| `inbound_acl` | `string[]` | no | — |
| `inbound_assistant_id` | `string \| null` | no | `asst_…` ID. |
| `inbound_reserve_pct` | `integer` | no | — |
| `max_channels` | `integer` | no | — |
| `max_cps` | `integer` | no | — |
| `name` | `string` | no | — |
| `overflow_policy` | `"busy" \| "unavailable"` | no | — |
| `password` | `string \| null` | no | Write-only. A string sets it, null removes it; leave it out to keep the stored one. |
| `port` | `integer` | no | — |
| `register` | `boolean` | no | — |
| `register_expires_seconds` | `integer` | no | — |
| `transport` | `"udp"` | no | — |
| `type` | `"registration" \| "trunk"` | no | — |
| `username` | `string` | no | — |

Example:

```json
{
  "max_cps": 10,
  "password": "n3w-pa55"
}
```

## Responses

### 200 OK

OK Returns `Connection`.

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string` | The connection's ID. |
| `object` | `"connection"` | — |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `name` | `string` | — |
| `enabled` | `boolean` | Disabled connections neither register nor carry calls. |
| `type` | `"registration" \| "trunk"` | `registration`: registers like a phone/extension. `trunk`: a carrier trunk (IP or credential authentication). |
| `backend` | `"native" \| "freeswitch"` | `native`: the platform's own SIP stack. `freeswitch`: FreeSWITCH in front. |
| `host` | `string` | The carrier's SIP host. |
| `port` | `integer` | — |
| `transport` | `"udp"` | — |
| `username` | `string` | — |
| `auth_username` | `string` | The authentication user, when it differs from `username`. |
| `password_set` | `boolean` | Whether a password is stored. Passwords are write-only. |
| `display_name` | `string` | — |
| `register` | `boolean` | Send REGISTER to the host. |
| `register_expires_seconds` | `integer` | — |
| `caller_ids` | `string[]` | Numbers this connection may present as caller ID. |
| `default_caller_id` | `string` | The caller ID used when a call names none. |
| `max_channels` | `integer` | Simultaneous calls (0: unlimited). |
| `max_cps` | `integer` | New outbound calls per second (0: unlimited). |
| `inbound_reserve_pct` | `integer` | Share of `max_channels` outbound campaigns never use, kept for inbound calls. |
| `answer_inbound` | `boolean` | Answer inbound calls on this connection. |
| `inbound_assistant_id` | `string \| null` | `asst_…` ID. |
| `inbound_acl` | `string[]` | Trunks: extra source IPs / CIDRs allowed to send calls (the host's addresses always are). |
| `overflow_policy` | `"busy" \| "unavailable"` | When the connection is full: `busy` (486) or `unavailable` (503, lets a carrier fail over). |
| `codecs` | `("pcma" \| "pcmu")[]` | Audio codecs, in preference order. |
| `status` | `ConnectionStatus` | The connection's live state. |
| `status.state` | `"disabled" \| "incomplete" \| "registering" \| "registered" \| "listening" \| "failed"` | `registered` / `listening`: ready. `incomplete`: settings are missing. `failed`: see `error`. |
| `status.error` | `string \| null` | The last registration error, or null. |
| `status.registered_at` | `string \| null` | When the last registration succeeded. |
| `status.expires_seconds` | `integer \| null` | The registration's lifetime. |
| `active_calls` | `integer` | Calls on the connection right now. |
| `created` | `string` | An ISO-8601 timestamp in UTC. |
| `updated` | `string` | An ISO-8601 timestamp in UTC. |

Example:

```json
{
  "active_calls": 2,
  "answer_inbound": true,
  "auth_username": "",
  "backend": "native",
  "caller_ids": [
    "+97231234567"
  ],
  "codecs": [
    "pcma",
    "pcmu"
  ],
  "created": "2026-11-03T09:14:22.000Z",
  "default_caller_id": "+97231234567",
  "display_name": "",
  "enabled": true,
  "host": "sip.carrier.example.com",
  "id": "conn_2Wq8RfLx0bZt7nKp1VdYhC",
  "inbound_acl": [
    "198.51.100.0/24"
  ],
  "inbound_assistant_id": "asst_3cYbE6uYvGkH8w4ZK1rTqd",
  "inbound_reserve_pct": 15,
  "livemode": true,
  "max_channels": 30,
  "max_cps": 5,
  "name": "Main trunk",
  "object": "connection",
  "overflow_policy": "busy",
  "password_set": false,
  "port": 5060,
  "register": false,
  "register_expires_seconds": 300,
  "status": {
    "error": null,
    "expires_seconds": null,
    "registered_at": null,
    "state": "listening"
  },
  "transport": "udp",
  "type": "trunk",
  "updated": "2026-11-03T09:14:22.000Z",
  "username": ""
}
```

### 400 Bad Request

The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown. Returns `ErrorEnvelope`.

### 401 Unauthorized

No valid API key was sent. Returns `ErrorEnvelope`.

### 403 Forbidden

The key may not do this (a missing scope, a plan limit, or a compliance block). Returns `ErrorEnvelope`.

### 404 Not Found

No object with this ID (in the path or the body) exists in this organisation and mode. Returns `ErrorEnvelope`.

### 409 Conflict

The request conflicts with the object's state, or the Idempotency-Key was reused with other parameters. Returns `ErrorEnvelope`.

### 413 Payload Too Large

The request body is larger than the endpoint accepts, or has more parts or files than it takes. Returns `ErrorEnvelope`.

### 415 Unsupported Media Type

The request body's Content-Type is not one the endpoint takes. Returns `ErrorEnvelope`.

### 429 Too Many Requests

Too many requests, or no call capacity right now. Retry after the Retry-After delay. Returns `ErrorEnvelope`.

### 500 Internal Server Error

Something went wrong on MoreVoice's side. Retry with the same Idempotency-Key. Returns `ErrorEnvelope`.

## Code samples

**TypeScript**

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

const connection = await mv.connections.update("conn_7Hk2Lm9Qp", {
	max_cps: 10,
	password: "n3w-pa55",
});
console.log(connection);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

connection = client.connections.update("conn_7Hk2Lm9Qp", {
    "max_cps": 10,
    "password": "n3w-pa55",
})
print(connection)
```

**cURL**

```sh
curl -X PATCH https://api.morevoice.ai/v1/connections/conn_7Hk2Lm9Qp \
  -H "Authorization: Bearer $MOREVOICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "max_cps": 10,
  "password": "n3w-pa55"
}'
```
