Brainfish Sessions API

Chat session search, detail, timeline, and AI-powered insights. A "session" is a chat conversation keyed by conversationId.

Operations 4

POST /v1/sessions/search Search chat sessions #
GET /v1/sessions/{id} Get session detail #
GET /v1/sessions/{id}/timeline Get session event timeline #
POST /v1/sessions/{id}/insights Generate session insights #

Documentation

Specifications

Other Resources

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/brainfish-sessions-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

brainfish-sessions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Brainfish Public Sessions API
  description: The Brainfish API is organized around REST.
  version: 1.0.0
  contact:
    name: Brainfish API Support
    email: support@brainfish.ai
    url: https://help.brainfi.sh/articles/api-reference-7mjzVCAmeM
  license:
    name: Proprietary
servers:
- url: https://api.brainfi.sh
  description: Production server
tags:
- name: Sessions
  description: Chat session search, detail, timeline, and AI-powered insights. A "session" is a chat conversation keyed by conversationId.
paths:
  /v1/sessions/search:
    post:
      summary: Search chat sessions
      description: 'Search chat sessions (conversations) by query text, filters, and date range.

        Returns one result per conversation, folded by conversationId.

        A "session" in this context means a chat conversation (one or more user turns with the AI agent).'
      operationId: searchSessions
      tags:
      - Sessions
      security:
      - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  description: Text to search for in user queries (case-insensitive partial match)
                conversationId:
                  type: string
                  description: Filter by exact conversation ID
                userId:
                  type: string
                  format: uuid
                  description: Filter by platform user ID
                externalUserId:
                  type: string
                  description: Filter by external user ID
                widgetIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: Filter by widget/agent IDs
                source:
                  type: string
                  description: Filter by source (e.g. widget, api, help_center)
                feedback:
                  type:
                  - string
                  - 'null'
                  enum:
                  - positive
                  - negative
                  description: Filter by feedback (null means no feedback given)
                isAnswered:
                  type: boolean
                  description: Filter by whether the query was answered
                fromDate:
                  type: string
                  format: date-time
                  description: Start date (ISO 8601)
                toDate:
                  type: string
                  format: date-time
                  description: End date (ISO 8601)
                limit:
                  type: integer
                  minimum: 1
                  maximum: 100
                  default: 20
                offset:
                  type: integer
                  minimum: 0
                  default: 0
                sortOrder:
                  type: string
                  enum:
                  - asc
                  - desc
                  default: desc
            example:
              query: refund
              isAnswered: false
              fromDate: '2026-04-01T00:00:00Z'
              toDate: '2026-04-23T23:59:59Z'
              limit: 20
      responses:
        '200':
          description: Sessions matching the search criteria
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        conversationId:
                          type:
                          - string
                          - 'null'
                        lastQuery:
                          type: string
                        lastQueryAt:
                          type: string
                          format: date-time
                        turnCount:
                          type: integer
                        isAnswered:
                          type: boolean
                        feedback:
                          type:
                          - string
                          - 'null'
                        userId:
                          type:
                          - string
                          - 'null'
                        externalUserId:
                          type:
                          - string
                          - 'null'
                        source:
                          type:
                          - string
                          - 'null'
                        widgetId:
                          type:
                          - string
                          - 'null'
                  pagination:
                    type: object
                    properties:
                      offset:
                        type: integer
                      limit:
                        type: integer
                      total:
                        type: integer
                  timestamp:
                    type: string
                    format: date-time
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
  /v1/sessions/{id}:
    get:
      summary: Get session detail
      description: 'Fetch full conversation detail for a chat session: all turns (user query, AI answer, feedback)

        plus analytics metadata (session start time, start URL, linked search query IDs).

        Accepts a conversationId or searchQueryId.'
      operationId: getSession
      tags:
      - Sessions
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Conversation ID or search query ID
      responses:
        '200':
          description: Session detail with turns and analytics metadata
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      conversationId:
                        type: string
                      teamId:
                        type: string
                      startedAt:
                        type: string
                        format: date-time
                      endedAt:
                        type: string
                        format: date-time
                      sessionId:
                        type:
                        - string
                        - 'null'
                      startedAtUrl:
                        type:
                        - string
                        - 'null'
                      searchQueryIds:
                        type: array
                        items:
                          type: string
                      turnCount:
                        type: integer
                      turns:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            query:
                              type: string
                            rewrittenQuery:
                              type:
                              - string
                              - 'null'
                            suggestedAnswer:
                              type:
                              - string
                              - 'null'
                            isAnswered:
                              type: boolean
                            feedback:
                              type:
                              - string
                              - 'null'
                            createdAt:
                              type: string
                              format: date-time
                  timestamp:
                    type: string
                    format: date-time
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
  /v1/sessions/{id}/timeline:
    get:
      summary: Get session event timeline
      description: 'Fetch the chronological analytics event timeline for a conversation. Includes page views,

        widget interactions, search events, and chat turns with their properties map.

        The timeline is proxied from the analytic-service.'
      operationId: getSessionTimeline
      tags:
      - Sessions
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Conversation ID
      - name: limit
        in: query
        schema:
          type: integer
          minimum: 1
          maximum: 1000
          default: 200
      - name: includeSessionContext
        in: query
        schema:
          type: boolean
          default: true
        description: Include session-level events (screen views, widget open/close)
      - name: fromDate
        in: query
        schema:
          type: string
          format: date-time
      - name: toDate
        in: query
        schema:
          type: string
          format: date-time
      - name: eventNames
        in: query
        schema:
          type: string
        description: Comma-separated event name(s) to filter by (e.g. "screen_view,Primary Field Search Submitted")
      - name: country
        in: query
        schema:
          type: string
        description: Comma-separated country code(s) (e.g. "US,CA")
      - name: city
        in: query
        schema:
          type: string
        description: Comma-separated city name(s)
      - name: region
        in: query
        schema:
          type: string
        description: Comma-separated region/state name(s)
      - name: os
        in: query
        schema:
          type: string
        description: Comma-separated OS name(s) (e.g. "Mac OS,Windows")
      - name: browser
        in: query
        schema:
          type: string
        description: Comma-separated browser name(s) (e.g. "Chrome,Safari")
      - name: device
        in: query
        schema:
          type: string
        description: Comma-separated device type(s) (e.g. "desktop,mobile")
      - name: referrerType
        in: query
        schema:
          type: string
        description: Comma-separated referrer type(s) (e.g. "search,social,direct")
      responses:
        '200':
          description: Chronological event timeline
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        createdAt:
                          type: string
                        userId:
                          type: string
                        sessionId:
                          type: string
                        widgetKey:
                          type: string
                        conversationId:
                          type: string
                        searchQueryId:
                          type: string
                        path:
                          type: string
                        origin:
                          type: string
                        properties:
                          type: object
                          additionalProperties:
                            type: string
                  timestamp:
                    type: string
                    format: date-time
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
  /v1/sessions/{id}/insights:
    post:
      summary: Generate session insights
      description: 'Generate a structured LLM-powered diagnosis of a chat session: root cause analysis,

        severity, evidence, and actionable recommendations. Results are cached server-side for 24 hours.

        Use force=true to regenerate.'
      operationId: generateSessionInsights
      tags:
      - Sessions
      security:
      - BearerAuth: []
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Conversation ID or search query ID
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                force:
                  type: boolean
                  default: false
                  description: Skip cache and regenerate insights
      responses:
        '200':
          description: Structured session diagnosis
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      summary:
                        type: string
                      rootCause:
                        type: object
                        properties:
                          category:
                            type: string
                            enum:
                            - missing_content
                            - retrieval_miss
                            - hallucination
                            - ambiguous_query
                            - out_of_scope
                            - user_confusion
                            - other
                          explanation:
                            type: string
                      severity:
                        type: string
                        enum:
                        - low
                        - medium
                        - high
                      evidence:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                            ref:
                              type: string
                            quote:
                              type: string
                      recommendations:
                        type: array
                        items:
                          type: object
                          properties:
                            action:
                              type: string
                            rationale:
                              type: string
                      metrics:
                        type: object
                        properties:
                          turnCount:
                            type: integer
                          hadNegativeFeedback:
                            type: boolean
                          answerCoverage:
                            type: string
                            enum:
                            - full
                            - partial
                            - none
                  cached:
                    type: boolean
                  timestamp:
                    type: string
                    format: date-time
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  responses:
    Unauthorized:
      description: Authentication required or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missingToken:
              summary: Missing authentication token
              value:
                error: authentication_required
                message: 'Authentication required. Use Authorization: Bearer <token> header'
                timestamp: '2024-01-15T10:30:00Z'
                requestId: req-abc123
            missingAgentKey:
              summary: Missing agent key
              value:
                error: authentication_required
                message: Agent key is required
                timestamp: '2024-01-15T10:30:00Z'
                requestId: req-def456
            invalidCredentials:
              summary: Invalid credentials
              value:
                error: authentication_required
                message: Invalid or missing authentication credentials
                timestamp: '2024-01-15T10:30:00Z'
                requestId: req-ghi789
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: not_found
            message: Document not found
            timestamp: '2024-01-15T10:30:00Z'
            requestId: req-notfound123
    TooManyRequests:
      description: Rate limit exceeded
      headers:
        X-RateLimit-Limit:
          schema:
            type: integer
          description: Request limit per time window
        X-RateLimit-Remaining:
          schema:
            type: integer
          description: Remaining requests in current window
        X-RateLimit-Reset:
          schema:
            type: integer
          description: Time when rate limit resets (Unix timestamp)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: rate_limit_exceeded
            message: 'Too many requests. Rate limit: 25 requests per minute'
            timestamp: '2024-01-15T10:30:00Z'
  schemas:
    Error:
      type: object
      required:
      - error
      - message
      properties:
        error:
          type: string
          description: Error type or code
        message:
          type: string
          description: Human-readable error message
        details:
          type: object
          additionalProperties: true
          description: Additional error details
        timestamp:
          type: string
          format: date-time
          description: Error timestamp
        requestId:
          type: string
          description: Unique request identifier for debugging
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Token
      description: 'Bearer token authentication. Include your API token in the Authorization header.


        Example: `Authorization: Bearer bf_api_xxxxx`


        Create tokens in your Brainfish dashboard under Settings → API Tokens.

        '
    AccessToken:
      type: apiKey
      in: header
      name: access-token
      description: '**Deprecated**: Use Bearer authentication instead.


        Legacy access token header for backward compatibility. Must start with `bf_api_`.


        Create tokens in your Brainfish dashboard under Settings → API Tokens.

        '
    AgentKey:
      type: apiKey
      in: header
      name: agent-key
      description: 'Agent key identifier that specifies which AI agent/widget to use for the request.


        Find agent keys in your Brainfish dashboard under Agents. Click on any agent key to copy it.

        '