openapi: 3.0.3
info:
title: Ask Sage Server Admin Token Requests API
description: 'Ask Sage is an AI-powered platform providing intelligent completions, knowledge management, and workflow automation.
## Base URL
`https://api.asksage.ai`
## Authentication
All endpoints require a valid JWT token passed via the `x-access-tokens` header, unless otherwise noted.
Obtain a token by authenticating through the User API (`/user/get-token-with-api-key`).
## Message Format
The `message` field in API requests can be either:
- A single string prompt: `"What is Ask Sage?"`
- An array of conversation messages: `[{"user": "me", "message": "what is Ask Sage?"}, {"user": "gpt", "message": "Ask Sage is an..."}]`
## Key Features
- **AI Completions** — Query multiple LLM providers with a unified interface
- **Knowledge Training** — Upload documents, files, and data to build custom datasets
- **Tabular Data** — Ingest and query structured data (CSV, XLSX) with natural language
- **Agent Builder** — Create, configure, and execute multi-step AI workflows
- **Plugins** — Extend capabilities with built-in and custom plugins
- **MCP Servers** — Connect to Model Context Protocol servers for tool integration'
version: '2.0'
contact:
name: Ask Sage Support
email: support@asksage.ai
url: https://asksage.ai
servers:
- url: '{baseUrl}/server'
description: Ask Sage Server 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
reason:
type: string
maxLength: 500
responses:
'200':
description: Token request submitted or auto-approved
/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
limit:
type: integer
default: 10
maximum: 100
responses:
'200':
description: Token requests retrieved
/admin-auto-approval-rule-get:
post:
summary: Get auto-approval rule (admin)
tags:
- Token Requests
responses:
'200':
description: Rule retrieved
/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
max_approve_amount:
type: integer
max_org_consumption_pct:
type: number
responses:
'200':
description: Rule updated
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-access-tokens
description: JWT authentication token. Obtain a token by calling the User API endpoint `/user/get-token-with-api-key` with your email and API key.