Management API
Returns all API keys belonging to the authenticated user. Requires a management API key for authentication.
A management API key must be used as the Bearer token.
Successfully returned the list of API keys.
Unauthorized – Missing or invalid token.
Forbidden – The provided API key is not a management key.
Internal server error.
GET /v1/manage/api-keys HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"api_keys": [
{
"name": "my-production-key",
"team_id": "Default",
"created_at": 1715100000,
"is_management_key": false
},
{
"name": "admin-key",
"team_id": "Operations",
"created_at": 1715100500,
"is_management_key": true
}
]
}Creates a new API key for the authenticated user. Requires a management API key for authentication.
A management API key must be used as the Bearer token.
A unique name for the new API key. Only letters, numbers, hyphens, underscores, and whitespace are allowed.
my-new-keyPattern: ^[A-Za-z0-9_\s-]+$A team currently assigned to the authenticated user. Defaults to the team assigned to the management API key used for this request when omitted or blank. Legacy management keys without a team resolve to the system-managed Default team.
DefaultWhether the new key should have management permissions.
falseAPI key created successfully. The api_key value is only shown once.
The name of the created key.
The team assigned to the created key.
Whether the key has management permissions.
The API key token. Store it securely — it cannot be retrieved again.
Bad request – Invalid input, duplicate name, or key limit reached.
Unauthorized – Missing or invalid token.
Forbidden – The provided API key is not a management key.
POST /v1/manage/api-keys HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 67
{
"name": "my-new-key",
"team_id": "Default",
"is_management_key": false
}{
"name": "my-new-key",
"team_id": "Default",
"is_management_key": false,
"api_key": "[API-KEY]"
}Deletes an API key by name. Also removes any associated budget configurations. You cannot delete the management key currently being used to authenticate. Requires a management API key for authentication.
A management API key must be used as the Bearer token.
The name of the API key to delete.
my-old-keyAPI key deleted successfully.
trueThe name of the deleted key.
Bad request – Invalid input or attempting to delete the key in use.
Unauthorized – Missing or invalid token.
Forbidden – The provided API key is not a management key.
Not Found – The specified API key does not exist.
Internal server error.
DELETE /v1/manage/api-keys HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 21
{
"name": "my-old-key"
}{
"success": true,
"deleted": "my-old-key"
}Retrieves effective settings for one team. Admins may retrieve any team in the project. Members may retrieve only teams they are assigned to. Any user may provide team_id; when omitted, it defaults to the team assigned to the management API key. Legacy keys without a team use Default. Default always resolves to the global project configuration. Other teams without an explicit override use the global project configuration.
A management API key must be used as the Bearer token.
Team to retrieve. Default selects the global project configuration. Members must be assigned to the requested team. Omit to use the team assigned to the authenticated management API key, or Default for a legacy key without a team.
Successfully returned the current project settings.
Settings for one team. The optional team_id query parameter selects the team; when omitted, the team is derived from the authenticated API key, or Default for a legacy key without a team.
Allow individual API calls to define their own inference configurations. If disabled, the selected team's settings will be enforced for all requests.
falseSelected team. Legacy API keys without a team use Default.
Unauthorized – Missing or invalid token.
Forbidden – The provided API key is not a management key, or a member requested a team they are not assigned to.
Not Found – Project configuration or requested team not found.
Internal server error.
GET /v1/manage/project-configs HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"team_id": "Research",
"inference_config": {
"allowed_providers": [
"scaleway"
],
"eu_native": false,
"allow_quantization": true,
"allow_zero_data_retention": false,
"enable_model_fallback": true
},
"allow_overwrite": false
}Updates one team's project configuration. Pass team_id to select a team, or omit it to use the team assigned to the management API key. Default updates the global project configuration. Legacy keys without a team use Default. Restricted to project admins. Requires a management API key for authentication.
A management API key must be used as the Bearer token.
Team override to update. Default updates the global project configuration. Omit to use the team assigned to the authenticated management API key, or Default for a legacy key without a team.
Settings for one team. The optional team_id query parameter selects the team; when omitted, the team is derived from the authenticated API key, or Default for a legacy key without a team.
Allow individual API calls to define their own inference configurations. If disabled, the selected team's settings will be enforced for all requests.
falseProject configuration updated successfully.
Indicates whether the operation was successful.
trueBad Request – Invalid configuration or registry validation failed.
Unauthorized – Missing or invalid token.
Forbidden – Not a management key or user is not an admin.
Not Found – Project configuration not found.
Internal server error.
PUT /v1/manage/project-configs HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 217
{
"inference_config": {
"allowed_providers": [
"mistral",
"scaleway"
],
"preference": "speed",
"eu_native": false,
"allow_quantization": true,
"allow_zero_data_retention": false,
"enable_model_fallback": true
},
"allow_overwrite": false
}{
"success": true
}Removes a team's explicit settings so it uses the Default team configuration. The Default team configuration cannot be removed. Restricted to project admins. Requires a management API key for authentication.
A management API key must be used as the Bearer token.
Team override to remove. Default is the global project configuration and cannot be removed. Omit to use the team assigned to the authenticated management API key, or Default for a legacy key without a team.
Team override removed successfully.
Indicates whether the operation was successful.
trueInvalid team_id.
Unauthorized – Missing or invalid token.
Forbidden – Not a management key or user is not an admin.
Project configuration not found.
DELETE /v1/manage/project-configs HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"success": true
}Lists budget rules for the authenticated project. Non-admin management key holders receive only their effective rules; a generic * period is omitted when a specific rule overrides that period. Project admins receive all stored rules, including overridden generic rules. Results can be filtered by scope, period, team_id, user_id, and key_name.
A management API key must be used as the Bearer token.
Successfully returned budgets.
Invalid filter.
Unauthorized - Missing or invalid token.
Forbidden - The provided API key is not a management key.
Not Found - Project configuration not found.
Internal server error.
GET /v1/manage/budgets HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"budgets": [
{
"scope": "api-key",
"period": "monthly",
"amount": 1000,
"team_id": "Research",
"user_id": "auth0|1234567890",
"key_name": "prod-key"
}
]
}Creates or updates a budget period for the authenticated project. Restricted to project admins using a management API key. PUT is also supported with the same body.
A management API key must be used as the Bearer token.
Required for team scope. Use * for the default per-team budget or a project team name for a specific team.
nullRequired for user scope and concrete api-key budgets. Must be null or omitted when key_name is '*' for api-key scope.
nullRequired for api-key scope. Use '*' with user_id null for the default per-api-key budget; otherwise user_id is required and the key must belong to that user.
nullBudget saved successfully.
Indicates whether the operation was successful.
trueInvalid budget request.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Not Found - Project configuration not found.
Internal server error.
POST /v1/manage/budgets HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 103
{
"scope": "api-key",
"period": "monthly",
"user_id": "auth0|1234567890",
"key_name": "prod-key",
"amount": 1000
}{
"success": true
}Same behavior as POST /manage/budgets.
A management API key must be used as the Bearer token.
Required for team scope. Use * for the default per-team budget or a project team name for a specific team.
nullRequired for user scope and concrete api-key budgets. Must be null or omitted when key_name is '*' for api-key scope.
nullRequired for api-key scope. Use '*' with user_id null for the default per-api-key budget; otherwise user_id is required and the key must belong to that user.
nullBudget saved successfully.
Indicates whether the operation was successful.
trueInvalid budget request.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Not Found - Project configuration not found.
Internal server error.
PUT /v1/manage/budgets HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 93
{
"scope": "project",
"period": "daily",
"team_id": null,
"user_id": null,
"key_name": null,
"amount": 1
}{
"success": true
}Deletes a single budget period for the provided scope. Restricted to project admins using a management API key. The request body may be JSON, or the same fields may be provided as query parameters.
A management API key must be used as the Bearer token.
Required for team scope. Use * for the default per-team budget or a project team name for a specific team.
nullRequired for user scope and concrete api-key budgets. Must be null or omitted when key_name is '*' for api-key scope.
nullRequired for api-key scope. Use '*' with user_id null for the default per-api-key budget; otherwise user_id is required and the key must belong to that user.
nullBudget deleted successfully.
Indicates whether the operation was successful.
trueInvalid budget delete request.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Not Found - Project configuration not found.
Internal server error.
DELETE /v1/manage/budgets HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 89
{
"scope": "api-key",
"period": "monthly",
"user_id": "auth0|1234567890",
"key_name": "prod-key"
}{
"success": true
}Retrieves the current balance information of the authenticated project. Requires a management API key belonging to a project admin.
A management API key must be used as the Bearer token.
Successfully retrieved project balance.
The current balance of the user.
1234.56The currency in which the balance is expressed.
EURUnauthorized – Missing or invalid token.
Forbidden – Not a management key or user is not an admin.
Not Found – Project configuration not found.
Internal server error.
GET /v1/manage/balance HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"current_balance": 1234.56,
"currency": "EUR"
}Returns all members of the authenticated project. Requires a management API key belonging to a project admin.
A management API key must be used as the Bearer token.
Successfully returned the project members.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Not Found - Project configuration not found.
Internal server error.
GET /v1/manage/project-members HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"members": [
{
"id": "auth0|1234567890",
"name": "Alice Smith",
"email": "alice@example.com",
"role": "admin"
},
{
"id": "auth0|9876543210",
"name": "Bob Lee",
"email": "bob@example.com",
"role": "member"
}
]
}Invites one or more email addresses to the authenticated project with either the member or admin role. Up to 50 unique addresses can be supplied in one request. Requires a management API key belonging to a project admin.
A management API key must be used as the Bearer token.
Email addresses to invite. Duplicate addresses are ignored case-insensitively. Addresses that already belong to project members or have an existing invitation are reported as failures and are not invited.
Organization role granted to every invitee when the invitation is accepted.
memberPossible values: All invitations were created successfully.
One or more invitations could not be created.
Missing or invalid email addresses.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Not Found - Project configuration not found.
Internal server error.
POST /v1/manage/project-members HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 48
{
"emails": [
"alice@example.com"
],
"role": "member"
}{
"invitations": [
{
"id": "invitation_123",
"email": "alice@example.com"
}
],
"failures": []
}Returns the named teams for the authenticated project, including the system-managed Default team. Requires a management API key belonging to a project admin.
A management API key must be used as the Bearer token.
Successfully returned the project teams.
["Default","Platform","Customer Success"]Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Project not found.
Internal server error.
GET /v1/manage/teams HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"teams": [
"Default",
"Platform",
"Customer Success"
]
}Adds a unique custom team name to the authenticated project. Default is reserved. Requires a management API key belonging to a project admin.
A management API key must be used as the Bearer token.
The team name. Only letters, numbers, hyphens, underscores, and whitespace are allowed. Leading and trailing whitespace is removed. Default is reserved for the system-managed fallback team.
PlatformPattern: ^[A-Za-z0-9_\s-]+$Team created successfully.
PlatformInvalid JSON or team name.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Project not found.
A team with the same name already exists or the reserved Default name was used.
Internal server error.
POST /v1/manage/teams HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 22
{
"team_id": "Platform"
}{
"team_id": "Platform"
}Removes a custom team from the authenticated project. The system-managed Default team cannot be deleted. Members left without a team are assigned to Default. Requires a management API key belonging to a project admin.
A management API key must be used as the Bearer token.
The team name. Only letters, numbers, hyphens, underscores, and whitespace are allowed. Leading and trailing whitespace is removed. Default is reserved for the system-managed fallback team.
PlatformPattern: ^[A-Za-z0-9_\s-]+$Team deleted successfully.
PlatformInvalid JSON or team name, or an attempt to delete Default.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Team not found.
Internal server error.
DELETE /v1/manage/teams HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 22
{
"team_id": "Platform"
}{
"success": true,
"deleted": "Platform"
}Returns the project members assigned to a team. Requires a management API key belonging to a project admin.
A management API key must be used as the Bearer token.
Team membership returned successfully.
Platform["auth0|1234567890","auth0|9876543210"]Missing or invalid team name.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Team not found.
Internal server error.
GET /v1/manage/teams/members?team_id=text HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"team_id": "Platform",
"user_ids": [
"auth0|1234567890",
"auth0|9876543210"
]
}Assigns any number of project members to a team in one request. Existing assignments, including Default, are unchanged.
A management API key must be used as the Bearer token.
Platform["auth0|1234567890","auth0|9876543210"]Project members assigned successfully.
Invalid team, user IDs, or a user does not belong to this project.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Team not found.
Internal server error.
POST /v1/manage/teams/members HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 73
{
"team_id": "Platform",
"user_ids": [
"auth0|1234567890",
"auth0|9876543210"
]
}{
"team_id": "text",
"assigned": [
"text"
]
}Unassigns any number of project members from a team in one request. Removing Default requires every affected member to belong to another team. Removing a custom team restores Default for members who would otherwise have no team.
A management API key must be used as the Bearer token.
Platform["auth0|1234567890","auth0|9876543210"]Project members unassigned successfully.
Invalid team or user IDs, a user does not belong to this project, or removing Default would leave a member without a team.
Unauthorized - Missing or invalid token.
Forbidden - Not a management key or user is not an admin.
Team not found.
Internal server error.
DELETE /v1/manage/teams/members HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 73
{
"team_id": "Platform",
"user_ids": [
"auth0|1234567890",
"auth0|9876543210"
]
}{
"team_id": "text",
"unassigned": [
"text"
]
}Returns aggregated token and cost metrics bucketed by time and optionally by team, user, API key, model, or provider.
Time range
fromdefaults to the start of the current calendar day (UTC).untildefaults to the current moment (UTC).
Bucket sizes (bucket parameter)
1h
1 hour
1d
1 day (default)
1w
1 week
1M
1 month
1Y
1 year
Grouping (group_by parameter)
Comma-separated list of fields to group by (in addition to the time bucket). Valid fields: team_id, user_id, key_name, model, provider.
(omitted)
bucket only (default)
team_id
bucket + team_id
team_id,model
bucket + team_id + model
user_id
bucket + user_id
user_id,key_name
bucket + user_id + key_name
user_id,model
bucket + user_id + model
model
bucket + model
provider
bucket + provider
user_id,key_name,model
bucket + user_id + key_name + model
A management API key must be used as the Bearer token.
Inclusive start of the time range (ISO 8601 / RFC 3339). Defaults to the start of the current UTC day.
2025-05-01T00:00:00ZExclusive end of the time range (ISO 8601 / RFC 3339). Defaults to the current UTC moment.
2025-05-31T23:59:59ZTimescaleDB time_bucket interval for aggregation.
1dPossible values: Comma-separated list of fields to group by, in addition to the time bucket.
Valid fields: team_id, user_id, key_name, model, provider.
Examples: team_id, team_id,model, user_id,key_name,provider.
user_idFilter results to a single team.
ResearchFilter results to a single user.
user_42Filter results to a specific API key name.
Only effective when group_by includes key_name or used as a standalone filter.
prod-keyFilter results to a single model name.
gpt-4oFilter results to a single provider.
openaiFilter by whether the request used the project's own provider key.
true returns only BYOK usage, false excludes BYOK usage, and
null or omission returns all usage.
falseUsage rows matching the requested filters and grouping.
Resolved inclusive start of the queried range (UTC).
2025-05-01T00:00:00ZResolved exclusive end of the queried range (UTC).
2025-05-31T23:59:59ZThe bucket interval used for aggregation.
1dPossible values: The comma-separated group_by fields that were applied.
null when no grouping was requested.
user_idThe team_id filter that was applied, if any.
ResearchThe user_id filter that was applied, if any.
user_42The key_name filter that was applied, if any.
prod-keyThe model filter that was applied, if any.
gpt-4oThe provider filter that was applied, if any.
openaiThe BYOK filter that was applied. null means all usage.
falseInvalid query parameters.
Missing or invalid Bearer token.
Token does not have permission to access this resource.
Validation error (missing required parameters or wrong type).
Internal server error (DB unreachable, query timeout, etc.).
GET /v1/manage/usage HTTP/1.1
Host: api.cortecs.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"from": "2025-05-01T00:00:00Z",
"until": "2025-05-31T23:59:59Z",
"bucket": "1d",
"group_by": null,
"byok": null,
"rows": [
{
"bucket_start": "2025-05-01T00:00:00Z",
"bucket_end": "2025-05-02T00:00:00Z",
"request_count": 1240,
"input_tokens": 520000,
"output_tokens": 180000,
"total_tokens": 700000,
"audio_duration": 0,
"input_price": 1.56,
"output_price": 3.6,
"audio_price": 0,
"cache_read_price": 0.08,
"cache_write_price": 0.02,
"total_price": 5.26,
"cache_read_tokens": 40000,
"cache_write_tokens": 8000,
"character_count": 250000,
"speech_price": 0
}
]
}Last updated