## Create

**post** `/projects/{projectId}/api-keys`

Create an API key for a particular project

### Path Parameters

- `projectId: string`

### Body Parameters

- `maxConsumption: optional number`

  Optional spending cap (CU) for this key over the billing period: a value >= 0 to cap, or -1 for unlimited. Omit to inherit the default.

- `name: optional string`

  The API Key name

- `role: optional string`

  Project role: a built-in role (admin | editor | reader) or a custom inline ";"-separated scope list (e.g. "assets.read;workflows.run"). Defaults to editor.

### Returns

- `id: string`

- `authorId: string`

- `createdAt: string`

- `ownerType: "project" or "team"`

  - `"project"`

  - `"team"`

- `secret: string`

- `userId: string`

  The key's member id (`apiu_...`), taken by the member routes; the
  api-keys routes take `id`.

- `ownerId: optional string`

- `teamId: optional string`

### Example

```http
curl https://api.cloud.scenario.com/v1/projects/$PROJECT_ID/api-keys \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{}'
```

#### Response

```json
{
  "id": "id",
  "authorId": "authorId",
  "createdAt": "createdAt",
  "ownerType": "project",
  "secret": "secret",
  "userId": "userId",
  "ownerId": "ownerId",
  "teamId": "teamId"
}
```
