Skip to main content
POST
/
api
/
api-keys
Create API Key (User)
curl --request POST \
  --url https://api.ai2fin.com/api/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "My MCP Integration",
  "scopes": [
    "mcp:full"
  ],
  "expiresInDays": 90
}
'
{
  "id": "<string>",
  "key": "<string>",
  "name": "<string>",
  "scopes": [
    "<string>"
  ],
  "expiresAt": "<string>",
  "createdAt": "<string>",
  "warning": "Save this key now - it will not be shown again!"
}

Authorizations

Authorization
string
header
required

JWT token obtained from /api/auth/login endpoint. Use for standard API access and OAuth-based integrations.

Body

application/json
name
string
required
Example:

"My MCP Integration"

scopes
enum<string>[]

Scopes for the API key. Defaults to mcp:full. Admin scope (*) is not allowed for user-created keys.

Available options:
mcp:read,
mcp:tools:list,
mcp:tools:call,
mcp:resources:read,
mcp:full
expiresInDays
integer
default:90
Required range: 1 <= x <= 365
Example:

90

Response

API key created

id
string
key
string

API key - only shown once! Save immediately.

name
string
scopes
string[]
expiresAt
string
createdAt
string
warning
string
Example:

"Save this key now - it will not be shown again!"