# POST /v4/organizations/{organizationId}/api-keys

_Merkl API_

Create a key for the caller, or for a service account with `serviceAccountId`. Needs `api_key.create`; a service account also needs `api_key.manage` on it. The secret is returned once. An organization holds at most 5 active keys per creator (409). Managing the credentials of a service account lets the holder act with that service account's rights.

### Path parameters

- `organizationId` (string) _(required)_

## Request body

**`application/json`**
```json
{
  "type": "object",
  "properties": {
    "description": {
      "minLength": 1,
      "maxLength": 255,
      "type": "string"
    },
    "expiresAt": {
      "format": "date-time",
      "description": "ISO 8601, in the future",
      "type": "string"
    },
    "serviceAccountId": {
      "format": "uuid",
      "description": "The service account the key belongs to. Omit it for a personal key of the caller. Managing the credentials of a service account lets the holder act with that service account's rights.",
      "type": "string"
    }
  }
}
```
**`application/x-www-form-urlencoded`**
```json
{
  "type": "object",
  "properties": {
    "description": {
      "minLength": 1,
      "maxLength": 255,
      "type": "string"
    },
    "expiresAt": {
      "format": "date-time",
      "description": "ISO 8601, in the future",
      "type": "string"
    },
    "serviceAccountId": {
      "format": "uuid",
      "description": "The service account the key belongs to. Omit it for a personal key of the caller. Managing the credentials of a service account lets the holder act with that service account's rights.",
      "type": "string"
    }
  }
}
```
**`multipart/form-data`**
```json
{
  "type": "object",
  "properties": {
    "description": {
      "minLength": 1,
      "maxLength": 255,
      "type": "string"
    },
    "expiresAt": {
      "format": "date-time",
      "description": "ISO 8601, in the future",
      "type": "string"
    },
    "serviceAccountId": {
      "format": "uuid",
      "description": "The service account the key belongs to. Omit it for a personal key of the caller. Managing the credentials of a service account lets the holder act with that service account's rights.",
      "type": "string"
    }
  }
}
```

## Responses

- **200** Response for status 200

## Example request

```bash
curl -X POST "https://api.merkl.xyz//v4/organizations/{organizationId}/api-keys" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ ... }'
```