Skip to main content

Receipts & Sessions API

The Receipts API provides read-only access to immutable execution receipts. Every tool invocation — whether from a human user, an AI agent, or a service — produces a receipt that captures the execution context, policy decision, and result status. Use receipts for audit trails, compliance reporting, and debugging failed executions.

Receipts Endpoints

MethodPathDescription
GET/v1/receiptsQuery receipts
GET/v1/receipts/{receipt_id}Get receipt by ID

Query Receipts

GET /v1/receipts

Returns a paginated list of execution receipts matching the specified filters. All filters are optional — omitting all filters returns the most recent receipts for the organization.

Query Parameters

ParameterTypeDescription
receipt_idstringFilter by specific receipt UUID
principalstringFilter by executor identity (e.g., user:jane@example.com)
tool_idintegerFilter by tool
fromdatetimeStart of date range (ISO 8601)
todatetimeEnd of date range (ISO 8601)
result_statusstringok or error
policy_decisionstringallow, deny, allow_with_redactions, or allow_with_limits
limitintegerMax results (default 50, max 200)
offsetintegerPagination offset

Request:

curl -X GET "https://api-genai.nexla.io/v1/receipts?tool_id=42&result_status=error&from=2025-01-01T00:00:00Z&limit=10" \
-H "Authorization: Bearer $NEXLA_SERVICE_KEY"

Response (200):

{
"items": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"org_id": 1,
"principal": "user:jane@example.com",
"tool_id": 42,
"tool_key": "read_customer_orders",
"version": "1.0.0",
"result_status": "error",
"actor_type": "agent",
"auth_type": "api_key",
"policy_decision": "allow",
"trace_id": "abc-123-def",
"created_at": "2025-01-15T14:30:00Z"
}
],
"total": 1,
"limit": 10,
"offset": 0
}

Get Receipt Details

GET /v1/receipts/{receipt_id}

Returns the full receipt for a single execution, including the complete execution result. Use this when you need to inspect the input arguments hash, row counts, or truncation status that are not included in the list response.

Request:

curl -X GET "https://api-genai.nexla.io/v1/receipts/550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer $NEXLA_SERVICE_KEY"

Response (200):

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"org_id": 1,
"principal": "user:jane@example.com",
"tool_id": 42,
"tool_key": "read_customer_orders",
"version": "1.0.0",
"args_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"result_status": "error",
"actor_type": "agent",
"auth_type": "api_key",
"policy_decision": "allow",
"trace_id": "abc-123-def",
"row_count": 0,
"truncated": false,
"created_at": "2025-01-15T14:30:00Z"
}

Receipt Schema

Full field reference for receipt objects:

FieldTypeDescription
idUUIDUnique receipt identifier
org_idintegerOrganization that owns the tool
principalstringIdentity of the executor (e.g., user:jane@example.com, service:etl-pipeline)
tool_idintegerID of the executed tool
tool_keystringStable key name of the tool
versionstringTool version at time of execution
args_hashstringSHA-256 hash of the input arguments
result_statusstringok or error
actor_typestringhuman, agent, or service
auth_typestringapi_key, oauth, oidc_jwt, or mtls
policy_decisionstringallow, deny, allow_with_redactions, or allow_with_limits
trace_idstringDistributed trace identifier for correlating across services
row_countintegerNumber of rows returned (for data tools)
truncatedbooleanWhether the result was truncated due to size limits
created_atdatetimeTimestamp of execution (ISO 8601)