For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Copy to LLMGithubGo to App
DocumentationIntegrationsAgent OptimizationSelf-hosting OpikSDK & API referenceOpik University
DocumentationIntegrationsAgent OptimizationSelf-hosting OpikSDK & API referenceOpik University
    • Overview
  • Python SDK
    • Reference
    • REST API Client
  • Typescript SDK
    • Overview
    • Opik TS
    • Prompts
    • Opik Query Language (OQL)
  • Rest API
    • Overview
        • POSTAdd span comment
        • PUTAdd span feedback score
        • POSTCreate spans
        • PATCHBatch update spans
        • GETGet spans by project_name or project_id and optionally by trace_id and/or type
        • POSTCreate span
        • GETGet span by id
        • DELDelete span by id
        • PATCHUpdate span by id
        • POSTDelete span comments
        • POSTDelete span feedback score
        • GETFind Feedback Score names
        • GETGet span comment
        • GETGet span stats
        • PUTBatch feedback scoring for spans
        • POSTSearch spans
        • PATCHUpdate span comment by id
LogoLogo
Copy to LLMGithubGo to App
Rest APIAPI ReferenceSpans

Create span

POST
/v1/private/spans
POST
/api/v1/private/spans
$curl -X POST http://localhost:5173/api/v1/private/spans \
> -H "Content-Type: application/json" \
> -d '{
> "start_time": "2024-01-15T09:30:00Z"
>}'
1{}
Create span
Was this page helpful?
Previous

Get span by id

Next
Built with

Request

This endpoint expects an object.
start_timedatetimeRequired
idstringOptionalformat: "uuid"
project_namestringOptionalformat: "(?s)^\s*(\S.*\S|\S)\s*$"
If null, the default project is used
trace_idstringOptionalformat: "uuid"
parent_span_idstringOptionalformat: "uuid"
namestringOptional
typeenumOptional
Allowed values:
end_timedatetimeOptional
inputmap from strings to any or list of objects or stringOptional
outputmap from strings to any or list of objects or stringOptional
metadatamap from strings to any or list of objects or stringOptional
modelstringOptional
providerstringOptional
tagslist of stringsOptional
usagemap from strings to integersOptional
error_infoobjectOptional
last_updated_atdatetimeOptional
total_estimated_costdoubleOptional>=0
total_estimated_cost_versionstringOptional
ttftdoubleOptional
Time to first token in milliseconds
sourceenumOptional
Allowed values:
environmentstringOptional0-150 characters

Response headers

Locationstring

Response

Created

Errors

409
Conflict Error