Insert a Log
API Reference: POST /v1/logs
This endpoint stores a log object in the Portkey log store.
Log Object Format
The log object consists of three main parts:
request
:url
(required)provider
(required)headers
(required)method
(optional, defaults to "POST")body
(required)
response
:status
(optional, defaults to 200)headers
(required)body
(required)response_time
(required, represents response latency)
metadata
:Contains organization, user, and request-specific information
trace_id
(optional)span_id
(optional)
Additional optional fields in metadata for trace instrumentation:
parent_span_id
span_name
Request Format
Single Log: Send a single log object directly in the request body.
Multiple Logs: Submit an array of log objects in the request body.
This flexible format allows sending either individual logs or batches of logs in a single request.
Sample Log Object
Response Format
The API will respond with a 200
acknowledging that the log has been stored and will be available on your dashboard soon.
Last updated
Was this helpful?