Source: https://dinakar-rewind.docs.pageloop.ai/api-reference/admin/createadminkey

# Create API key

POST `https://api.rewind.rest/v1/admin/keys`

Generate a new API key. The raw key is returned once and cannot be retrieved again.

## Authorization

#### Authorization (header, string, required)

API key. Read keys (rw\_live\_...) access GET endpoints. Admin keys (rw\_admin\_...) access all endpoints.

## Body

#### name (body, string)

#### scope (body, string)

## Response

#### 201

API key created successfully

#### id (number, required)

#### key (string, required)

#### name (string, required)

#### scope (string, required)

#### key\_prefix (string, required)

#### key\_hint (string, required)

#### created\_at (string, required)

#### message (string, required)

#### 400

Bad request

#### error (string, required)

#### status (integer, required)

#### 401

Unauthorized

#### error (string, required)

#### status (integer, required)

#### Request

```bash cURL
curl -X POST 'https://api.rewind.rest/v1/admin/keys' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"name": "string", "scope": "string"}'
```

```javascript JavaScript
const res = await fetch('https://api.rewind.rest/v1/admin/keys', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name": "string", "scope": "string"}),
});
const data = await res.json();
```

```python Python
import requests

res = requests.post(
    'https://api.rewind.rest/v1/admin/keys',
    headers={'Authorization': 'Bearer <token>'},
    json={"name": "string", "scope": "string"}
)
data = res.json()
```

#### Response

```json 201
{
  "id": 0,
  "key": "string",
  "name": "string",
  "scope": "string",
  "key_prefix": "string",
  "key_hint": "string",
  "created_at": "string",
  "message": "string"
}
```

```json 400
{
  "error": "Not found",
  "status": 404
}
```

```json 401
{
  "error": "Not found",
  "status": 404
}
```
