Opik Projects API

Project related resources

OpenAPI Specification

opik-projects-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Opik REST Projects API
  description: "The Opik REST API is currently in beta and subject to change. If you have any questions or feedback about the APIs, please reach out on GitHub: https://github.com/comet-ml/opik.\n\nAll of the methods listed in this documentation are used by either the SDK or the UI to interact with the Opik server. As a result,\nthe methods have been optimized for these use-cases in mind. If you are looking for a method that is not listed above, please create\nand issue on GitHub or raise a PR!\n\nOpik includes two main deployment options that results in slightly different API usage:\n\n- **Self-hosted Opik instance:** You will simply need to specify the URL as `http://localhost:5173/api/<endpoint_path>` or similar. This is the default option for the docs.\n- **Opik Cloud:** You will need to specify the Opik API Key and Opik Workspace in the header. The format of the header should be:\n\n  ```\n  {\n    \"Comet-Workspace\": \"your-workspace-name\",\n    \"authorization\": \"your-api-key\"\n  }\n  ```\n\n  The full payload would therefore look like:\n  \n  ```\n  curl -X GET 'https://www.comet.com/opik/api/v1/private/projects' \\\n  -H 'Accept: application/json' \\\n  -H 'Comet-Workspace: <your-workspace-name>' \\\n  -H 'authorization: <your-api-key>'\n  ```\n\n  Do take note here that the authorization header value does not include the `Bearer ` prefix. To switch to using the Opik Cloud in the documentation, you can\n  click on the edit button displayed when hovering over the `Base URL` displayed on the right hand side of the docs.\n"
  contact:
    name: Github Repository
    url: https://github.com/comet-ml/opik
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
- url: http://localhost:5173/api
  description: Local server
- url: https://www.comet.com/opik/api
  description: Opik Cloud
tags:
- name: Projects
  description: Project related resources
paths:
  /v1/private/projects/{projectId}/alerts:
    get:
      tags:
      - Projects
      summary: Find alerts by project
      description: Find alerts scoped to a project
      operationId: findAlertsByProject
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: sorting
        in: query
        schema:
          type: string
      - name: filters
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Alerts page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertPage_Public'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Public'
  /v1/private/projects/{projectId}/dashboards:
    get:
      tags:
      - Projects
      summary: Find dashboards by project
      description: Find dashboards scoped to a project
      operationId: findDashboardsByProject
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: name
        in: query
        schema:
          type: string
          description: Filter dashboards by name (partial match, case insensitive)
      - name: sorting
        in: query
        schema:
          type: string
      - name: filters
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Dashboard page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DashboardPage_Public'
  /v1/private/projects/{projectId}/datasets:
    get:
      tags:
      - Projects
      summary: Find datasets by project
      description: Find datasets scoped to a project
      operationId: findDatasetsByProject
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: with_experiments_only
        in: query
        schema:
          type: boolean
      - name: with_optimizations_only
        in: query
        schema:
          type: boolean
      - name: name
        in: query
        schema:
          type: string
          description: Filter datasets by name (partial match, case insensitive)
      - name: sorting
        in: query
        schema:
          type: string
      - name: filters
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Dataset page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatasetPage_Public'
  /v1/private/projects/{projectId}/experiments:
    get:
      tags:
      - Projects
      summary: Find experiments by project
      description: Find experiments scoped to a project
      operationId: findExperimentsByProject
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: datasetId
        in: query
        schema:
          type: string
          format: uuid
      - name: optimization_id
        in: query
        schema:
          type: string
          format: uuid
      - name: types
        in: query
        schema:
          type: string
      - name: name
        in: query
        schema:
          type: string
          description: Filter experiments by name (partial match, case insensitive)
      - name: dataset_deleted
        in: query
        schema:
          type: boolean
      - name: sorting
        in: query
        schema:
          type: string
      - name: filters
        in: query
        schema:
          type: string
      - name: experiment_ids
        in: query
        schema:
          type: string
          description: Filter experiments by a list of experiment IDs
      - name: force_sorting
        in: query
        schema:
          type: boolean
          description: Force sorting even when exceeding the endpoint result set limit. May result in slower queries
          default: false
      responses:
        '200':
          description: Experiments page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExperimentPage_Public'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Public'
  /v1/private/projects/{projectId}/optimizations:
    get:
      tags:
      - Projects
      summary: Find optimizations by project
      description: Find optimizations scoped to a project
      operationId: findOptimizationsByProject
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: dataset_id
        in: query
        schema:
          type: string
          format: uuid
      - name: dataset_name
        in: query
        schema:
          type: string
      - name: name
        in: query
        schema:
          type: string
          description: Filter optimizations by name (partial match, case insensitive)
      - name: dataset_deleted
        in: query
        schema:
          type: boolean
      - name: filters
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Optimizations page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptimizationPage_Public'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Public'
  /v1/private/projects/{projectId}/prompts:
    get:
      tags:
      - Projects
      summary: Get prompts by project
      description: Get prompts scoped to a project
      operationId: getPromptsByProject
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: name
        in: query
        schema:
          type: string
          description: Filter prompts by name (partial match, case insensitive)
      - name: sorting
        in: query
        schema:
          type: string
      - name: filters
        in: query
        schema:
          type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromptPage_Public'
  /v1/private/projects:
    get:
      tags:
      - Projects
      summary: Find projects
      description: Find projects
      operationId: findProjects
      parameters:
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: name
        in: query
        schema:
          type: string
          description: Filter projects by name (partial match, case insensitive)
      - name: sorting
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Project resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectPage_Public'
    post:
      tags:
      - Projects
      summary: Create project
      description: Create project
      operationId: createProject
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Project_Write'
      responses:
        '201':
          description: Created
          headers:
            Location:
              required: true
              style: simple
              schema:
                type: string
              example: ${basePath}/v1/private/projects/{projectId}
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /v1/private/projects/{id}:
    get:
      tags:
      - Projects
      summary: Get project by id
      description: Get project by id
      operationId: getProjectById
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Project resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project_Public'
    delete:
      tags:
      - Projects
      summary: Delete project by id
      description: Delete project by id
      operationId: deleteProjectById
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '204':
          description: No Content
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    patch:
      tags:
      - Projects
      summary: Update project by id
      description: Update project by id
      operationId: updateProject
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectUpdate'
      responses:
        '204':
          description: No Content
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /v1/private/projects/delete:
    post:
      tags:
      - Projects
      summary: Delete projects
      description: Delete projects batch
      operationId: deleteProjectsBatch
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchDelete'
      responses:
        '204':
          description: No Content
  /v1/private/projects/feedback-scores/names:
    get:
      tags:
      - Projects
      summary: Find Feedback Score names By Project Ids
      description: Find Feedback Score names By Project Ids
      operationId: findFeedbackScoreNamesByProjectIds
      parameters:
      - name: project_ids
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Feedback Scores resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackScoreNames'
  /v1/private/projects/{id}/token-usage/names:
    get:
      tags:
      - Projects
      summary: Find Token Usage names
      description: Find Token Usage names
      operationId: findTokenUsageNames
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Token Usage names resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenUsageNames'
  /v1/private/projects/{id}/kpi-cards:
    post:
      tags:
      - Projects
      summary: Get Project KPI Cards
      description: Gets KPI card metrics for a project
      operationId: getProjectKpiCards
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KpiCardRequest'
      responses:
        '200':
          description: KPI Card Metrics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KpiCardResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /v1/private/projects/{id}/metrics:
    post:
      tags:
      - Projects
      summary: Get Project Metrics
      description: Gets specified metrics for a project
      operationId: getProjectMetrics
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectMetricRequest_Public'
      responses:
        '200':
          description: Project Metrics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectMetricResponse_Public'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Public'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Public'
  /v1/private/projects/stats:
    get:
      tags:
      - Projects
      summary: Get Project Stats
      description: Get Project Stats
      operationId: getProjectStats
      parameters:
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 10
      - name: name
        in: query
        schema:
          type: string
          description: Filter projects by name (partial match, case insensitive)
      - name: filters
        in: query
        schema:
          type: string
      - name: sorting
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Project Stats
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectStatsSummary'
  /v1/private/projects/retrieve:
    post:
      tags:
      - Projects
      summary: Retrieve project
      description: Retrieve project
      operationId: retrieveProject
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectRetrieve_Detailed'
      responses:
        '200':
          description: Project resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project_Detailed'
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Detailed'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Detailed'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Detailed'
  /v1/private/projects/{projectId}/activities:
    get:
      tags:
      - Projects
      summary: Get recent activity for a project
      description: Returns the most recent activity items across all entity types for a project, sorted by date descending.
      operationId: getRecentActivity
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        schema:
          minimum: 1
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          maximum: 100
          minimum: 1
          type: integer
          format: int32
          default: 10
      responses:
        '200':
          description: Recent activity page
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecentActivityPage_Public'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Public'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage_Public'
components:
  schemas:
    JsonNode_Public:
      type: object
    ExperimentScore_Public:
      required:
      - name
      - value
      type: object
      properties:
        name:
          minLength: 1
          type: string
        value:
          type: number
    ErrorMessage_Public:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: string
    PercentageValues_Detailed:
      type: object
      properties:
        p50:
          type: number
        p90:
          type: number
        p99:
          type: number
      readOnly: true
    TokenUsageNames:
      type: object
      properties:
        names:
          type: array
          items:
            type: string
    Comment_Public:
      required:
      - text
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        text:
          minLength: 1
          type: string
        created_at:
          type: string
          format: date-time
          readOnly: true
        last_updated_at:
          type: string
          format: date-time
          readOnly: true
        created_by:
          type: string
          readOnly: true
        last_updated_by:
          type: string
          readOnly: true
      readOnly: true
    StudioOptimizer_Public:
      required:
      - type
      type: object
      properties:
        type:
          minLength: 1
          type: string
        parameters:
          $ref: '#/components/schemas/JsonNode_Public'
    ProjectPage_Public:
      type: object
      properties:
        page:
          type: integer
          format: int32
        size:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        content:
          type: array
          items:
            $ref: '#/components/schemas/Project_Public'
        sortableBy:
          type: array
          items:
            type: string
    TraceThreadFilter_Public:
      type: object
      properties:
        field:
          type: string
        operator:
          type: string
          enum:
          - contains
          - not_contains
          - starts_with
          - ends_with
          - '='
          - '!='
          - '>'
          - '>='
          - <
          - <=
          - is_empty
          - is_not_empty
          - in
          - not_in
        key:
          type: string
        value:
          type: string
    KpiCardRequest:
      required:
      - entity_type
      - interval_start
      type: object
      properties:
        entity_type:
          type: string
          enum:
          - traces
          - spans
          - threads
        filters:
          type: string
        interval_start:
          type: string
          format: date-time
        interval_end:
          type: string
          format: date-time
    AlertPage_Public:
      type: object
      properties:
        page:
          type: integer
          format: int32
        size:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        content:
          type: array
          items:
            $ref: '#/components/schemas/Alert_Public'
        sortable_by:
          type: array
          items:
            type: string
    KpiMetric:
      type: object
      properties:
        type:
          type: string
          enum:
          - count
          - errors
          - avg_duration
          - total_cost
        current_value:
          type: number
          description: 'Metric value for the current period. Unit depends on `type`: `count` is an integer count; `errors` is a percentage in [0, 100]; `avg_duration` is milliseconds; `total_cost` is in USD.'
          format: double
        previous_value:
          type: number
          description: Metric value for the immediately preceding period of equal length. Same unit as `current_value`.
          format: double
    AssertionScoreAverage_Public:
      required:
      - name
      - value
      type: object
      properties:
        name:
          minLength: 1
          type: string
        value:
          type: number
      description: Per-assertion average pass rates for test suite experiments. Null for regular experiments.
      readOnly: true
    PromptPage_Public:
      type: object
      properties:
        page:
          type: integer
          format: int32
        size:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        content:
          type: array
          items:
            $ref: '#/components/schemas/Prompt_Public'
        sortableBy:
          type: array
          items:
            type: string
    AlertTrigger_Public:
      required:
      - event_type
      type: object
      properties:
        id:
          type: string
          format: uuid
        alert_id:
          type: string
          format: uuid
          readOnly: true
        event_type:
          type: string
          enum:
          - trace:errors
          - trace:feedback_score
          - trace_thread:feedback_score
          - prompt:created
          - prompt:committed
          - trace:guardrails_triggered
          - prompt:deleted
          - experiment:finished
          - trace:cost
          - trace:latency
        trigger_configs:
          type: array
          items:
            $ref: '#/components/schemas/AlertTriggerConfig_Public'
        created_at:
          type: string
          format: date-time
          readOnly: true
        created_by:
          type: string
          readOnly: true
    ErrorMessage:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: string
    ErrorCountWithDeviation:
      type: object
      properties:
        count:
          type: integer
          format: int64
        deviation:
          type: integer
          format: int64
        deviation_percentage:
          type: integer
          format: int64
    ProjectRetrieve_Detailed:
      required:
      - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
    ErrorMessage_Detailed:
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
    FeedbackScoreNames:
      type: object
      properties:
        scores:
          type: array
          items:
            $ref: '#/components/schemas/ScoreName'
    DatasetVersionSummary_Public:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the version
          format: uuid
        version_hash:
          type: string
          description: Hash of the version content
        version_name:
          type: string
          description: Sequential version name formatted as 'v1', 'v2', etc.
        change_description:
          type: string
          description: Description of changes in this version
        tags:
          uniqueItems: true
          type: array
          description: Tags associated with this version
          items:
            type: string
            description: Tags associated with this version
      description: Summary of the latest dataset version
      readOnly: true
    JsonListString_Public:
      type: object
      anyOf:
      - type: object
      - type: array
        items:
          type: object
      - type: string
    ProjectStatsSummaryItem:
      type: object
      properties:
        project_id:
          type: string
          format: uuid
        feedback_scores:
          type: array
          items:
            $ref: '#/components/schemas/FeedbackScoreAverage'
        duration:
          $ref: '#/components/schemas/PercentageValues'
        total_estimated_cost:
          type: number
          format: double
        total_estimated_cost_sum:
          type: number
          format: double
        usage:
          type: object
          additionalProperties:
            type: number
            format: double
        trace_count:
          type: integer
          format: int64
        thread_count:
          type: integer
          format: int64
        guardrails_failed_count:
          type: integer
          format: int64
        error_count:
          $ref: '#/components/schemas/ErrorCountWithDeviation'
    SpanFilter_Public:
      type: object
      properties:
        field:
          type: string
        operator:
          type: string
          enum:
          - contains
          - not_contains
          - starts_with
          - ends_with
          - '='
          - '!='
          - '>'
          - '>='
          - <
          - <=
          - is_empty
          - is_not_empty
          - in
          - not_in
        key:
          type: string
        value:
          type: string
    OptimizationPage_Public:
      type: object
      properties:
        page:
          type: integer
          format: int32
        size:
          type: integer
          format: int32
        total:
          type: integer
          format: int64
        content:
          type: array
          items:
            $ref: '#/components/schemas/Optimization_Public'
        sortableBy:
          type: array
          items:
            type: string
    TraceFilter_Public:
      type: object
      properties:
        field:
          type: string
        operator:
          type: string
          enum:
          - contains
          - not_contains
          - starts_with
          - ends_with
          - '='
          - '!='
          - '>'
          - '>='
          - <
          - <=
          - is_empty
          - is_not_empty
          - in
          - not_in
        key:
          type: string
        value:
          type: string
    PromptVersionLink_Public:
      type: object
      properties:
        prompt_version_id:
          type: string
          format: uuid
        commit:
          type: string
        prompt_id:
          type: string
          format: uuid
        prompt_name:
          type: string
    Dashboard_Public:
      required:
      - config
      - name
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        workspace_id:
          type: string
          readOnly: true
        project_id:
          type: string
          description: Project ID. Takes precedence over project_name when both are provided.
          format: uuid
        name:
          maxLength: 120
          minLength: 1
          type: string
        slug:
          type: string
          readOnly: true
        type:
          type: string
          enum:
          - multi_project
          - experiments
        scope:
          type: string
          readOnly: true
          enum:
          - workspace
          - insights
        description:
          maxLength: 1000
          minLength: 0
          type: string
        config:
          $ref: '#/components/schemas/JsonNode_Public'
        created_by:
          type: string
          readOnly: true
        last_updated_by:
          type: string
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnl

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