---
title: "Create a new API key"
method: POST
path: "/developers/api_keys"
tags: ["API Keys"]
---

# Create a new API key

`POST /developers/api_keys`

## Request

- Base URL: `https://gateway.prem.io`
- URL: `https://gateway.prem.io/developers/api_keys`
- Auth: HTTP bearer

Create a new API key for the organization

## Request body

- CreateDeveloperApiKeyRequest: Request body for creating a new API key
  - `label` string, required: Human-readable label for the API key. Trimmed, and must contain at least one printable character.
  - `description` string: Human-readable description for the API key
  - `scopes` string[], required: List of scopes this API key has access to
  - `ip_allow_list` string[]: List of IP addresses allowed to use this API key
  - `expires_at` string, mysql-date-time, nullable: Timestamp when the API key expires

## Response `200`

Successful API key creation response

- object
  - `status` 200 | 201 | 202, required: Status code of the response
  - `data` object, nullable, required: Response data containing the requested object
    - `id` string, required: Unique identifier for the API key
    - `label` string: Human-readable label for the API key
    - `description` string, nullable: Optional description for the API key
    - `scopes` string[], required: List of scopes this API key has access to
    - `ip_allow_list` string[]: List of IP addresses allowed to use this API key
    - `expires_at` string, mysql-date-time, nullable: Timestamp when the API key expires
    - `secret` string: Secret key value (only returned when creating a new API key)
    - `created_at` string, mysql-date-time, required: Timestamp when the API key was created
    - `updated_at` string, mysql-date-time, nullable, required: Timestamp when the API key was last updated
    - `source` string, nullable: Integration that owns this key (e.g. "sotto"). Null for keys created directly in the dashboard.
    - `billing_mode` string: Billing mode for the API key. API usage is charged to the organization balance.
    - `metrics` ApiKeyMetrics
      - `api_key_id` string: Unique identifier for the webhook
      - `total_requests` integer: Total number of webhook deliveries
      - `last_used_at` string, mysql-date-time, nullable: Timestamp when the API key was last used
  - `error` string, nullable: Error message of the response, human readable
  - `message` string, nullable, required: Message of the response, human readable
  - `env` 'development' | 'production', required: API environment
  - `log` union: Useful informaiton, not always present, to debug the response
    - string
    - object
  - `validator` union: Validator response object, each key is the field name and value is the error message
    - object
    - unknown[]
      - unknown
  - `support_id` string, uuid, nullable: Support ID linked to the response, used to identify it when talking with our team.

## Other responses

- `400`: Bad request
- `401`: Access token is missing or invalid
- `403`: You do not have the required permissions to access this resource

## Changes

- **2026-11-13** `d46bc3931b34`: 1 breaking, 9 warning, 2 info
  - the `label` request property's minLength was increased from `0` to `1`
  - added the new `405.00` enum value to the `allOf[subschema #1]/status` response property for the response status `401`
  - added the new `405.00` enum value to the `allOf[subschema #1]/status` response property for the response status `403`
  - added the new `405.00` enum value to the `status` response property for the response status `400`
  - …8 more
- **2026-10-16** `d5b1beb33be5`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/premai-io/apis/prem-studio-api/changes/developers/api_keys/post.md)

---

[API](https://skmtc.dev/premai-io/apis/prem-studio-api.md) - [All operations](https://skmtc.dev/premai-io/apis/prem-studio-api/llms.txt) - [OpenAPI document](https://skmtc.dev/premai-io/apis/prem-studio-api/revisions/d46bc3931b34?raw)
