---
title: "Create api key"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.sureshake.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Sureshake API › api-keys

`POST /v2/api-keys`

## Request body

_Required._

- `name` (`api-key-create.name`; string, required)
  - minLength 1; maxLength 100
- `description` (`api-key-create.description`; string, optional)
- `scope` (`api-key-create.scope`; string, optional)
  - one of `"read"`, `"write"`, `"admin"`
- `permissions` (`api-key-create.permissions`; array<string>, optional)
  - one of `"read"`, `"write"`, `"admin"`
- `expiresAt` (`api-key-create.expiresAt`; string, optional)
  - format `date-time`
- `rateLimit` (`api-key-create.rateLimit`; number, optional)
  - min 1; max 10000

## Example request

```json
{
  "name": "string",
  "description": "string",
  "scope": "read",
  "permissions": [
    "read"
  ],
  "expiresAt": "2019-08-24T14:15:22Z",
  "rateLimit": 1
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.sureshake.com/v2/api-keys \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "string",
  "description": "string",
  "scope": "read",
  "permissions": [
    "read"
  ],
  "expiresAt": "2019-08-24T14:15:22Z",
  "rateLimit": 1
}
'
```

### TypeScript

```typescript
const url = 'https://api.sureshake.com/v2/api-keys';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: 'string',
    description: 'string',
    scope: 'read',
    permissions: ['read'],
    expiresAt: '2019-08-24T14:15:22Z',
    rateLimit: 1
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sureshake.com/v2/api-keys"

payload = {
    "name": "string",
    "description": "string",
    "scope": "read",
    "permissions": ["read"],
    "expiresAt": "2019-08-24T14:15:22Z",
    "rateLimit": 1
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

Default Response

#### Example

```json
{
  "data": {
    "id": "string",
    "name": "string",
    "description": "string",
    "prefix": "string",
    "lastUsedAt": "2019-08-24T14:15:22Z",
    "expiresAt": "2019-08-24T14:15:22Z",
    "permissions": [
      "read"
    ],
    "capabilities": [],
    "rateLimit": 0,
    "usageCount": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "status": "string",
    "key": "string"
  },
  "meta": {
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
```

- `data` (`api-key-create.response.201.data`; object, required)
  - `id` (`api-key-create.response.201.data.id`; string, required)
    - minLength 1
  - `name` (`api-key-create.response.201.data.name`; string, required)
  - `prefix` (`api-key-create.response.201.data.prefix`; string, required)
  - `permissions` (`api-key-create.response.201.data.permissions`; array<string>, required)
    - one of `"read"`, `"write"`, `"admin"`
  - `usageCount` (`api-key-create.response.201.data.usageCount`; number, required)
    - min 0
  - `createdAt` (`api-key-create.response.201.data.createdAt`; string, required)
    - format `date-time`
  - `status` (`api-key-create.response.201.data.status`; string, required)
  - `key` (`api-key-create.response.201.data.key`; string, required) — The full API key (only shown once during creation)
  - `description` (`api-key-create.response.201.data.description`; string, optional, nullable)
  - `lastUsedAt` (`api-key-create.response.201.data.lastUsedAt`; string, optional, nullable)
    - format `date-time`
  - `expiresAt` (`api-key-create.response.201.data.expiresAt`; string, optional, nullable)
    - format `date-time`
  - `capabilities` (`api-key-create.response.201.data.capabilities`; array<string>, optional)
    - one of `"entities.ingest"`, `"entities.enrich"`, `"entities.profile.read"`, `"entities.profile.propose"`, `"entities.profile.review"`, `"entities.identity.resolve"`, `"portfolio.links.read"`, `"portfolio.links.review"`, `"entities.publish"`, `"prospecting.observations.submit"`, `"prospecting.observations.read"`, `"prospecting.contacts.read"`, `"prospecting.drafts.write"`, `"attestations.events.submit"`, `"attestations.sow.submit"`, `"attestations.nda.submit"`, `"attestations.documents.sign"`, `"attestations.links.propose"`, `"admin.mcp"`; default `[]`
  - `rateLimit` (`api-key-create.response.201.data.rateLimit`; number, optional, nullable)
- `meta` (`api-key-create.response.201.meta`; object, optional)
  - `timestamp` (`api-key-create.response.201.meta.timestamp`; string, required)
    - format `date-time`

### 400

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`api-key-create.response.400.error`; object, required)
  - `code` (`api-key-create.response.400.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`api-key-create.response.400.error.message`; string, required) — Human-readable error message
  - `details` (`api-key-create.response.400.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`api-key-create.response.400.error.traceId`; string, optional) — Unique ID for log correlation

### 401

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`api-key-create.response.401.error`; object, required)
  - `code` (`api-key-create.response.401.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`api-key-create.response.401.error.message`; string, required) — Human-readable error message
  - `details` (`api-key-create.response.401.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`api-key-create.response.401.error.traceId`; string, optional) — Unique ID for log correlation

### 403

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`api-key-create.response.403.error`; object, required)
  - `code` (`api-key-create.response.403.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`api-key-create.response.403.error.message`; string, required) — Human-readable error message
  - `details` (`api-key-create.response.403.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`api-key-create.response.403.error.traceId`; string, optional) — Unique ID for log correlation

### 404

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`api-key-create.response.404.error`; object, required)
  - `code` (`api-key-create.response.404.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`api-key-create.response.404.error.message`; string, required) — Human-readable error message
  - `details` (`api-key-create.response.404.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`api-key-create.response.404.error.traceId`; string, optional) — Unique ID for log correlation

### 409

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`api-key-create.response.409.error`; object, required)
  - `code` (`api-key-create.response.409.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`api-key-create.response.409.error.message`; string, required) — Human-readable error message
  - `details` (`api-key-create.response.409.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`api-key-create.response.409.error.traceId`; string, optional) — Unique ID for log correlation

### 500

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`api-key-create.response.500.error`; object, required)
  - `code` (`api-key-create.response.500.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`api-key-create.response.500.error.message`; string, required) — Human-readable error message
  - `details` (`api-key-create.response.500.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`api-key-create.response.500.error.traceId`; string, optional) — Unique ID for log correlation


Source: https://docs.sureshake.com/reference/api-keys/create/index.md
