Amigo Insights API

The Insights API from Amigo — 7 operation(s) for insights.

OpenAPI Specification

amigo-insights-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amigo Account Insights API
  version: 0.1.0
servers:
- url: https://api.amigo.ai
- url: https://internal-api.amigo.ai
- url: https://api-eu-central-1.amigo.ai
- url: https://api-ap-southeast-2.amigo.ai
- url: https://api-ca-central-1.amigo.ai
security:
- Bearer-Authorization: []
  Bearer-Authorization-Organization: []
  Basic: []
tags:
- name: Insights
paths:
  /v1/{workspace_id}/insights/sql:
    post:
      tags:
      - Insights
      summary: Execute Sql
      description: Execute a read-only SQL query against Databricks.
      operationId: execute_sql_v1__workspace_id__insights_sql_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SqlQueryRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SqlQueryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
  /v1/{workspace_id}/insights/schema:
    get:
      tags:
      - Insights
      summary: Describe Schema
      description: List available tables, columns, and functions.
      operationId: describe_schema_v1__workspace_id__insights_schema_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaResponse'
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
  /v1/{workspace_id}/insights/suggestions:
    get:
      tags:
      - Insights
      summary: Get Suggestions
      description: Get contextual starter questions for the insights agent.
      operationId: get_suggestions_v1__workspace_id__insights_suggestions_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuggestionsResponse'
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
  /v1/{workspace_id}/insights/digest:
    get:
      tags:
      - Insights
      summary: Get Digest
      description: Proactive workspace health digest. Cached 5 minutes.
      operationId: get_digest_v1__workspace_id__insights_digest_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Get Digest V1  Workspace Id  Insights Digest Get
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
  /v1/{workspace_id}/insights/sessions:
    post:
      tags:
      - Insights
      summary: Create Session
      description: Create a new insights chat session.
      operationId: create_session_v1__workspace_id__insights_sessions_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionResponse'
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
  /v1/{workspace_id}/insights/sessions/{session_id}/chat:
    post:
      tags:
      - Insights
      summary: Chat
      description: Chat with the insights agent. Returns SSE stream of visual blocks.
      operationId: chat_v1__workspace_id__insights_sessions__session_id__chat_post
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          maxLength: 64
          description: Session ID
          title: Session Id
        description: Session ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/{workspace_id}/insights/sessions/{session_id}:
    get:
      tags:
      - Insights
      summary: Get Session
      description: Get insights session history.
      operationId: get_session_v1__workspace_id__insights_sessions__session_id__get
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: session_id
        in: path
        required: true
        schema:
          type: string
          maxLength: 64
          description: Session ID
          title: Session Id
        description: Session ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Get Session V1  Workspace Id  Insights Sessions  Session Id  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SuggestionsResponse:
      properties:
        suggestions:
          items:
            type: string
          type: array
          title: Suggestions
      type: object
      required:
      - suggestions
      title: SuggestionsResponse
    SchemaResponse:
      properties:
        lakebase_tables:
          additionalProperties:
            additionalProperties:
              type: string
            type: object
          type: object
          title: Lakebase Tables
        databricks_catalogs:
          items:
            type: string
          type: array
          title: Databricks Catalogs
        uc_functions:
          items:
            additionalProperties:
              type: string
            type: object
          type: array
          title: Uc Functions
        ai_functions:
          items:
            type: string
          type: array
          title: Ai Functions
      type: object
      required:
      - lakebase_tables
      - databricks_catalogs
      - uc_functions
      - ai_functions
      title: SchemaResponse
    ChatRequest:
      properties:
        message:
          type: string
          maxLength: 16000
          minLength: 1
          title: Message
          description: Insights chat user message.
      type: object
      required:
      - message
      title: ChatRequest
    SqlQueryResponse:
      properties:
        results:
          anyOf:
          - items:
              additionalProperties: true
              type: object
            type: array
          - type: 'null'
          title: Results
        count:
          anyOf:
          - type: integer
          - type: 'null'
          title: Count
        error:
          anyOf:
          - type: string
          - type: 'null'
          title: Error
      type: object
      title: SqlQueryResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    SqlQueryRequest:
      properties:
        sql:
          type: string
          maxLength: 50000
          minLength: 1
          title: Sql
          description: Read-only SQL query against Databricks.
      type: object
      required:
      - sql
      title: SqlQueryRequest
    SessionResponse:
      properties:
        id:
          type: string
          title: Id
        created_at:
          anyOf:
          - type: string
          - type: 'null'
          title: Created At
      type: object
      required:
      - id
      title: SessionResponse
  securitySchemes:
    Bearer-Authorization:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Amigo issued JWT token that identifies an user. It's issued either after logging in through the frontend, or manually through the [`SignInWithAPIKey`](sign-in-with-api-key) endpoint.
    Bearer-Authorization-Organization:
      type: apiKey
      in: header
      name: X-ORG-ID
      description: An optional organization identifier that indicates from which organization the token is issued. This is used in rare cases where the user to authenticate is making a request for resources in another organization.
    Basic:
      type: http
      scheme: basic
      description: The username should be set to {org_id}_{user_id}, and the password should be the Amigo issued JWT token that identifies the user.