OpenAPI Specification
openapi: 3.1.0
info:
title: Opik REST Traces 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: Traces
description: Trace related resources
paths:
/v1/private/traces/threads/{id}/comments:
post:
tags:
- Traces
summary: Add thread comment
description: Add thread comment
operationId: addThreadComment
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
responses:
'201':
description: Created
headers:
Location:
required: true
style: simple
schema:
type: string
example: ${basePath}/v1/private/traces/threads/{threadId}/comments/{commentId}
/v1/private/traces/{id}/comments:
post:
tags:
- Traces
summary: Add trace comment
description: Add trace comment
operationId: addTraceComment
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
responses:
'201':
description: Created
headers:
Location:
required: true
style: simple
schema:
type: string
example: ${basePath}/v1/private/traces/{traceId}/comments/{commentId}
/v1/private/traces/{id}/feedback-scores:
put:
tags:
- Traces
summary: Add trace feedback score
description: Add trace feedback score
operationId: addTraceFeedbackScore
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackScore'
responses:
'204':
description: No Content
/v1/private/traces/batch:
post:
tags:
- Traces
summary: Create traces
description: Create traces
operationId: createTraces
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceBatch_Write'
responses:
'204':
description: No Content
patch:
tags:
- Traces
summary: Batch update traces
description: Update multiple traces
operationId: batchUpdateTraces
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceBatchUpdate'
responses:
'204':
description: No Content
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/v1/private/traces/threads/batch:
patch:
tags:
- Traces
summary: Batch update threads
description: Update multiple threads
operationId: batchUpdateThreads
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThreadBatchUpdate'
responses:
'204':
description: No Content
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/v1/private/traces/threads/close:
put:
tags:
- Traces
summary: Close trace thread(s)
description: Close one or multiple trace threads. Supports both single thread_id and multiple thread_ids for batch operations.
operationId: closeTraceThread
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThreadBatchIdentifier'
responses:
'204':
description: No Content
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/v1/private/traces:
get:
tags:
- Traces
summary: Get traces by project_name or project_id
description: Get traces by project_name or project_id
operationId: getTracesByProject
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: project_name
in: query
schema:
type: string
- name: project_id
in: query
schema:
type: string
format: uuid
- name: filters
in: query
schema:
type: string
- name: truncate
in: query
schema:
type: boolean
description: Truncate input, output and metadata to slim payloads
default: false
- name: strip_attachments
in: query
schema:
type: boolean
description: If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
default: false
- name: sorting
in: query
schema:
type: string
- name: exclude
in: query
schema:
type: string
- name: search
in: query
schema:
type: string
description: Full-text search across trace fields
- name: from_time
in: query
schema:
type: string
description: Filter traces created from this time (ISO-8601 format).
format: date-time
- name: to_time
in: query
schema:
type: string
description: Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
format: date-time
responses:
'200':
description: Trace resource
content:
application/json:
schema:
$ref: '#/components/schemas/TracePage_Public'
post:
tags:
- Traces
summary: Create trace
description: Get trace
operationId: createTrace
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Trace_Write'
responses:
'201':
description: Created
headers:
Location:
required: true
style: simple
schema:
type: string
example: ${basePath}/v1/private/traces/{traceId}
/v1/private/traces/{id}:
get:
tags:
- Traces
summary: Get trace by id
description: Get trace by id
operationId: getTraceById
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
- name: strip_attachments
in: query
schema:
type: boolean
description: 'If true, returns attachment references like [file.png]; if false, downloads and reinjects attachment content from S3 (default: false for backward compatibility)'
default: false
responses:
'200':
description: Trace resource
content:
application/json:
schema:
$ref: '#/components/schemas/Trace_Public'
delete:
tags:
- Traces
summary: Delete trace by id
description: Delete trace by id
operationId: deleteTraceById
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'204':
description: No Content
patch:
tags:
- Traces
summary: Update trace by id
description: Update trace by id
operationId: updateTrace
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceUpdate'
responses:
'204':
description: No Content
/v1/private/traces/threads/comments/delete:
post:
tags:
- Traces
summary: Delete thread comments
description: Delete thread comments
operationId: deleteThreadComments
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchDelete'
responses:
'204':
description: No Content
/v1/private/traces/threads/feedback-scores/delete:
post:
tags:
- Traces
summary: Delete thread feedback scores
description: Delete thread feedback scores
operationId: deleteThreadFeedbackScores
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteThreadFeedbackScores'
responses:
'204':
description: No Content
/v1/private/traces/comments/delete:
post:
tags:
- Traces
summary: Delete trace comments
description: Delete trace comments
operationId: deleteTraceComments
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchDelete'
responses:
'204':
description: No Content
/v1/private/traces/{id}/feedback-scores/delete:
post:
tags:
- Traces
summary: Delete trace feedback score
description: Delete trace feedback score
operationId: deleteTraceFeedbackScore
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteFeedbackScore'
responses:
'204':
description: No Content
/v1/private/traces/threads/delete:
post:
tags:
- Traces
summary: Delete trace threads
description: Delete trace threads
operationId: deleteTraceThreads
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteTraceThreads'
responses:
'204':
description: No Content
/v1/private/traces/delete:
post:
tags:
- Traces
summary: Delete traces
description: Delete traces
operationId: deleteTraces
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchDelete'
responses:
'204':
description: No Content
/v1/private/traces/feedback-scores/names:
get:
tags:
- Traces
summary: Find Feedback Score names
description: Find Feedback Score names
operationId: findFeedbackScoreNames_2
parameters:
- name: project_id
in: query
schema:
type: string
format: uuid
responses:
'200':
description: Feedback Scores resource
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackScoreNames_Public'
/v1/private/traces/threads/feedback-scores/names:
get:
tags:
- Traces
summary: Find Trace Threads Feedback Score names
description: Find Trace Threads Feedback Score names
operationId: findTraceThreadsFeedbackScoreNames
parameters:
- name: project_id
in: query
schema:
type: string
format: uuid
responses:
'200':
description: Find Trace Threads Feedback Score names
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackScoreNames_Public'
/v1/private/traces/stats:
get:
tags:
- Traces
summary: Get trace stats
description: Get trace stats
operationId: getTraceStats
parameters:
- name: project_id
in: query
schema:
type: string
format: uuid
- name: project_name
in: query
schema:
type: string
- name: filters
in: query
schema:
type: string
- name: search
in: query
schema:
type: string
description: Full-text search across trace fields
- name: from_time
in: query
schema:
type: string
description: Filter traces created from this time (ISO-8601 format).
format: date-time
- name: to_time
in: query
schema:
type: string
description: Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
format: date-time
responses:
'200':
description: Trace stats resource
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectStats_Public'
/v1/private/traces/threads/{threadId}/comments/{commentId}:
get:
tags:
- Traces
summary: Get thread comment
description: Get thread comment
operationId: getThreadComment
parameters:
- name: commentId
in: path
required: true
schema:
type: string
format: uuid
- name: threadId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Comment resource
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/v1/private/traces/threads/stats:
get:
tags:
- Traces
summary: Get trace thread stats
description: Get trace thread stats
operationId: getTraceThreadStats
parameters:
- name: project_id
in: query
schema:
type: string
format: uuid
- name: project_name
in: query
schema:
type: string
- name: filters
in: query
schema:
type: string
- name: search
in: query
schema:
type: string
description: Full-text search across thread fields
- name: from_time
in: query
schema:
type: string
description: Filter trace threads created from this time (ISO-8601 format).
format: date-time
- name: to_time
in: query
schema:
type: string
description: Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
format: date-time
responses:
'200':
description: Trace thread stats resource
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectStats_Public'
/v1/private/traces/{traceId}/comments/{commentId}:
get:
tags:
- Traces
summary: Get trace comment
description: Get trace comment
operationId: getTraceComment
parameters:
- name: commentId
in: path
required: true
schema:
type: string
format: uuid
- name: traceId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Comment resource
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/v1/private/traces/threads/retrieve:
post:
tags:
- Traces
summary: Get trace thread
description: Get trace thread
operationId: getTraceThread
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThreadIdentifier'
responses:
'200':
description: Trace thread resource
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThread'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
/v1/private/traces/threads:
get:
tags:
- Traces
summary: Get trace threads
description: Get trace threads
operationId: getTraceThreads
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: project_name
in: query
schema:
type: string
- name: project_id
in: query
schema:
type: string
format: uuid
- name: truncate
in: query
schema:
type: boolean
description: Truncate input, output and metadata to slim payloads
default: false
- name: strip_attachments
in: query
schema:
type: boolean
description: If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
default: false
- name: filters
in: query
schema:
type: string
- name: sorting
in: query
schema:
type: string
- name: search
in: query
schema:
type: string
description: Full-text search across thread fields
- name: from_time
in: query
schema:
type: string
description: Filter trace threads created from this time (ISO-8601 format).
format: date-time
- name: to_time
in: query
schema:
type: string
description: Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
format: date-time
responses:
'200':
description: Trace threads resource
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThreadPage'
/v1/private/traces/threads/open:
put:
tags:
- Traces
summary: Open trace thread
description: Open trace thread
operationId: openTraceThread
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThreadIdentifier'
responses:
'204':
description: No Content
/v1/private/traces/threads/feedback-scores:
put:
tags:
- Traces
summary: Batch feedback scoring for threads
description: Batch feedback scoring for threads
operationId: scoreBatchOfThreads
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackScoreBatchThread'
responses:
'204':
description: No Content
/v1/private/traces/feedback-scores:
put:
tags:
- Traces
summary: Batch feedback scoring for traces
description: Batch feedback scoring for traces
operationId: scoreBatchOfTraces
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FeedbackScoreBatch'
responses:
'204':
description: No Content
/v1/private/traces/threads/search:
post:
tags:
- Traces
summary: Search trace threads
description: Search trace threads
operationId: searchTraceThreads
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThreadSearchStreamRequest'
responses:
'200':
description: Trace threads stream or error during process
content:
application/octet-stream:
schema:
maxItems: 2000
type: array
items:
type: string
anyOf:
- $ref: '#/components/schemas/TraceThread'
- $ref: '#/components/schemas/ErrorMessage'
'400':
description: Bad Request
content:
application/octet-stream:
schema:
$ref: '#/components/schemas/ErrorMessage'
/v1/private/traces/search:
post:
tags:
- Traces
summary: Search traces
description: Search traces
operationId: searchTraces
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceSearchStreamRequest_Public'
responses:
'200':
description: Traces stream or error during process
content:
application/octet-stream:
schema:
maxItems: 2000
type: array
items:
type: string
anyOf:
- $ref: '#/components/schemas/Trace_Public'
- $ref: '#/components/schemas/ErrorMessage_Public'
'400':
description: Bad Request
content:
application/octet-stream:
schema:
$ref: '#/components/schemas/ErrorMessage_Public'
'401':
description: Unauthorized
content:
application/octet-stream:
schema:
$ref: '#/components/schemas/ErrorMessage_Public'
/v1/private/traces/threads/{threadModelId}:
patch:
tags:
- Traces
summary: Update thread
description: Update thread
operationId: updateThread
parameters:
- name: threadModelId
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TraceThreadUpdate'
responses:
'204':
description: No Content
'404':
description: Not found
/v1/private/traces/threads/comments/{commentId}:
patch:
tags:
- Traces
summary: Update thread comment by id
description: Update thread comment by id
operationId: updateThreadComment
parameters:
- name: commentId
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
responses:
'204':
description: No Content
'404':
description: Not found
/v1/private/traces/comments/{commentId}:
patch:
tags:
- Traces
summary: Update trace comment by id
description: Update trace comment by id
operationId: updateTraceComment
parameters:
- name: commentId
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Comment'
responses:
'204':
description: No Content
'404':
description: Not found
components:
schemas:
ErrorMessage_Public:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: string
FeedbackScoreBatchItemThread:
required:
- name
- source
- thread_id
- value
type: object
properties:
project_name:
pattern: (?s)^\s*(\S.*\S|\S)\s*$
type: string
description: If null, the default project is used
project_id:
type: string
format: uuid
name:
minLength: 1
type: string
category_name:
type: string
value:
maximum: 1000000000.0
exclusiveMaximum: false
minimum: -1000000000.0
exclusiveMinimum: false
type: number
reason:
type: string
source:
type: string
enum:
- ui
- sdk
- online_scoring
author:
type: string
thread_id:
minLength: 1
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
ValueEntry:
type: object
properties:
value:
type: number
reason:
type: string
category_name:
type: string
source:
type: string
enum:
- ui
- sdk
- online_scoring
last_updated_at:
type: string
format: date-time
span_type:
type: string
span_id:
type: string
readOnly: true
ErrorInfo_Write:
required:
- exception_type
- traceback
type: object
properties:
exception_type:
minLength: 1
type: string
message:
type: string
traceback:
minLength: 1
type: string
FeedbackScore_Public:
required:
- name
- source
- value
type: object
properties:
name:
minLength: 1
type: string
category_name:
type: string
value:
maximum: 1000000000.0
exclusiveMaximum: false
minimum: -1000000000.0
exclusiveMinimum: false
type: number
reason:
type: string
source:
type: string
enum:
- ui
- sdk
- online_scoring
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
value_by_author:
type: object
additionalProperties:
$ref: '#/components/schemas/ValueEntry_Public'
readOnly: true
description: Aggregated feedback scores from all spans in this trace, averaged by score name
readOnly: true
TraceBatchUpdate:
required:
- ids
- update
type: object
properties:
ids:
maxItems: 1000
minItems: 1
uniqueItems: true
type: array
description: List of trace IDs to update (max 1000)
items:
type: string
description: List of trace IDs to update (max 1000)
format: uuid
update:
$ref: '#/components/schemas/TraceUpdate'
merge_tags:
type: boolean
description: 'If true, merge tags with existing tags instead of replacing them. Default: false'
description: Request to batch update multiple traces
TraceBatch_Write:
required:
- traces
type: object
properties:
traces:
maxItems: 1000
minItems: 1
type: array
items:
$ref: '#/components/schemas/Trace_Write'
ErrorMessage:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: string
ProjectStats_Public:
type: object
properties:
stats:
type: array
items:
$ref: '#/components/schemas/ProjectStatItemObject_Public'
FeedbackScoreBatchItem:
required:
- id
- name
- source
- value
type: object
properties:
project_name:
pattern: (?s)^\s*(\S.*\S|\S)\s*$
type: string
description: If null, the default project is used
project_id:
type: string
format: uuid
name:
minLength: 1
type: string
category_name:
type: string
value:
maximum: 1000000000.0
exclusiveMaximum: false
minimum: -1000000000.0
exclusiveMinimum: false
type: number
reason:
type: string
source:
type: string
enum:
- ui
- sdk
- online_scoring
author:
type: string
id:
type: string
format: uuid
ErrorInfo_Public:
required:
- exception_type
- traceback
type: object
properties:
exception_type:
minLength: 1
type: string
message:
type: string
traceback:
minLength: 1
type: string
Trace_Public:
required:
- start_time
type: object
properties:
id:
type: string
format: uuid
project_
# --- truncated at 32 KB (53 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/opik/refs/heads/main/openapi/opik-traces-api-openapi.yml