{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/contextdb-ai/json-schema/contextdb-ai-execution-receipt-request-schema.json",
  "title": "ExecutionReceiptRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/contextdb-ai-openapi.yaml#/components/schemas/ExecutionReceiptRequest",
  "type": "object",
  "required": [
    "user_id",
    "decision_id",
    "action_name",
    "status"
  ],
  "properties": {
    "user_id": {
      "$ref": "#/$defs/UserId"
    },
    "decision_id": {
      "type": "string",
      "format": "uuid"
    },
    "action_name": {
      "type": "string",
      "pattern": "^[A-Za-z][A-Za-z0-9._:\\-]{0,127}$",
      "description": "Stable action category, such as appointment.book"
    },
    "status": {
      "type": "string",
      "enum": [
        "succeeded",
        "failed",
        "skipped"
      ]
    },
    "external_ref": {
      "type": "string",
      "pattern": "^[A-Za-z0-9._:\\-]{1,128}$",
      "description": "Optional opaque non-PII identifier in the downstream system"
    },
    "error_code": {
      "type": "string",
      "pattern": "^[A-Za-z0-9._:\\-]{1,128}$",
      "description": "Structured failure code; allowed only when status is failed"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "UserId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9._:@+\\-]{1,128}$",
      "description": "End-user memory partition key. Not an identity assertion."
    }
  }
}