# Documentation copy aligned with deployed main 782fac3ab0e8bdcd601974d37ee2f7a96c99221e.
# See README.md, API schema maintenance, for provenance and the update procedure.
openapi: '3.1.1'
info:
  title: Conveo API
  version: '1.0'
servers:
  - url: https://app.conveo.ai/public-api/v1
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Organization API key supplied as a Bearer token. MCP OAuth tokens are not accepted by these REST endpoints.
    apiKeyAuth:
      type: apiKey
      in: header
      name: Conveo-Api-Key
  schemas:
    PaginatedResponse:
      type: object
      properties:
        items:
          type: array
          items:
            type: object
        pagination:
          type: object
          properties:
            total:
              type: integer
              description: Total number of items
              example: 42
            page:
              type: integer
              description: Current page number
              example: 2
            pageSize:
              type: integer
              description: Number of items per page
              example: 20
    Facet:
      type: object
      description: A facet representing a labeled set of values
      properties:
        label:
          type: string
          description: The label or name of the facet
        values:
          type: array
          description: List of values associated with this facet
          items:
            type: string
      required:
        - label
        - values
    Study:
      type: object
      properties:
        id:
          type: string
          example: "cm3izbg8k00384xkjj42uc4jm"
        internalTitle:
          type: string
          example: "EV Market Research 2025"
        completedOn:
          type: ["string", "null"]
          format: date
          description: The date when the study was completed (YYYY-MM-DD format)
          example: "2024-12-15"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Interview:
      type: object
      properties:
        id:
          type: string
          example: "cm393cvz80bdpmcedfzacog26"
        participant:
          type: ["object", "null"]
          description: Participant identity when available. The display name uses first name and last initial.
          properties:
            id:
              type: string
              example: "cm14zq5t10egyfkyrfy34ihlc"
            name:
              type: ["string", "null"]
              example: "John S"
        facets:
          type: array
          description: List of facets associated with the interview
          items:
            $ref: '#/components/schemas/Facet'
          example:
            - label: "Age"
              values: ["35"]
            - label: "Gender"
              values: ["Female"]
            - label: "Country"
              values: ["United States"]
            - label: "Car Ownership"
              values: ["Electric Vehicle", "Previous ICE Owner"]
            - label: "Opinion on Jaguar's Strategy"
              values: ["Positive impression", "Interested in future models"]
        videoDownloadURL:
          type: ["string", "null"]
          format: uri
          description: Temporary URL to download the stored interview video; null if storage details are unavailable or URL generation fails. The URL expires after 15 minutes. Request the interview again for a fresh URL.
          example: "https://..."
        transcriptAsWebVTT:
          type: ["string", "null"]
          description: Participant-response messages in WebVTT format, using original message text. Interviewer questions are not included. Null when no response messages are available. Missing timings can produce zero or equal start and end times.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    SingleStudyResponse:
      type: object
      properties:
        id:
          type: string
        internalTitle:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time

security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /studies:
    get:
      summary: List studies
      description: Returns completed studies for the API key organization, ordered by completion time descending. Uses page-number pagination.
      parameters:
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: pageSize
          in: query
          required: false
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 100
      responses:
        '200':
          description: A paginated list of studies
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedResponse'
                  - type: object
                    properties:
                      items:
                        type: array
                        items:
                          $ref: '#/components/schemas/Study'
        '400':
          description: Invalid pagination parameters
          content:
            application/json:
              schema:
                type: string
                example: Bad Request
        '401':
          description: Unauthorized
  /studies/{id}:
    description: Get a single study by ID
    get:
      summary: Get study
      description: Returns a completed study belonging to the API key organization. The detail response does not include completedOn; that field is returned by the study list.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A single study
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SingleStudyResponse'
        '401':
          description: Unauthorized
        '404':
          description: Study not found
  /studies/{studyId}/interviews:
    get:
      summary: List interviews for a study
      description: Returns completed, non-hidden interviews from a completed study belonging to the API key organization, ordered by interview creation time descending.
      parameters:
        - name: studyId
          in: path
          required: true
          schema:
            type: string
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: pageSize
          in: query
          required: false
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 100
      responses:
        '200':
          description: A paginated list of interviews for the study
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PaginatedResponse'
                  - type: object
                    properties:
                      items:
                        type: array
                        items:
                          $ref: '#/components/schemas/Interview'
        '400':
          description: Invalid pagination parameters
          content:
            application/json:
              schema:
                type: string
                example: Bad Request
        '401':
          description: Unauthorized
        '404':
          description: Study not found
  /interviews/{id}:
    get:
      summary: Get interview
      description: Returns one completed, non-hidden interview belonging to the API key organization. Unlike the study-scoped list, this endpoint does not require the parent study to be completed.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A single interview
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Interview'
        '401':
          description: Unauthorized
        '404':
          description: Interview not found
