Slite Ask API

The Ask API from Slite — 2 operation(s) for ask.

OpenAPI Specification

slite-ask-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Public Slite api Ask API
  version: '1'
  description: Access your Slite documents, search, create, update...
  license:
    name: private
  contact:
    name: Slite
servers:
- url: https://api.slite.com/v1
tags:
- name: Ask
paths:
  /ask:
    get:
      operationId: ask
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnswerAndSources'
              examples:
                Example 1:
                  value:
                    answer: The onboarding steps are...
                    sources:
                    - title: Onboarding
                      url: https://slite.slite.page/p/S1TSuHnZf/Security-at-Slite
                      id: S1TSuHnZf
                      updatedAt: '2021-01-01T00:00:00.000Z'
        '401':
          description: Invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiAuthError'
        '422':
          description: Ask feature is disabled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AskDisabledError'
        '429':
          description: Ask rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AskRateLimitedError'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
      description: 'Ask a question to your notes in natural language.

        The scope of the notes used to answer the question is restricted to the authenticated user.

        Various optional filters are available to restrict the scope of the notes even more.'
      summary: Ask a question
      security:
      - bearer: []
      parameters:
      - description: Question to ask on your notes
        in: query
        name: question
        required: true
        schema:
          type: string
        example: What are the onboarding steps?
      - description: Optional filter to only return notes under this parent note id
        in: query
        name: parentNoteId
        required: false
        schema:
          type: string
      - description: Optional filter to use a specific assistant for super only
        in: query
        name: assistantId
        required: false
        schema:
          type: string
      tags:
      - Ask
  /ask/index:
    post:
      operationId: index
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Source'
              examples:
                Example 1:
                  value:
                    title: Onboarding
                    url: https://slite.slite.page/p/S1TSuHnZf/Security-at-Slite
                    id: S1TSuHnZf
                    updatedAt: '2021-01-01T00:00:00.000Z'
        '401':
          description: Invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiAuthError'
        '402':
          description: This feature is disabled for your organization. Please contact support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiDisabledError'
        '404':
          description: Data source not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiNotFoundError'
        '422':
          description: Input validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiFieldValidationError'
        '429':
          description: Rate limitation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitError'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
      description: Index a custom content for AskX usage.
      summary: Index a custom content
      deprecated: true
      security:
      - bearer: []
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                rootId:
                  type: string
                  description: Root id of the object to gather sources from. This should be created from the UI as a new custom data source.
                  example:
                  - a2ZSuHnZf
                id:
                  type: string
                  description: Unique id of the object to index scoped to the rootId
                  example:
                  - custom-id
                title:
                  type: string
                  description: Title of the object to index
                  example:
                  - Note title
                content:
                  type: string
                  description: Content of the object to index
                  example:
                  - '# Content in markdown'
                type:
                  $ref: '#/components/schemas/ObjectType'
                  description: Type of the object to index. Can be "markdown" or "html"
                  example:
                  - markdown
                updatedAt:
                  type: string
                  format: date-time
                  description: Last update date of the object to index. Used to determine the freshness of the object.
                  example:
                  - '2021-01-01T00:00:00Z'
                url:
                  type: string
                  description: Url of the object to index. Used to redirect to the proper page.
                  example:
                  - https://slite.slite.page/p/S1TSuHnZf/Security-at-Slite
              required:
              - rootId
              - id
              - title
              - content
              - type
              - updatedAt
              - url
              type: object
      tags:
      - Ask
    delete:
      operationId: delete-index
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                properties:
                  ok:
                    type: boolean
                required:
                - ok
                type: object
              examples:
                Example 1:
                  value:
                    ok: true
        '401':
          description: Invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiAuthError'
        '402':
          description: This feature is disabled for your organization. Please contact support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiDisabledError'
        '404':
          description: Data source not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiNotFoundError'
        '422':
          description: Input validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiFieldValidationError'
        '429':
          description: Rate limitation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitError'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
      description: Delete a custom content from AskX usage.
      summary: Delete custom content
      deprecated: true
      security:
      - bearer: []
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                rootId:
                  type: string
                  description: Root id of the object to gather sources from. This should be created from the UI as a new custom data source.
                  example:
                  - a2ZSuHnZf
                id:
                  type: string
                  description: Unique id of the object to index scoped to the rootId
                  example:
                  - custom-id
              required:
              - rootId
              - id
              type: object
      tags:
      - Ask
    get:
      operationId: list-index
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListResult'
              examples:
                Example 1:
                  value:
                    nbPages: 2
                    page: 0
                    hits:
                    - title: Onboarding
                      url: https://slite.slite.page/p/S1TSuHnZf/Security-at-Slite
                      id: S1TSuHnZf
                      updatedAt: '2021-01-01T00:00:00.000Z'
        '401':
          description: Invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiAuthError'
        '402':
          description: This feature is disabled for your organization. Please contact support.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiDisabledError'
        '404':
          description: Data source not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiNotFoundError'
        '422':
          description: Input validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiFieldValidationError'
        '429':
          description: Rate limitation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitError'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiError'
      description: List custom content ids from AskX usage.
      summary: List custom content
      deprecated: true
      security:
      - bearer: []
      parameters:
      - description: Root id of the object to gather sources from. This should be created from the UI as a new custom data source.
        in: query
        name: rootId
        required: true
        schema:
          type: string
        example: a2ZSuHnZf
      - description: Used to perform pagination on search
        in: query
        name: page
        required: false
        schema:
          $ref: '#/components/schemas/ListPage'
      - description: Specify how many notes to return per page
        in: query
        name: hitsPerPage
        required: false
        schema:
          $ref: '#/components/schemas/ListHitsPerPage'
      tags:
      - Ask
components:
  schemas:
    ListPage:
      type: integer
      format: int32
      minimum: 0
    Source:
      properties:
        explanation:
          type: string
          description: For super, gives explanation about the source
        updatedAt:
          anyOf:
          - type: string
            format: date-time
          - type: string
          description: Date of the last update of the note
        url:
          type: string
          description: Url of the note
        title:
          type: string
          description: Title of the note
        id:
          type: string
          description: Id of the note
      required:
      - updatedAt
      - url
      - title
      - id
      type: object
    ListResult:
      properties:
        hits:
          items:
            $ref: '#/components/schemas/Source'
          type: array
        nbPages:
          type: number
          format: double
          description: Total number of pages for the current query
        page:
          type: number
          format: double
          description: Current page number of the search pagination
      required:
      - hits
      - nbPages
      - page
      type: object
    PublicApiNotFoundError:
      properties:
        message:
          type: string
          enum:
          - Data source not found.
        id:
          type: string
          enum:
          - root-id-not-found
          nullable: false
      required:
      - message
      - id
      type: object
    AskDisabledError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
        id:
          type: string
        status:
          type: number
          format: double
      required:
      - name
      - message
      - id
      - status
      type: object
      additionalProperties: false
    ObjectType:
      enum:
      - markdown
      - html
      type: string
    PublicApiFieldValidationError:
      properties:
        details:
          $ref: '#/components/schemas/FieldErrors'
        message:
          type: string
          enum:
          - Validation Failed
          nullable: false
        id:
          type: string
          enum:
          - field-validation
          nullable: false
      required:
      - message
      - id
      type: object
    ListHitsPerPage:
      type: integer
      format: int32
      minimum: 1
      maximum: 100
    PublicApiRateLimitError:
      properties:
        message:
          type: string
          enum:
          - You've reached the api rate limit. Please wait and retry later.
          nullable: false
        id:
          type: string
          enum:
          - rate-limit
          nullable: false
      required:
      - message
      - id
      type: object
    PublicApiDisabledError:
      properties:
        message:
          type: string
          enum:
          - This feature is disabled for your organization. Please contact support.
        id:
          type: string
          enum:
          - askx-disabled
          nullable: false
      required:
      - message
      - id
      type: object
    FieldErrors:
      properties: {}
      type: object
      additionalProperties:
        properties:
          value: {}
          message:
            type: string
        required:
        - message
        type: object
    PublicApiError:
      properties:
        message:
          type: string
        id:
          type: string
      required:
      - message
      - id
      type: object
    PublicApiAuthError:
      properties:
        message:
          type: string
          enum:
          - Invalid apiKey
          nullable: false
        id:
          type: string
          enum:
          - auth/unauthorized
          nullable: false
      required:
      - message
      - id
      type: object
    AnswerAndSources:
      properties:
        sources:
          items:
            $ref: '#/components/schemas/Source'
          type: array
          description: Array of sources that were used to answer the question
        answer:
          type: string
          description: Answer to the question
      required:
      - sources
      - answer
      type: object
    AskRateLimitedError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
        id:
          type: string
        status:
          type: number
          format: double
      required:
      - name
      - message
      - id
      - status
      type: object
      additionalProperties: false
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: API keys can be generated under Settings > API