# Collect the connection key

Source: https://docs.vlayers.ai/reference/connect/issue-device-worker-key

`POST /v1/connect/devices/{id}/worker-key` · scope `device:worker`

Returns the connection key the device uses to serve its line, once. A second call is refused with 409; disconnect the device and connect it again for a new key. Only the device's own access token can call it.

Requires an API key with the `device:worker` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The device id, from `GET /v1/connect/devices/me`. Example: `"0192f5a8-1a2b-7c3d-8e4f-5a6b7c8d9e01"` |

## Request

cURL:

```bash
curl -X POST "https://api.vlayers.ai/v1/connect/devices/$DEVICE_ID/worker-key" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY"
```

TypeScript:

```ts
import { VoiceLayer } from '@voicelayer/api';

const voicelayer = new VoiceLayer();

const { connectorId } = await voicelayer.connect.issueDeviceWorkerKey('<device-id>');
console.log(connectorId);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.connect.issue_device_worker_key("<device-id>")
print(result.connector_id)
```

## Response `201`

```json
{
  "workerKey": "vl_worker_placeholder",
  "connectorId": "0192f5c3-7a8b-7cad-9e2f-3a4b5c6d7e89",
  "edgeUrl": "wss://edge.vlayers.ai/worker",
  "apiUrl": "https://api.vlayers.ai"
}
```
