Ask Sage API Key Management API

API key operations

Business capability
Developer Identity & Credential Management BC-4270.40

Operations 6

POST /get-user-api-keys Get user API keys #
POST /user-api-key Create new API key #
DELETE /user-api-key Delete API key #
GET /get-api-key-scopes Get API key scopes #
POST /revoke-token Revoke token #
POST /revoke-user-api-key Revoke user API key #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/ask-sage:ask-sage-api-key-management-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

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 Specification

ask-sage-api-key-management-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Ask Sage User API — Full Response Reference API Key…
  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: API Key Management
  description: API key operations
paths:
  /get-user-api-keys:
    post:
      summary: Get user API keys
      tags:
      - API Key Management
      responses:
        '200':
          description: List of the user's API keys.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 123
                        date_time:
                          type: string
                          description: creation timestamp
                          example: '2026-01-01T00:00:00Z'
                        name:
                          type: string
                        user_id:
                          type: integer
                          example: 123
                        key:
                          type: string
                        token_scopes:
                          type: string
                          description: comma-separated scope list or null
                        revoked_at:
                          type: string
                          description: revocation timestamp or null
                        revoked_reason:
                          type: string
                  status:
                    type: string
                    description: 'string ''200'' on success (note: string, not integer)'
                    example: '200'
      operationId: postGetUserApiKeys
      x-operation-id-source: derived
  /user-api-key:
    post:
      summary: Create new API key
      tags:
      - API Key Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              properties:
                name:
                  type: string
                  description: Label for the new API key; required, lowercased and HTML-escaped before storage.
                token_scopes:
                  type: string
                  description: 'Optional comma-separated list of scopes restricting the key, e.g. "query,mcp". Allowed scopes: query, agent_builder, passthrough, mcp, plugins. Any invalid scope returns 400. Omit (or send empty) for an unrestricted key.'
                  example: query,mcp
      responses:
        '200':
          description: API key created; response is 'Success' and id is the new key id.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Success'' on creation'
                  id:
                    type: integer
                    description: id of the newly created API key
                    example: 123
                  status:
                    type: integer
                    example: 200
        '400':
          description: Missing required fields, invalid token_scopes format, or requested scope not permitted for the organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Bad request
                status: 400
        '403':
          description: Feature not available (role-capability or org-policy mint enforcement denied)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Forbidden
                status: 403
        '500':
          description: Internal error during key creation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Internal server error
                status: 500
      operationId: postUserApiKey
      x-operation-id-source: derived
    delete:
      summary: Delete API key
      tags:
      - API Key Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  example: 123
                  description: Numeric ID of the API key to delete; only a key owned by the requesting user is removed.
      responses:
        '200':
          description: API key deletion result envelope.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''OK'' on success'
                  status:
                    type: string
                    description: 'string ''200'' on success (note: string, not integer)'
                    example: '200'
      operationId: deleteUserApiKey
      x-operation-id-source: derived
  /get-api-key-scopes:
    get:
      summary: Get API key scopes
      description: Returns the scopes available/assigned for API keys.
      tags:
      - API Key Management
      responses:
        '200':
          description: List of API key scopes
      operationId: getGetApiKeyScopes
      x-operation-id-source: derived
  /revoke-token:
    post:
      summary: Revoke token
      description: Revoke a specific access token by its JTI, or the current token if no `jti` is provided.
      tags:
      - API Key Management
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                jti:
                  type: string
                  format: uuid
                  description: Token identifier to revoke; omit to revoke the current token
      responses:
        '200':
          description: Token revoked
      operationId: postRevokeToken
      x-operation-id-source: derived
  /revoke-user-api-key:
    post:
      summary: Revoke user API key
      description: Revoke an API key by id. The key remains in the database but is no longer valid.
      tags:
      - API Key Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - id
              properties:
                id:
                  type: integer
                  minimum: 1
                  description: Id of the API key to revoke. Must be a positive integer and must belong to the calling user.
                reason:
                  type: string
                  maxLength: 255
                  default: user_revoke
                  description: Optional free-text revocation reason recorded on the key. Non-string values fall back to the default; longer values are truncated to 255 characters.
      responses:
        '200':
          description: API key revoked. Revoking an already-revoked key is idempotent and also reports 200.
        '400':
          description: '`id` missing, not a positive integer, or the caller is a bot account.'
        '404':
          description: No API key with that id belongs to the calling user.
      operationId: postRevokeUserApiKey
      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)