# Make an endpoint key for callers

Source: https://docs.vlayers.ai/reference/hosting/create-endpoint-key

`POST /v1/endpoints/{endpoint}/keys` · scope `workspace:write`

Makes a key (`vle_…`) that callers of one route present as `Authorization: Bearer vle_…` or `x-api-key`. The key works for that one endpoint and kind only, never reaches your code, and cannot call the VoiceLayer API. The secret is shown once; VoiceLayer keeps only its digest. Only a route whose manifest uses key authentication takes keys.

Requires an API key with the `workspace:write` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `endpoint` | path | string | yes | The endpoint id: the first segment of its `run.vlayers.ai` URL. Example: `"x7k2p4q9m3vd"` |
| `name` | body | string | yes | A name you will recognise it by (up to 100 characters). |
| `kind` | body | "api" \| "hook" \| "mcp" | yes | The route the key opens: `api`, `hook` or `mcp`. |
| `expiresAt` | body | string | no | When the key stops working (ISO 8601). Leave it out for a key that does not expire. |

## Request

cURL:

```bash
curl -X POST "https://api.vlayers.ai/v1/endpoints/$ENDPOINT_ID/keys" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Partner integration",
    "kind": "api"
  }'
```

TypeScript:

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

const voicelayer = new VoiceLayer();

const { key } = await voicelayer.hosting.createEndpointKey('<endpoint-id>', {
  name: 'Partner integration',
  kind: 'api'
});
console.log(key);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.hosting.create_endpoint_key(
    "<endpoint-id>",
    name="Partner integration",
    kind="api",
)
print(result.key)
```

## Response `201`

```json
{
  "key": "vle_<shown once>",
  "apiKey": {
    "id": "0192f5c1-5e6f-7a8b-9c0d-1e2f3a4b5c67",
    "kind": "api",
    "name": "Partner integration",
    "preview": "vle_AbCd…wXyZ",
    "createdAt": "2026-10-20T15:04:05.000Z",
    "expiresAt": null,
    "lastUsedAt": null,
    "revokedAt": null
  }
}
```
