Skip to main content
PUT
/
api
/
v1
/
auth
/
keys
/
{key_id}
/
default
Set Default API Key
curl --request PUT \
  --url https://api.mor.org/api/v1/auth/keys/{key_id}/default \
  --header 'Authorization: <authorization>'
{
  "id": 123,
  "key_prefix": "<string>",
  "name": "<string>",
  "created_at": "<string>",
  "is_active": true,
  "is_default": true,
  "encrypted_key": "<string>",
  "encryption_version": 123
}
Set an API key as the user’s default. Clears any existing default and sets the specified key as the new default. This affects which key is returned by the /api/v1/auth/keys/default endpoint.

Headers

Authorization
string
required
Bearer token (JWT) from OAuth2 login

Path Parameters

key_id
integer
required
The ID of the API key to set as default

Response

id
integer
Unique identifier for the API key
key_prefix
string
First few characters of the API key
name
string
Optional name for the API key
created_at
string
ISO 8601 timestamp of creation
is_active
boolean
Whether the key is currently active
is_default
boolean
Now set to true for this key
encrypted_key
string
Encrypted version of the full key
encryption_version
integer
Version of encryption used
Automatic Clearing: Setting a new default automatically clears the is_default flag from any other API keys. Only one key can be the default at a time.
You can only set your own API keys as default. Attempting to set another user’s key will result in a 404 error.
The API key must be active to be set as default. Inactive keys cannot be designated as the default key.
Use Case: Set a default key to ensure the same API key is used across your applications. This is especially useful when you have separate keys for development, staging, and production environments.