Skip to main content
POST
/
keys
Create a new API key
curl --request POST \
  --url https://openrouter.ai/api/v1/keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "expires_at": "2027-12-31T23:59:59Z",
  "include_byok_in_limit": true,
  "limit": 50,
  "limit_reset": "monthly",
  "name": "My New API Key"
}
'
{
  "data": {
    "byok_usage": 0,
    "byok_usage_daily": 0,
    "byok_usage_monthly": 0,
    "byok_usage_weekly": 0,
    "created_at": "2025-08-24T10:30:00Z",
    "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
    "disabled": false,
    "expires_at": "2027-12-31T23:59:59Z",
    "hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
    "include_byok_in_limit": true,
    "label": "My New API Key",
    "limit": 50,
    "limit_remaining": 50,
    "limit_reset": "monthly",
    "name": "My New API Key",
    "updated_at": null,
    "usage": 0,
    "usage_daily": 0,
    "usage_monthly": 0,
    "usage_weekly": 0,
    "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
  },
  "key": "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"
}

Authorizations

Authorization
string
header
required

API key as bearer token in Authorization header

Body

application/json
name
string
required

Name for the new API key

Minimum string length: 1
Example:

"My New API Key"

creator_user_id
string | null

Optional user ID of the key creator. Only meaningful for organization-owned keys where a specific member is creating the key.

Minimum string length: 1
Example:

"user_2dHFtVWx2n56w6HkM0000000000"

expires_at
string<date-time> | null

Optional ISO 8601 UTC timestamp when the API key should expire. Must be UTC, other timezones will be rejected

Example:

"2027-12-31T23:59:59Z"

include_byok_in_limit
boolean

Whether to include BYOK usage in the limit

Example:

true

limit
number<double> | null

Optional spending limit for the API key in USD

Example:

50

limit_reset
enum<string> | null

Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.

Available options:
daily,
weekly,
monthly,
null
Example:

"monthly"

workspace_id
string<uuid>

The workspace to create the API key in. Defaults to the default workspace if not provided.

Example:

"0df9e665-d932-5740-b2c7-b52af166bc11"

Response

API key created successfully

data
object
required

The created API key information

Example:
{
"byok_usage": 17.38,
"byok_usage_daily": 17.38,
"byok_usage_monthly": 17.38,
"byok_usage_weekly": 17.38,
"created_at": "2025-08-24T10:30:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"disabled": false,
"expires_at": "2027-12-31T23:59:59Z",
"hash": "f01d52606dc8f0a8303a7b5cc3fa07109c2e346cec7c0a16b40de462992ce943",
"include_byok_in_limit": false,
"label": "sk-or-v1-0e6...1c96",
"limit": 100,
"limit_remaining": 74.5,
"limit_reset": "monthly",
"name": "My Production Key",
"updated_at": "2025-08-24T15:45:00Z",
"usage": 25.5,
"usage_daily": 25.5,
"usage_monthly": 25.5,
"usage_weekly": 25.5,
"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}
key
string
required

The actual API key string (only shown once)

Example:

"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"