Ask Sage Chat Management API

Chat session operations

Operations 8

POST /get-chats Get all chat sessions for user #
POST /get-chat-session Get specific chat session #
POST /delete-chat-session Delete chat session #
POST /append-chat Append chat message #
POST /copy-chat Copy chat session to another user #
POST /create-chat-session Create new chat session #
POST /update-chat-session-title Update chat session title #
POST /update-chat-session-json Update chat session JSON data #

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-chat-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-chat-management-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Ask Sage User API — Full Response Reference Chat Management…
  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: Chat Management
  description: Chat session operations
paths:
  /get-chats:
    post:
      summary: Get all chat sessions for user
      tags:
      - Chat Management
      responses:
        '200':
          description: All chat sessions for user. 'response' is a JSON-encoded string of {chats:[{id, content}], buttons:[{key, content, mode_type}]}.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: 'JSON-encoded string: {"chats":[{"id":<uuid>,"content":[<msg>]|-1}], "buttons":[{"key":<uuid>,"content":<title>,"mode_type":"chat|code|prose"}]}'
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled 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: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: postGetChats
      x-operation-id-source: derived
  /get-chat-session:
    post:
      summary: Get specific chat session
      tags:
      - Chat Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - session_id
              properties:
                session_id:
                  type: string
                  format: uuid
                  example: 00000000-0000-0000-0000-000000000000
                  description: UUID of the caller's saved chat session to retrieve; must be a valid UUID and owned by the authenticated user.
      responses:
        '200':
          description: 'Chat session found. ''response'' is a JSON-encoded string of an object {session_id: str, content: [message objects]}.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: 'JSON-encoded string: {"session_id": <uuid>, "content": [<message dicts>]}'
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled, missing/invalid session_id, 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: 'Session not found for this user. Envelope {response:''Session 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: postGetChatSession
      x-operation-id-source: derived
  /delete-chat-session:
    post:
      summary: Delete chat session
      tags:
      - Chat Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - session_id
              properties:
                session_id:
                  type: string
                  format: uuid
                  example: 00000000-0000-0000-0000-000000000000
                  description: UUID of the caller's chat session to permanently delete; must be a valid UUID and owned by the authenticated user.
      responses:
        '200':
          description: Chat session deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Chat session deleted'''
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Missing/invalid session_id 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: 'Session not found for this user. Envelope {response:''Session 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: postDeleteChatSession
      x-operation-id-source: derived
  /append-chat:
    post:
      summary: Append chat message
      tags:
      - Chat Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chats:
                  type: object
                  description: Wrapper object holding the conversation; must contain a 'chats' key whose value is an array of message objects (each with 'user' and/or 'message'), which are saved as a new chat session.
                chat_title:
                  type: string
                  description: Title for the new chat session; required and non-empty, truncated to 50 characters.
                  maxLength: 50
              required:
              - chats
              - chat_title
      responses:
        '200':
          description: New chat session created from the appended messages.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Chats updated'''
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Missing/malformed ''chats'' or ''chat_title'', invalid message format, bot user disabled, invalid user, or internal error. Envelope {response:<message>, status:400} (status may be int 400 or string ''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: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: postAppendChat
      x-operation-id-source: derived
  /copy-chat:
    post:
      summary: Copy chat session to another user
      tags:
      - Chat Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - chat_id
              - email
              properties:
                chat_id:
                  type: string
                  format: uuid
                  description: UUID of the source chat session to copy. Must belong to the calling user.
                email:
                  type: string
                  format: email
                  description: Email of the recipient user who receives the copy. The recipient must exist and share the caller's email domain or organization; the copied session is titled 'Copy of <original title>'.
                  example: user@example.com
      responses:
        '200':
          description: Chat copied to destination user.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Chats copied'''
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Missing/invalid chat_id or email, invalid dest email, dest user missing, source session missing, bot user disabled, cross-org/cross-domain denial (envelope from is_from_same_domain), 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
        '401':
          description: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: postCopyChat
      x-operation-id-source: derived
  /create-chat-session:
    post:
      summary: Create new chat session
      tags:
      - Chat Management
      responses:
        '200':
          description: New chat session created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Chat session created'''
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled 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: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  description: Title for the new chat session; truncated to 50 characters.
                  default: New Chat
                  maxLength: 50
                json_data:
                  type: array
                  items: {}
                  description: Optional array of message objects to seed the session with; a non-list value is treated as empty.
                  default: []
                session_id:
                  type: string
                  example: 00000000-0000-0000-0000-000000000000
                  description: Optional client-supplied UUID for the session; a new UUID is generated if omitted or if the value is not a valid UUID.
      operationId: postCreateChatSession
      x-operation-id-source: derived
  /update-chat-session-title:
    post:
      summary: Update chat session title
      tags:
      - Chat Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - session_id
              - new_title
              properties:
                session_id:
                  type: string
                  format: uuid
                  example: 00000000-0000-0000-0000-000000000000
                  description: UUID of the caller's chat session whose title is being updated; must be a valid UUID and owned by the authenticated user.
                new_title:
                  type: string
                  minLength: 1
                  description: New session title. Must be non-empty; if absent or empty the response body reports status 400 with message 'Missing data' (the HTTP status is still 200).
      responses:
        '200':
          description: Chat session title updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Title updated'''
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Missing session_id/new_title 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: 'Session not found for this user. Envelope {response:''Session 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: postUpdateChatSessionTitle
      x-operation-id-source: derived
  /update-chat-session-json:
    post:
      summary: Update chat session JSON data
      tags:
      - Chat Management
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - session_id
              properties:
                session_id:
                  type: string
                  format: uuid
                  example: 00000000-0000-0000-0000-000000000000
                  description: UUID of the caller's chat session whose message content is being replaced; must be owned by the authenticated user.
                title:
                  type: string
                  description: Session title. Optional in the request, but the server ALWAYS rewrites the session title on this endpoint and defaults to 'New Chat' when this field is omitted, so callers should send the current title to avoid overwriting it.
                json_data:
                  type: array
                  description: 'Ordered list of chat message objects. Optional in the request: if present it MUST be an array (the body reports status 400 ''Invalid input'' otherwise); if omitted the server defaults to an empty array, which overwrites the session''s existing messages. Callers should always send the full message list.'
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                      user:
                        type: string
                        description: Message author, e.g. 'me' or 'gpt'.
                        example: me
                      message:
                        type: string
                      message_orig:
                        type: string
                      references:
                        type: string
                      follows:
                        type: string
                    additionalProperties: true
      responses:
        '200':
          description: Chat session content updated (or created).
          content:
            application/json:
              schema:
                type: object
                properties:
                  response:
                    type: string
                    description: '''Chat content updated'''
                  status:
                    type: integer
                    example: 200
        '400':
          description: 'Bot user disabled, invalid input (missing session_id or non-list json_data), invalid session_id format, 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: Missing/invalid auth token (token_required decorator).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                response: Unauthorized
                status: 401
      operationId: postUpdateChatSessionJson
      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)