Ask Sage Token Requests API
Token request and approval workflow
Token request and approval workflow
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/ask-sage:ask-sage-token-requests-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Ask Sage User API — Full Response Reference Token Requests…
description: 'Ask Sage User API for account management, organization administration, billing, and platform configuration.
## Base URL
`https://api.asksage.ai/user`
## Authentication
Most endpoints require a valid JWT token sent in the `x-access-tokens` HTTP header. Secured endpoints show a padlock in Swagger UI / Redoc — click **Authorize** and paste your token once to apply it to every request.
Get a token from `/get-token-with-api-key` (your email + 64-character API key), then send it on each call:
`x-access-tokens: `
**No token required:** `/get-token-with-api-key`, `/register`, `/verify-email`, `/lost-pass`, and `GET /get-headers`.
Beyond a valid token, admin (`admin-*`) and superadmin (`superadmin-*`) endpoints require the caller to hold the matching role, and many identify the target user via an `email` field in the request body.
## Key Features
- **User Management** — Profile updates, API key management, login history
- **Chat Sessions** — Create, retrieve, and manage conversation history
- **Dataset Management** — Create datasets, manage permissions and assignments
- **Workbooks** — Organize research with sources and memos
- **Organization Admin** — User management, token allocation, usage reporting
- **Superadmin** — Platform-wide administration and analytics'
version: '2.0'
contact:
name: Support
email: support@asksage.ai
url: https://asksage.ai
servers:
- url: '{baseUrl}/user'
description: Ask Sage User API
variables:
baseUrl:
default: https://api.asksage.ai
description: API base URL. Use https://api.asksage.ai for production, or your self-hosted instance URL.
security:
- ApiKeyAuth: []
tags:
- name: Token Requests
description: Token request and approval workflow
paths:
/request-tokens:
post:
summary: Request more tokens
description: Submit a request for additional tokens. May be auto-approved if an auto-approval rule is configured.
tags:
- Token Requests
requestBody:
content:
application/json:
schema:
type: object
properties:
requested_amount:
type: integer
minimum: 1
description: Number of tokens requested
example: 100000
reason:
type: string
maxLength: 500
description: Optional free-text justification for the token request, shown to the reviewing admin; limited to 500 characters.
token_type:
type: string
example: inference
description: 'Which token pool the request applies to: ''inference'' tokens (chat/query usage) or ''training'' tokens (fine-tuning).'
enum:
- inference
- training
default: inference
triggered_by_auto_increase_exhaustion:
type: boolean
description: Set true when the request is raised automatically because an auto-increase token pool was exhausted; recorded as the request source ('auto_increase_exhausted' vs 'user_request').
default: false
responses:
'200':
description: Token request created or auto-approved; response is an object describing the request.
content:
application/json:
schema:
type: object
properties:
response:
type: object
properties:
request_id:
type: integer
example: 1
status:
type: string
description: '''pending'' or ''auto_approved'''
old_tokens:
type: integer
description: present only on auto_approved
example: 100000
new_tokens:
type: integer
description: present only on auto_approved
example: 200000
status:
type: integer
example: 200
'400':
description: Invalid token_type/requested_amount/reason, user not found, existing pending request, or denial cooldown active
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
response: Bad request
status: 400
'409':
description: A token distribution is in progress (advisory lock not acquired)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
response: Conflict
status: 409
operationId: postRequestTokens
x-operation-id-source: derived
/get-my-token-requests:
post:
summary: Get my token requests
description: Get the current user's token request history
tags:
- Token Requests
requestBody:
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: 'Optional filter returning only the caller''s token requests in this exact status (known values: ''pending'', ''approved'', ''auto_approved'', ''denied''); omit to return all statuses.'
limit:
type: integer
default: 10
maximum: 100
example: 50
description: Maximum number of the caller's most recent token requests to return, ordered newest first.
minimum: 1
responses:
'200':
description: List of the caller's token requests.
content:
application/json:
schema:
type: object
properties:
response:
type: array
items:
type: object
properties:
id:
type: integer
example: 123
user_id:
type: integer
example: 123
organization_id:
type: integer
example: 1
requested_amount:
type: integer
example: 100000
allocation_at_request:
type: integer
usage_at_request:
type: integer
reason:
type: string
status:
type: string
description: pending | auto_approved | denied | ...
source:
type: string
description: user_request | auto_increase_exhausted | ...
token_type:
type: string
description: inference | training
example: inference
reviewed_by:
type: integer
reviewed_at:
type: string
description: ISO-8601 datetime or null
created_at:
type: string
description: ISO-8601 datetime
example: '2026-01-01T00:00:00Z'
status:
type: integer
example: 200
operationId: postGetMyTokenRequests
x-operation-id-source: derived
/admin-auto-approval-rule-get:
post:
summary: Get auto-approval rule (admin)
tags:
- Token Requests
responses:
'200':
description: Auto-approval rule for the org, or null
content:
application/json:
schema:
type: object
properties:
response:
type: object
description: Null when no rule configured
properties:
id:
type: integer
example: 123
organization_id:
type: integer
example: 1
enabled:
type: boolean
max_approve_amount:
type: integer
max_org_consumption_pct:
type: integer
created_by:
type: integer
created_at:
type: string
format: date-time
example: '2026-01-01T00:00:00Z'
updated_at:
type: string
format: date-time
example: '2026-01-01T00:00:00Z'
status:
type: integer
example: 200
'400':
description: Admin has no organization, or internal error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
response: Bad request
status: 400
operationId: postAdminAutoApprovalRuleGet
x-operation-id-source: derived
/admin-auto-approval-rule-update:
post:
summary: Update auto-approval rule (admin)
tags:
- Token Requests
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
enabled:
type: boolean
description: Whether automatic approval of token requests is active for your organization.
default: true
max_approve_amount:
type: integer
description: Largest token amount a single request may ask for and still be auto-approved; must be a positive integer.
default: 500000
minimum: 1
max_org_consumption_pct:
type: number
description: Auto-approval is suppressed once the organization's token consumption reaches this percentage of its pool; must be an integer between 0 and 100.
default: 90
minimum: 0
maximum: 100
responses:
'200':
description: Auto-approval rule created or updated
content:
application/json:
schema:
type: object
properties:
response:
type: string
status:
type: integer
example: 200
'400':
description: Invalid JSON body, no org, invalid max_approve_amount, invalid max_org_consumption_pct, or internal error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
response: Bad request
status: 400
operationId: postAdminAutoApprovalRuleUpdate
x-operation-id-source: derived
components:
schemas:
ErrorResponse:
type: object
description: Standard Ask Sage error envelope.
properties:
response:
type: string
description: Human-readable error message.
status:
type: integer
example: 400
description: HTTP-style status code (usually an integer; some endpoints return it as a numeric string).
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-access-tokens
description: JWT authentication token. Obtain a token by calling `/get-token-with-api-key` with your email and 64-character API key. Some admin and superadmin endpoints also require an email address in the request body to identify the target user.
x-provenance:
method: harvested
publisher: Ask Sage
source: https://docs.asksage.ai/api-docs/specs/user-api-spec.json
note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
stamped by stamp-openapi-provenance.py (roadmap#793)