# Re-register a connection

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

Sends a fresh REGISTER now (FreeSWITCH connections re-register their gateway). The answer is the state right after the request.

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

Operation ID: `connections_register`.

## 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. |
| `Idempotency-Key` | `string` | no | A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice. |

## Responses

### 200 OK

OK Returns `ConnectionRegistration`.

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"connection_registration"` | — |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `connection_id` | `string` | A connection ID (prefix `conn_`). |
| `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. |

Example:

```json
{
  "connection_id": "conn_2Wq8RfLx0bZt7nKp1VdYhC",
  "livemode": true,
  "object": "connection_registration",
  "status": {
    "error": null,
    "expires_seconds": null,
    "registered_at": null,
    "state": "registering"
  }
}
```

### 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`.

### 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 connectionRegistration = await mv.connections.register("conn_7Hk2Lm9Qp");
console.log(connectionRegistration);
```

**Python**

```python
from morevoice import MoreVoice

client = MoreVoice()  # MOREVOICE_API_KEY from the environment

connection_registration = client.connections.register("conn_7Hk2Lm9Qp")
print(connection_registration)
```

**cURL**

```sh
curl -X POST https://api.morevoice.ai/v1/connections/conn_7Hk2Lm9Qp/register \
  -H "Authorization: Bearer $MOREVOICE_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```
