Skip to main content
This endpoint is called by server-side middleware that intercepts in-domain requests made by agents. The SDK key identifies the project by calling UASAM to verify ownership, and the session token — a short-lived JWT issued at session creation — scopes the recorded event to a specific agent session. You do not call this endpoint directly from agent code; it is invoked automatically by the OTAS middleware installed in your backend framework.

Request

X-OTAS-SDK-KEY
string
required
Backend SDK key for the project. Verified against UASAM before the event is stored.
X-OTAS-AGENT-SESSION-TOKEN
string
required
Session JWT obtained from the session creation endpoint. Carries agent_session_id and agent_id claims.

Body

Required fields
project_id
string
required
UUID of the project this event belongs to.
path
string
required
The API path that was called (e.g. /api/v1/users/).
method
string
required
HTTP method of the request (e.g. GET, POST, PUT, DELETE).
status_code
number
required
HTTP response status code returned by the upstream service.
latency_ms
number
required
Round-trip latency of the request in milliseconds.
Optional fields
request_size_bytes
number
Size of the request payload in bytes.
response_size_bytes
number
Size of the response payload in bytes.
request_headers
string
Serialized request headers (e.g. a JSON-encoded string of key-value pairs).
request_body
string
Raw or serialized request body.
query_params
string
Query string or serialized query parameters.
post_data
string
Form post data, if applicable.
response_headers
string
Serialized response headers.
response_body
string
Raw or serialized response body.
request_content_type
string
Content-Type of the request (e.g. application/json).
response_content_type
string
Content-Type of the response.
custom_properties
object
Arbitrary JSON object for attaching user-defined metadata to the event.
error
string
Error message or identifier, if the request resulted in an error. Leave empty on success.
metadata
object
Additional JSON metadata for internal or debugging purposes.

Response

On success the endpoint returns HTTP 201 with an empty response object. Unlike the agent log endpoint, no event_id is returned here — the SDK log path does not expose the created record’s identifier.
status
number
required
1 on success, 0 on failure.
status_description
string
required
event_captured on success.
response
object
required
Empty object {}. No event ID is included.

Errors

HTTPstatus_descriptionMeaning
401missing_sdk_keyX-OTAS-SDK-KEY header was not provided.
401invalid_sdk_keyThe SDK key was not recognised or is inactive.
401missing_agent_session_tokenX-OTAS-AGENT-SESSION-TOKEN header was not provided.
401invalid_or_expired_tokenThe session JWT is malformed, expired, or has invalid claims.
400invalid_jsonThe request body could not be parsed as JSON.
400missing_required_fieldsOne or more required body fields are absent. See missing_fields.
500event_capture_failedAn unexpected server-side error occurred while saving the event.
When status_description is missing_required_fields, the response also includes a missing_fields array listing each absent field name.
curl --request POST \
  --url http://localhost:8002/api/v1/backend/log/sdk/ \
  --header "X-OTAS-SDK-KEY: sdk_live_abc123" \
  --header "X-OTAS-AGENT-SESSION-TOKEN: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  --header "Content-Type: application/json" \
  --data '{
    "project_id": "3f6e2b10-8c1a-4d55-b9d4-0a2e3c7f1234",
    "path": "/api/v1/users/",
    "method": "GET",
    "status_code": 200,
    "latency_ms": 87.4,
    "request_size_bytes": 0,
    "response_size_bytes": 1024,
    "request_headers": "{\"Accept\": \"application/json\"}",
    "request_body": "",
    "query_params": "page=1&limit=20",
    "post_data": "",
    "response_headers": "{\"Content-Type\": \"application/json\"}",
    "response_body": "{\"users\": [...]}",
    "request_content_type": "application/json",
    "response_content_type": "application/json",
    "custom_properties": {},
    "error": "",
    "metadata": {}
  }'
{
  "status": 1,
  "status_description": "event_captured",
  "response": {}
}

Build docs developers (and LLMs) love