{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/klanexai-com/json-schema/klanexai-com-create-execution-request-schema.json",
  "title": "CreateExecutionRequest",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/klanexai-com-openapi.yml#/components/schemas/CreateExecutionRequest",
  "type": "object",
  "required": [
    "target"
  ],
  "properties": {
    "target": {
      "$ref": "#/$defs/Target"
    },
    "payload": {
      "description": "Agent-generated JSON body; stored byte-exact for replay."
    },
    "payload_schema": {
      "description": "JSON Schema; failing payloads are rejected with 422 + llm_hint."
    },
    "callback_url": {
      "type": "string",
      "format": "uri"
    },
    "max_attempts": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10,
      "default": 5
    },
    "idempotency_key": {
      "type": "string",
      "maxLength": 255,
      "description": "Tenant-scoped; duplicate submits return the original execution."
    },
    "requires_approval": {
      "type": "boolean",
      "default": false,
      "description": "Pause in PENDING_APPROVAL until /approve or /reject."
    }
  },
  "$defs": {
    "Target": {
      "type": "object",
      "required": [
        "url"
      ],
      "properties": {
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "PUT",
            "PATCH",
            "DELETE"
          ],
          "default": "POST"
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Absolute http(s) URL of the third-party API."
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Your third-party credentials. Encrypted at rest; values are REDACTED in all reads.\n"
        },
        "connection_id": {
          "type": "string",
          "description": "Reference a vault connection; its managed token is injected at execution time instead of passing credentials in headers.\n"
        },
        "timeout_ms": {
          "type": "integer",
          "default": 30000,
          "maximum": 120000,
          "description": "Per-attempt timeout."
        }
      }
    }
  }
}