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

Get spans by project_name or project_id and optionally by trace_id and/or type

GET
/v1/private/spans
GET
/api/v1/private/spans
$curl http://localhost:5173/api/v1/private/spans
200Retrieved
1{
2 "page": 1,
3 "size": 1,
4 "total": 1,
5 "content": [
6 {
7 "start_time": "2024-01-15T09:30:00Z",
8 "id": "string",
9 "project_name": "string",
10 "project_id": "string",
11 "trace_id": "string",
12 "parent_span_id": "string",
13 "name": "string",
14 "type": "general",
15 "end_time": "2024-01-15T09:30:00Z",
16 "input": {},
17 "output": {},
18 "metadata": {},
19 "model": "string",
20 "provider": "string",
21 "tags": [
22 "string"
23 ],
24 "usage": {},
25 "error_info": {
26 "exception_type": "string",
27 "traceback": "string",
28 "message": "string"
29 },
30 "created_at": "2024-01-15T09:30:00Z",
31 "last_updated_at": "2024-01-15T09:30:00Z",
32 "created_by": "string",
33 "last_updated_by": "string",
34 "feedback_scores": [
35 {
36 "name": "string",
37 "value": 1.1,
38 "source": "ui",
39 "category_name": "string",
40 "reason": "string",
41 "created_at": "2024-01-15T09:30:00Z",
42 "last_updated_at": "2024-01-15T09:30:00Z",
43 "created_by": "string",
44 "last_updated_by": "string",
45 "value_by_author": {}
46 }
47 ],
48 "comments": [
49 {
50 "text": "string",
51 "id": "string",
52 "created_at": "2024-01-15T09:30:00Z",
53 "last_updated_at": "2024-01-15T09:30:00Z",
54 "created_by": "string",
55 "last_updated_by": "string"
56 }
57 ],
58 "total_estimated_cost": 1.1,
59 "total_estimated_cost_version": "string",
60 "duration": 1.1,
61 "ttft": 1.1,
62 "source": "sdk",
63 "environment": "string"
64 }
65 ],
66 "sortableBy": [
67 "string"
68 ]
69}

Get spans by project_name or project_id and optionally by trace_id and/or type

Was this page helpful?
Previous

Create span

Next
Built with

Query parameters

pageintegerOptional>=1Defaults to 1
sizeintegerOptional>=1Defaults to 10
project_namestringOptional
project_idstringOptionalformat: "uuid"
trace_idstringOptionalformat: "uuid"
typeenumOptional
Allowed values:
filtersstringOptional
truncatebooleanOptionalDefaults to false
strip_attachmentsbooleanOptionalDefaults to false
sortingstringOptional
excludestringOptional
searchstringOptional
from_timedatetimeOptional
to_timedatetimeOptional

Response

Spans resource
pageinteger
sizeinteger
totallong
contentlist of objects
sortableBylist of strings