# API Keys API

> Workspace API keys. Keys are stored hashed; the secret is shown once.

Base URL: `https://api.socialit.com/v1`. Authenticate with `Authorization: Bearer <API key or OAuth token>`.

## Verify the current credential

`GET /auth/verify`

Returns the workspace, permission and scopes of the API key or OAuth token used.

Access: `read` · MCP tool: `verify-credential` · Zernio: `GET /v1/auth/verify`

```bash
curl "https://api.socialit.com/v1/auth/verify" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "credential",
  "type": "api_key",
  "workspace": {
    "id": "string",
    "name": "string"
  },
  "permission": "full",
  "scopes": [
    "string"
  ],
  "api_key_id": "string",
  "client_id": "string",
  "user_id": "string",
  "profile_ids": [
    "string"
  ]
}
```

## List API keys

`GET /api-keys`

Access: `admin` · MCP tool: `list-api-keys` · Zernio: `GET /v1/api-keys`

### Query parameters

- `page` (integer; ≥ 1): Page number
- `limit` (integer; 1–100): Items per page (max 100)
- `sort` (string; one of created_at, last_used_at, name)
- `order` (string; one of asc, desc)
- `match` (string; one of all, or): Combine filters with AND (default) or OR
- `name` (string)

```bash
curl "https://api.socialit.com/v1/api-keys" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "list",
  "data": [
    {
      "object": "api_key",
      "id": "string",
      "name": "string",
      "permission": "full",
      "profile_ids": [
        "string"
      ],
      "prefix": "string",
      "key": "string",
      "last_used_at": "2026-10-13T09:00:00.000Z",
      "expires_at": "2026-10-13T09:00:00.000Z",
      "created_at": "2026-10-13T09:00:00.000Z"
    }
  ],
  "page": 1,
  "limit": 1,
  "total": 1,
  "has_more": true,
  "next_page_url": "https://example.com",
  "previous_page_url": "https://example.com"
}
```

## Create an API key

`POST /api-keys`

The response contains the secret key. It is never shown again.

Access: `admin` · MCP tool: `create-api-key` · Zernio: `POST /v1/api-keys`

### Headers

- `Idempotency-Key` (string; ≤ 255 characters): Unique key (for example a UUID) that makes retries safe: a repeated request with the same key and body returns the first response (Idempotent-Replayed: true) for 24 hours.

### Body

- `name` (string; required; 1–100 characters)
- `permission` (string; one of full, read)
- `profile_ids` (array of string | null; ≤ 500 items): Restrict the key to these profiles (null = all)
- `expires_at` (string (date-time) | null)
- `expires_in_days` (integer; 1–3650): Alternative to expires_at

```bash
curl -X POST "https://api.socialit.com/v1/api-keys" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "permission": "full",
    "profile_ids": [
      "string"
    ],
    "expires_at": "2026-10-13T09:00:00.000Z",
    "expires_in_days": 1
  }'
```

Response 201:

```json
{
  "object": "api_key",
  "id": "string",
  "name": "string",
  "permission": "full",
  "profile_ids": [
    "string"
  ],
  "prefix": "string",
  "key": "string",
  "last_used_at": "2026-10-13T09:00:00.000Z",
  "expires_at": "2026-10-13T09:00:00.000Z",
  "created_at": "2026-10-13T09:00:00.000Z"
}
```

## Get an API key

`GET /api-keys/{id}`

Access: `admin` · MCP tool: `get-api-key`

### Path parameters

- `id` (string; required; 1–80 characters): apiKey id (key_…)

```bash
curl "https://api.socialit.com/v1/api-keys/key_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "api_key",
  "id": "string",
  "name": "string",
  "permission": "full",
  "profile_ids": [
    "string"
  ],
  "prefix": "string",
  "key": "string",
  "last_used_at": "2026-10-13T09:00:00.000Z",
  "expires_at": "2026-10-13T09:00:00.000Z",
  "created_at": "2026-10-13T09:00:00.000Z"
}
```

## Update an API key

`PATCH /api-keys/{id}`

Access: `admin` · MCP tool: `update-api-key`

### Path parameters

- `id` (string; required; 1–80 characters): apiKey id (key_…)

### Body

- `name` (string; 1–100 characters)
- `permission` (string; one of full, read)
- `profile_ids` (array of string | null; ≤ 500 items): Restrict the key to these profiles (null = all)
- `expires_at` (string (date-time) | null)

```bash
curl -X PATCH "https://api.socialit.com/v1/api-keys/key_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "permission": "full",
    "profile_ids": [
      "string"
    ],
    "expires_at": "2026-10-13T09:00:00.000Z"
  }'
```

Response 200:

```json
{
  "object": "api_key",
  "id": "string",
  "name": "string",
  "permission": "full",
  "profile_ids": [
    "string"
  ],
  "prefix": "string",
  "key": "string",
  "last_used_at": "2026-10-13T09:00:00.000Z",
  "expires_at": "2026-10-13T09:00:00.000Z",
  "created_at": "2026-10-13T09:00:00.000Z"
}
```

## Delete an API key

`DELETE /api-keys/{id}`

Revokes the key immediately.

Access: `admin` · MCP tool: `delete-api-key` · Zernio: `DELETE /v1/api-keys/{keyId}`

### Path parameters

- `id` (string; required; 1–80 characters): apiKey id (key_…)

```bash
curl -X DELETE "https://api.socialit.com/v1/api-keys/key_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "api_key",
  "id": "string",
  "deleted": true
}
```

## Regenerate an API key

`POST /api-keys/{id}/regenerate`

Issues a new secret for the same key; the old secret stops working.

Access: `admin` · MCP tool: `regenerate-api-key`

### Path parameters

- `id` (string; required; 1–80 characters): apiKey id (key_…)

```bash
curl -X POST "https://api.socialit.com/v1/api-keys/key_2Jx0Fq5Pz8vYkB3mN6rT1wQ9sLd/regenerate" \
  -H "Authorization: Bearer $SOCIALIT_API_KEY"
```

Response 200:

```json
{
  "object": "api_key",
  "id": "string",
  "name": "string",
  "permission": "full",
  "profile_ids": [
    "string"
  ],
  "prefix": "string",
  "key": "string",
  "last_used_at": "2026-10-13T09:00:00.000Z",
  "expires_at": "2026-10-13T09:00:00.000Z",
  "created_at": "2026-10-13T09:00:00.000Z"
}
```


---

Source: https://socialit.com/docs/api-reference/api-keys/
