Traces API
POST Traces
Getting Started
Tracing
- Tracing Overview
- Features
Evaluations & Testing
Supported Integrations
- Overview
- Observability Tools
- LLM Frameworks
- LLM & Tools
- Vector Stores
- Web Frameworks
- OTEL Exporters
API Reference
- Project APIs
- Prompt Registry APIs
- Traces API
Hosting
- Overview
- Configuration
- Authentication
- Hosting Options
Contact Us
Traces API
POST Traces
This endpoint lets you download traces for a project.
curl -H "x-api-key: <LANGTRACE_API_KEY>" \
-X POST \
'https://app.langtrace.ai/api/traces' \
--data-raw '{"page":1,"pageSize":1,"projectId":"<PROJECT_ID>"}'
{"traces":{"result":[[{"name":"openai.chat.completions.create","trace_id":"0xebc4fe02c5291fdb1981228f49030cc4","span_id":"0x1c164d07b2c0fe71","trace_state":"[]","kind":0,"parent_id":"","start_time":"2024-08-08T21:25:30.275984Z","end_time":"2024-08-08T21:25:31.083383Z","attributes":"{\"langtrace.service.name\":\"OpenAI\",\"langtrace.service.type\":\"llm\",\"langtrace.service.version\":\"1.37.1\",\"langtrace.version\":\"2.2.17\",\"langtrace.sdk.name\":\"langtrace-python-sdk\",\"url.full\":\"https://api.openai.com/v1/\",\"url.path\":\"/chat/completions\",\"gen_ai.operation.name\":\"chat\",\"gen_ai.request.model\":\"gpt-4o-mini\",\"gen_ai.request.stream\":false,\"gen_ai.system\":\"openai\",\"gen_ai.response.model\":\"gpt-4o-mini-2024-07-18\",\"gen_ai.system_fingerprint\":\"fp_48196bc67a\",\"gen_ai.usage.input_tokens\":357,\"gen_ai.usage.output_tokens\":24,\"gen_ai.usage.total_tokens\":381}","status_code":"OK","events":"[{\"name\":\"gen_ai.content.prompt\",\"timestamp\":\"2024-08-08T21:25:30.276067Z\",\"attributes\":{\"gen_ai.prompt\":\"[{\\\"role\\\": \\\"system\\\", \\\"content\\\": \\\"You are a friendly customer support agent for Langtrace AI. You are helping a user with a question. Please provide a helpful response. Important: The response should be helpful and informative. DO NOT make up any information. Given some Context and a User Question, answer the question based on the provided context.\\\"}]\"}},{\"name\":\"gen_ai.content.completion\",\"timestamp\":\"2024-08-08T21:25:31.083279Z\",\"attributes\":{\"gen_ai.completion\":\"[{\\\"role\\\": \\\"assistant\\\", \\\"content\\\": \\\"Hello! I'm doing well, thank you! How can I assist you today with Langtrace or any of your questions?\\\"}]\"}}]","links":"[]","duration":807999}]],"metadata":{"page":1,"page_size":1,"total_pages":10}}}
You will need a project level API key which can be generated on the same page
by clicking Generate API Key
.
A complete list of supported parameters for the POST traces
endpoint is provided below.
Your project level API key. This is a header parameter.
ID of your project. This can be found on the langtrace traces tab.
The page number to retrieve. Starts from 1.
The number of traces to retrieve per page. Maximum value is 100.
List of retrieved traces.
curl -H "x-api-key: <LANGTRACE_API_KEY>" \
-X POST \
'https://app.langtrace.ai/api/traces' \
--data-raw '{"page":1,"pageSize":1,"projectId":"<PROJECT_ID>"}'
{"traces":{"result":[[{"name":"openai.chat.completions.create","trace_id":"0xebc4fe02c5291fdb1981228f49030cc4","span_id":"0x1c164d07b2c0fe71","trace_state":"[]","kind":0,"parent_id":"","start_time":"2024-08-08T21:25:30.275984Z","end_time":"2024-08-08T21:25:31.083383Z","attributes":"{\"langtrace.service.name\":\"OpenAI\",\"langtrace.service.type\":\"llm\",\"langtrace.service.version\":\"1.37.1\",\"langtrace.version\":\"2.2.17\",\"langtrace.sdk.name\":\"langtrace-python-sdk\",\"url.full\":\"https://api.openai.com/v1/\",\"url.path\":\"/chat/completions\",\"gen_ai.operation.name\":\"chat\",\"gen_ai.request.model\":\"gpt-4o-mini\",\"gen_ai.request.stream\":false,\"gen_ai.system\":\"openai\",\"gen_ai.response.model\":\"gpt-4o-mini-2024-07-18\",\"gen_ai.system_fingerprint\":\"fp_48196bc67a\",\"gen_ai.usage.input_tokens\":357,\"gen_ai.usage.output_tokens\":24,\"gen_ai.usage.total_tokens\":381}","status_code":"OK","events":"[{\"name\":\"gen_ai.content.prompt\",\"timestamp\":\"2024-08-08T21:25:30.276067Z\",\"attributes\":{\"gen_ai.prompt\":\"[{\\\"role\\\": \\\"system\\\", \\\"content\\\": \\\"You are a friendly customer support agent for Langtrace AI. You are helping a user with a question. Please provide a helpful response. Important: The response should be helpful and informative. DO NOT make up any information. Given some Context and a User Question, answer the question based on the provided context.\\\"}]\"}},{\"name\":\"gen_ai.content.completion\",\"timestamp\":\"2024-08-08T21:25:31.083279Z\",\"attributes\":{\"gen_ai.completion\":\"[{\\\"role\\\": \\\"assistant\\\", \\\"content\\\": \\\"Hello! I'm doing well, thank you! How can I assist you today with Langtrace or any of your questions?\\\"}]\"}}]","links":"[]","duration":807999}]],"metadata":{"page":1,"page_size":1,"total_pages":10}}}
curl -H "x-api-key: <LANGTRACE_API_KEY>" \
-X POST \
'https://app.langtrace.ai/api/traces' \
--data-raw '{"page":1,"pageSize":1,"projectId":"<PROJECT_ID>"}'
{"traces":{"result":[[{"name":"openai.chat.completions.create","trace_id":"0xebc4fe02c5291fdb1981228f49030cc4","span_id":"0x1c164d07b2c0fe71","trace_state":"[]","kind":0,"parent_id":"","start_time":"2024-08-08T21:25:30.275984Z","end_time":"2024-08-08T21:25:31.083383Z","attributes":"{\"langtrace.service.name\":\"OpenAI\",\"langtrace.service.type\":\"llm\",\"langtrace.service.version\":\"1.37.1\",\"langtrace.version\":\"2.2.17\",\"langtrace.sdk.name\":\"langtrace-python-sdk\",\"url.full\":\"https://api.openai.com/v1/\",\"url.path\":\"/chat/completions\",\"gen_ai.operation.name\":\"chat\",\"gen_ai.request.model\":\"gpt-4o-mini\",\"gen_ai.request.stream\":false,\"gen_ai.system\":\"openai\",\"gen_ai.response.model\":\"gpt-4o-mini-2024-07-18\",\"gen_ai.system_fingerprint\":\"fp_48196bc67a\",\"gen_ai.usage.input_tokens\":357,\"gen_ai.usage.output_tokens\":24,\"gen_ai.usage.total_tokens\":381}","status_code":"OK","events":"[{\"name\":\"gen_ai.content.prompt\",\"timestamp\":\"2024-08-08T21:25:30.276067Z\",\"attributes\":{\"gen_ai.prompt\":\"[{\\\"role\\\": \\\"system\\\", \\\"content\\\": \\\"You are a friendly customer support agent for Langtrace AI. You are helping a user with a question. Please provide a helpful response. Important: The response should be helpful and informative. DO NOT make up any information. Given some Context and a User Question, answer the question based on the provided context.\\\"}]\"}},{\"name\":\"gen_ai.content.completion\",\"timestamp\":\"2024-08-08T21:25:31.083279Z\",\"attributes\":{\"gen_ai.completion\":\"[{\\\"role\\\": \\\"assistant\\\", \\\"content\\\": \\\"Hello! I'm doing well, thank you! How can I assist you today with Langtrace or any of your questions?\\\"}]\"}}]","links":"[]","duration":807999}]],"metadata":{"page":1,"page_size":1,"total_pages":10}}}