Ask Sage Widgets API

Widget/bot management

Operations 8

POST /add-widget Add widget #
PUT /update-widget Update widget #
GET /list-widgets List widgets #
POST /list-widgets List widgets (POST) #
DELETE /delete-widget Delete widget #
POST /leaderboard-models List leaderboard models #
POST /leaderboard-models-details/{model_id} Get leaderboard model details #
POST /leaderboard-vote Vote on a leaderboard model #

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-widgets-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

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-widgets-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Ask Sage User API — Full Response Reference Widgets API
  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: Widgets
  description: Widget/bot management
paths:
  /add-widget:
    post:
      summary: Add widget
      tags:
      - Widgets
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - model
              - persona
              - whitelisted_domains
              properties:
                name:
                  type: string
                  description: Display name for the widget; falls back to 'Widget 1' when blank or omitted. Optional; defaults to 'Widget 1'.
                  default: Widget 1
                model:
                  type: string
                  example: gpt-4.1-mini
                  description: Identifier of the LLM the widget queries with (a model name as returned by /get-models); required and must be a non-empty string.
                persona:
                  type: integer
                  description: Numeric ID of the persona (the system prompt/personality) applied to the widget's chats; required and must be an integer despite the string field type.
                whitelisted_domains:
                  type: array
                  items:
                    type: string
                  description: Domains permitted to embed and call the widget; each entry must be a valid domain (protocol optional) and at least one is required.
                  minItems: 1
                datasets:
                  type: array
                  items:
                    type: string
                  description: Dataset names the widget is allowed to search; the requesting user must have at least read access to every one listed.
                  default: []
                endpoint_allowlist:
                  type: array
                  items:
                    type: string
                    enum:
                    - query
                    - query_with_file
                    - get-models
                    - get-datasets
                  description: API endpoints the widget's token may call; omit or send null to allow all endpoints, or an empty array to allow none.
                branding:
                  type: object
                  description: 'Optional appearance-customization object; only the keys title, welcome_message, primary_color, header_text_color, background_color, text_color, mode (''light'' or ''dark''), and collapsed_references are accepted (colors must be #RGB/#RRGGBB hex, strings max 255 chars).'
      responses:
        '200':
          description: Widget created. Returns the new widget's UUID.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Widget created successfully'''
                  widget_id:
                    type: string
                    description: Generated widget UUID
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled, missing required fields (model/persona/whitelisted_domains), invalid model/persona/domain/datasets, invalid endpoint_allowlist or branding, or internal error. Envelope {response:<message>, status:400}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Bad request
                status: 400
        '401':
          description: User lacks access to one or more requested datasets ({response:"You don't have access to the datasets", status:401}); or missing/invalid auth token (token_required).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: postAddWidget
      x-operation-id-source: derived
  /update-widget:
    put:
      summary: Update widget
      tags:
      - Widgets
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - widget_id
              properties:
                widget_id:
                  type: integer
                  example: 1
                  description: Integer primary-key ID of the widget to update; required, and the widget must belong to the requesting user.
                name:
                  type: string
                  description: New display name; only applied when provided, and must then be a non-empty string.
                model:
                  type: string
                  example: gpt-4.1-mini
                  description: New model identifier the widget queries with; only applied when provided, and must then be a non-empty string.
                persona:
                  type: integer
                  description: New persona ID (system prompt/personality); only applied when provided, and must then be an integer despite the string field type.
                whitelisted_domains:
                  type: array
                  items:
                    type: string
                  description: Replacement list of domains permitted to embed and call the widget; only applied when provided, and must then be a non-empty array of valid domains.
                datasets:
                  type: array
                  items:
                    type: string
                  description: Replacement list of dataset names the widget may search; only applied when provided, and the user must have at least read access to each.
                endpoint_allowlist:
                  type: array
                  items:
                    type: string
                    enum:
                    - query
                    - query_with_file
                    - get-models
                    - get-datasets
                  description: Replacement list of API endpoints the widget's token may call; omit to leave unchanged, send null to clear (allow all), an empty array to allow none, or a list to set.
                branding:
                  type: object
                  description: Replacement appearance-customization object; omit to leave unchanged, send null to clear, or an object using only the allowed branding keys (title, welcome_message, primary_color, header_text_color, background_color, text_color, mode, collapsed_references).
      responses:
        '200':
          description: Widget updated. Echoes the widget's integer id.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Widget updated successfully'''
                  widget_id:
                    type: integer
                    description: The widget's integer id
                    example: 1
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled, missing/invalid widget_id (must be integer), invalid model/name/persona/domains/datasets, invalid endpoint_allowlist or branding, or internal error. Envelope {response:<message>, status:400}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Bad request
                status: 400
        '403':
          description: 'User lacks access to one or more requested datasets. Envelope {response:"You don''t have access to the following datasets: ...", status:403}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Forbidden
                status: 403
        '404':
          description: 'Widget not found (or soft-deleted) for this user. Envelope {response:''Not found'', status:404}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Not found
                status: 404
        '401':
          description: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: putUpdateWidget
      x-operation-id-source: derived
  /list-widgets:
    get:
      summary: List widgets
      tags:
      - Widgets
      responses:
        '200':
          description: List of the user's non-deleted widgets with total count.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 123
                        name:
                          type: string
                        widget_id:
                          type: string
                          description: widget_uuid
                        model:
                          type: string
                          example: gpt-4.1-mini
                        persona:
                          type: integer
                          example: 1
                        whitelisted_domains:
                          type: array
                          items:
                            type: string
                        datasets:
                          type: array
                          items:
                            type: string
                        endpoint_allowlist:
                          type: array
                          items:
                            type: string
                          description: null when unset (allow all in vocabulary)
                        branding:
                          type: object
                          description: Parsed branding blob (title, welcome_message, colors, mode, collapsed_references); null when unset
                  count:
                    type: integer
                    example: 10
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled ({response:''Disabled.'', status:400}); or internal error surfaced by the service. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Bad request
                status: 400
        '404':
          description: 'Handler-level failure retrieving list. Envelope {response:''Failed to retrieve widget list'', status:404}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Not found
                status: 404
        '401':
          description: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: getListWidgets
      x-operation-id-source: derived
    post:
      summary: List widgets (POST)
      tags:
      - Widgets
      responses:
        '200':
          description: List of the user's non-deleted widgets with total count.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 123
                        name:
                          type: string
                        widget_id:
                          type: string
                          description: widget_uuid
                        model:
                          type: string
                          example: gpt-4.1-mini
                        persona:
                          type: integer
                          example: 1
                        whitelisted_domains:
                          type: array
                          items:
                            type: string
                        datasets:
                          type: array
                          items:
                            type: string
                        endpoint_allowlist:
                          type: array
                          items:
                            type: string
                          description: null when unset
                        branding:
                          type: object
                          description: Parsed branding blob; null when unset
                  count:
                    type: integer
                    example: 10
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled or internal error. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Bad request
                status: 400
        '404':
          description: 'Handler-level failure retrieving list. Envelope {response:''Failed to retrieve widget list'', status:404}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Not found
                status: 404
        '401':
          description: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: postListWidgets
      x-operation-id-source: derived
  /delete-widget:
    delete:
      summary: Delete widget
      tags:
      - Widgets
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - widget_id
              properties:
                widget_id:
                  type: integer
                  example: 1
                  description: Numeric id of the widget to delete; must belong to the authenticated user.
      responses:
        '200':
          description: Widget soft-deleted. Echoes the widget's integer id.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Widget deleted successfully'''
                  widget_id:
                    type: integer
                    example: 1
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled, missing widget_id, invalid widget_id (must be integer), or internal error. Envelope {response:<message>, status:400}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Bad request
                status: 400
        '404':
          description: 'Widget not found (or already soft-deleted) for this user. Envelope {response:''Not found'', status:404}. NOTE: this outcome is returned with HTTP 200; the code appears only in the JSON body ''status'' field.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Not found
                status: 404
        '401':
          description: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: deleteDeleteWidget
      x-operation-id-source: derived
  /leaderboard-models:
    post:
      summary: List leaderboard models
      description: Returns models with vote tallies and the caller's votes.
      tags:
      - Widgets
      responses:
        '200':
          description: Leaderboard models with vote counts
      operationId: postLeaderboardModels
      x-operation-id-source: derived
  /leaderboard-models-details/{model_id}:
    post:
      summary: Get leaderboard model details
      tags:
      - Widgets
      parameters:
      - in: path
        name: model_id
        schema:
          type: integer
        required: true
      responses:
        '200':
          description: Leaderboard model details
      operationId: postLeaderboardModelsDetailsByModelId
      x-operation-id-source: derived
  /leaderboard-vote:
    post:
      summary: Vote on a leaderboard model
      description: Record the caller's up/down vote for a leaderboard model. One vote per user per model — a second vote is rejected rather than replacing the first.
      tags:
      - Widgets
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - model_id
              - vote
              properties:
                model_id:
                  type: integer
                vote:
                  type: integer
                  enum:
                  - 1
                  - -1
                  description: Required. `1` for an up-vote, `-1` for a down-vote. Any other value (or omitting the field) is rejected.
      responses:
        '200':
          description: 'Always HTTP 200. The JSON body carries the outcome in a ''status'' field, which on this endpoint is a **string**, not an integer: ''200'' with ''Vote recorded'' on success; ''400'' ''Invalid input'' if model_id is missing or vote is not 1 or -1; ''400'' ''User has already voted for this model''; ''404'' ''Model not found''. The HTTP status code is not used to signal errors.'
      operationId: postLeaderboardVote
      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)