The complete endpoint finalizes a trace by setting its terminal status, recording the output or error summary, and computing the total duration. Once a trace reachesDocumentation Index
Fetch the complete documentation index at: https://docs.mortemlabs.com/llms.txt
Use this file to discover all available pages before exploring further.
"completed" or "errored" status, the analysis worker picks it up and generates the post-trade autopsy visible in the dashboard.
session.complete(outputSummary) and session.fail(error) call it for you as part of the session lifecycle. Use this endpoint when you are calling the Ingest API directly or need to finalize a trace from outside the process that created it.
Path parameters
The trace ID to finalize. This must be the ID of a trace that was previously created through the batch endpoint and belongs to the agent identified by your API key. Returns
404 if the trace is not found or does not belong to your agent.Request headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <MORTEM_API_KEY> | Yes |
Content-Type | application/json | When sending a body |
Request body
The request body is optional. Send it as JSON to write output or error information alongside the status update. If you omit the body entirely, the trace is marked"completed" with the current server time as endedAt.
The terminal status for the trace. Use
"completed" for a successful run and "errored" for a run that ended in a failure. Accepted values are "completed", "errored", "running", and "timeout".Only traces with status
"completed" or "errored" are queued for LLM analysis. Finalizing a trace with any other status skips the analysis step.A human-readable description of what the agent produced or decided. This appears in the dashboard trace header and is used as context by the analysis worker. Pass
null to leave the field empty.The error message or stringified exception when
status is "errored". The analysis worker uses this alongside event data to diagnose what went wrong. Pass null to clear a previously set value.ISO 8601 datetime string for when the trace ended. Defaults to the current server time if omitted. Provide this when you are finalizing a trace after the fact and want the duration to reflect the actual wall-clock time.
Response
On success the endpoint returns200 OK with the trace ID.