Structify chat API

Chat session management endpoints

OpenAPI Specification

structify-chat-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  contact:
    email: team@structify.ai
    name: Structify Team
  description: Every enterprise's data team.
  license:
    name: Discuss directly with founders for license.
    url: https://structify.ai
  title: Structify account chat API
  version: 0.1.0
servers:
- description: Production server
  url: https://api.structify.ai
- description: Local server
  url: http://localhost:8080
security:
- api_key: []
- session_token: []
tags:
- description: Chat session management endpoints
  name: chat
paths:
  /chat/add_code/{chat_id}:
    post:
      operationId: chat_add_code
      parameters:
      - in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      - in: query
        name: run_workflow
        required: false
        schema:
          type: boolean
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CodeAddForm'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodeAddResponse'
          description: Files uploaded successfully
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Chat session not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      tags:
      - chat
  /chat/copy:
    post:
      operationId: chat_copy_session
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CopyChatSessionRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSessionWithMessages'
          description: Chat session copied successfully
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Copy a chat session with its workflows and git files
      tags:
      - chat
  /chat/files/load:
    post:
      operationId: chat_load_files
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoadFilesRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoadFilesResponse'
          description: Files loaded successfully
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Repository or commit not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Load files from a chat session's git repository
      tags:
      - chat
  /chat/input-files/delete/{chat_id}:
    post:
      operationId: delete_input_files
      parameters:
      - in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InputFilesDeleteRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InputFilesDeleteResponse'
          description: Files deleted successfully
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Chat session not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Delete input files from a chat session
      tags:
      - chat
  /chat/input-files/download-all/{chat_id}:
    get:
      description: 'Pass `since` query param (RFC 3339 timestamp) to only get files created/updated after that time.

        The response includes `latest_timestamp` which can be passed as `since` on the next call.'
      operationId: download_all_input_files
      parameters:
      - in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      - in: query
        name: since
        required: false
        schema:
          format: date-time
          nullable: true
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InputFilesDownloadAllResponse'
          description: All files as base64 JSON
        '401':
          description: Unauthorized
        '404':
          description: Chat session not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Download all input files for a chat session as base64-encoded JSON.
      tags:
      - chat
  /chat/input-files/download/{chat_id}/{filename}:
    get:
      operationId: download_input_file
      parameters:
      - in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      - in: path
        name: filename
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/octet-stream:
              schema:
                format: binary
                type: string
          description: File content
        '401':
          description: Unauthorized
        '404':
          description: File not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Download a single input file by chat ID and filename
      tags:
      - chat
  /chat/input-files/list/{chat_id}:
    get:
      operationId: list_input_files
      parameters:
      - in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/ChatInputFile'
                type: array
          description: Files listed successfully
        '401':
          description: Unauthorized
        '404':
          description: Chat session not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: List input files for a chat session
      tags:
      - chat
  /chat/input-files/upload/{chat_id}:
    post:
      operationId: upload_input_files
      parameters:
      - in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/InputFilesUploadForm'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InputFilesUploadResponse'
          description: File uploaded successfully
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Chat session not found
        '413':
          description: Payload too large
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Upload an input file to a chat session's bucket storage
      tags:
      - chat
  /chat/sessions:
    get:
      operationId: chat_list_sessions
      parameters:
      - description: Team ID to filter chat sessions
        in: query
        name: team_id
        required: true
        schema:
          $ref: '#/components/schemas/TeamId'
      - description: Project ID to filter chat sessions
        in: query
        name: project_id
        required: false
        schema:
          allOf:
          - $ref: '#/components/schemas/ProjectId'
          nullable: true
      - description: Connector ID to filter chat sessions that use this connector
        in: query
        name: connector_id
        required: false
        schema:
          allOf:
          - $ref: '#/components/schemas/ConnectorId'
          nullable: true
      - description: Tab filter for chat sessions
        in: query
        name: tab
        required: false
        schema:
          allOf:
          - $ref: '#/components/schemas/ChatSessionTab'
          nullable: true
      - description: 'Number of sessions to skip (default: 0)'
        in: query
        name: offset
        required: false
        schema:
          format: int64
          nullable: true
          type: integer
      - description: 'Maximum number of sessions to return (default: 50)'
        in: query
        name: limit
        required: false
        schema:
          format: int64
          nullable: true
          type: integer
      - description: Search query to filter sessions by name (case-insensitive)
        in: query
        name: search
        required: false
        schema:
          nullable: true
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListChatSessionsResponse'
          description: Chat sessions retrieved successfully
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: List all chat sessions for the authenticated user within a specific team and project.
      tags:
      - chat
    post:
      operationId: chat_create_session
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatSessionRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChatSessionResponse'
          description: Chat session created successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad request
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden - user does not have write access to team
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Project not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Create a new chat session with an initial message
      tags:
      - chat
  /chat/sessions/{chat_id}/admin/issue_found:
    post:
      operationId: admin_issue_found
      parameters:
      - description: Chat session ID
        in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdminIssueFoundRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminIssueFoundResponse'
          description: Admin issue message created
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Chat session not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Add an IssueFound tool call as an admin-only auto-review message
      tags:
      - chat
  /chat/sessions/{chat_id}/admin_override:
    post:
      operationId: chat_grant_admin_override
      parameters:
      - description: The chat ID
        in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GrantAdminAccessRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminGrantAccessResponse'
          description: Temporary admin access granted
        '400':
          description: Bad request
        '403':
          description: Forbidden
        '404':
          description: Chat not found or access denied
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Grant temporary admin override access for the calling admin to a chat session
      tags:
      - chat
  /chat/sessions/{chat_id}/collaborators:
    get:
      operationId: chat_list_collaborators
      parameters:
      - description: The chat session ID
        in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListCollaboratorsResponse'
          description: List of collaborators retrieved successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid session ID format
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Chat session not found or access denied
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: List all users who have access to a chat session
      tags:
      - chat
    post:
      operationId: chat_add_collaborator
      parameters:
      - description: The chat ID
        in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddCollaboratorRequest'
        required: true
      responses:
        '201':
          description: Collaborator added successfully
        '400':
          description: Bad request
        '404':
          description: User not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      tags:
      - chat
  /chat/sessions/{chat_id}/collaborators/{user_id}:
    delete:
      operationId: chat_remove_collaborator
      parameters:
      - description: The chat ID
        in: path
        name: chat_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      - description: The user ID to remove
        in: path
        name: user_id
        required: true
        schema:
          $ref: '#/components/schemas/UserId'
      responses:
        '204':
          description: Collaborator removed successfully
        '400':
          description: Bad request
        '404':
          description: Not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      tags:
      - chat
  /chat/sessions/{chat_id}/commits/{commit_hash}:
    get:
      operationId: get_git_commit
      parameters:
      - description: The chat session ID
        in: path
        name: chat_id
        required: true
        schema:
          type: string
      - description: The git commit hash
        in: path
        name: commit_hash
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetGitCommitByHashResponse'
          description: Git commit retrieved successfully
        '400':
          description: Invalid session ID or commit hash format
        '404':
          description: Chat session or commit not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Get a specific git commit by its hash for a chat session
      tags:
      - chat
  /chat/sessions/{chat_id}/dashboards:
    get:
      operationId: list_dashboards
      parameters:
      - description: The chat session ID
        in: path
        name: chat_id
        required: true
        schema:
          type: string
      - description: Optional commit hash. If omitted, uses the chat session latest commit.
        in: query
        name: commit_hash
        required: false
        schema:
          nullable: true
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListDashboardsResponse'
          description: Dashboards retrieved successfully
        '400':
          description: Invalid chat session ID format
        '404':
          description: Chat session not found or commit not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: List dashboard specs for a chat session at a specific commit hash.
      tags:
      - chat
  /chat/sessions/{session_id}:
    delete:
      operationId: chat_delete_session
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
          description: Chat session deleted successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid session ID format
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden - user does not have write access to chat session
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Chat session not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Delete a chat session
      tags:
      - chat
    get:
      operationId: chat_get_session
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetChatSessionResponse'
          description: Chat session retrieved successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid session ID format
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Chat session not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Get a chat session with all its messages
      tags:
      - chat
    patch:
      operationId: update_chat_session
      parameters:
      - description: Chat session ID to update
        in: path
        name: session_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChatSessionRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSession'
          description: Successfully updated chat session
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden - user does not have write access to chat session
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Session not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      tags:
      - chat
  /chat/sessions/{session_id}/commits:
    get:
      operationId: chat_list_git_commits
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          type: string
      - description: Number of commits to skip (for pagination)
        in: query
        name: offset
        required: false
        schema:
          format: int64
          nullable: true
          type: integer
      - description: Maximum number of commits to return (defaults to 50)
        in: query
        name: limit
        required: false
        schema:
          format: int64
          nullable: true
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetGitCommitsResponse'
          description: Git commits listed successfully
        '400':
          description: Invalid session ID format
        '404':
          description: Chat session not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: List git commits for a chat session
      tags:
      - chat
    post:
      operationId: chat_add_git_commit
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddGitCommitRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddGitCommitResponse'
          description: Git commit added successfully
      security:
      - api_key: []
      - session_token: []
      summary: Add a git commit to a chat session
      tags:
      - chat
  /chat/sessions/{session_id}/compress:
    post:
      operationId: chat_compress
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompressChatResponse'
          description: Chat compression started
      security:
      - api_key: []
      - session_token: []
      tags:
      - chat
  /chat/sessions/{session_id}/dependencies:
    get:
      operationId: chat_get_dependencies
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDependenciesResponse'
          description: Dependencies retrieved successfully
        '400':
          description: Invalid session ID format
        '404':
          description: Chat session not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      summary: Get all dependencies for a chat session
      tags:
      - chat
  /chat/sessions/{session_id}/favorite:
    patch:
      operationId: update_chat_session_favorite
      parameters:
      - description: Chat session ID to update
        in: path
        name: session_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChatSessionFavoriteRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSession'
          description: Successfully updated chat session favorite
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad request
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden - user does not have view access to chat session
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Session not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      tags:
      - chat
  /chat/sessions/{session_id}/make-permanent:
    patch:
      operationId: chat_make_session_permanent
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Chat session made permanent successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Invalid session ID format
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Access denied - only owners can make sessions permanent
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Chat session not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Make an ephemeral chat session permanent
      tags:
      - chat
  /chat/sessions/{session_id}/nodes/by_code_hash:
    post:
      operationId: chat_copy_node_output_by_code_hash
      parameters:
      - description: Id of the chat session to search in.
        in: path
        name: session_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetNodeByCodeHashRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CopyNodeOutputByCodeHashResponse'
          description: Successfully retrieved latest node id with matching code hash and copied output to the provided new node if supplied.
        '400':
          description: Invalid request.
      tags:
      - chat
  /chat/sessions/{session_id}/revert:
    post:
      operationId: chat_revert_to_commit
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RevertToCommitRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevertToCommitApiResponse'
          description: Successfully reverted to commit
        '400':
          description: Invalid request or commit hash
        '403':
          description: 'Access denied: insufficient permissions'
        '404':
          description: Session or commit not found
      security:
      - api_key: []
      - session_token: []
      summary: Revert a chat session to a specific commit
      tags:
      - chat
  /chat/sessions/{session_id}/timeline:
    get:
      operationId: chat_get_session_timeline
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          $ref: '#/components/schemas/ChatSessionId'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSessionTimelineResponse'
          description: Session timeline retrieved successfully
        '400':
          description: Invalid session ID format
        '404':
          description: Chat session not found
        '500':
          description: Internal server error
      security:
      - api_key: []
      - session_token: []
      summary: Get chronological timeline of messages and commits for a chat session
      tags:
      - chat
  /chat/sessions/{session_id}/visibility:
    put:
      operationId: chat_update_visibility
      parameters:
      - description: The chat session ID
        in: path
        name: session_id
        required: true
        schema:
          

# --- truncated at 32 KB (110 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/structify/refs/heads/main/openapi/structify-chat-api-openapi.yml