openapi: 3.1.0
info:
  title: ActionGate
  description: "x402 + Stripe billing proxy for APIs and MCP servers, with ActionGate safety tools as the built-in example."
  version: 1.0.0
servers:
  - url: "https://api.actiongate.xyz"
externalDocs:
  description: "ActionGate developer docs"
  url: "https://api.actiongate.xyz/docs"
paths:
  /billing:
    get:
      operationId: billing_home
      summary: "Billing portal"
      responses:
        200:
          description: "Billing page."
  /billing/checkout:
    post:
      operationId: billing_checkout
      summary: "Create a Stripe Checkout session"
      responses:
        200:
          description: "Checkout session created."
  /billing/checkout/success:
    get:
      operationId: billing_checkout_success
      summary: "Checkout success page"
      responses:
        200:
          description: "Checkout success page."
  /billing/webhook:
    post:
      operationId: billing_webhook
      summary: "Stripe webhook receiver"
      responses:
        200:
          description: "Webhook accepted."
  /billing/balance/{apiKey}:
    get:
      operationId: billing_balance
      summary: "Inspect an API key balance"
      parameters:
        - name: apiKey
          in: path
          required: true
          schema:
            type: string
      responses:
        200:
          description: "Balance response."
  /billing/auto-reload:
    post:
      operationId: billing_auto_reload
      summary: "Configure auto reload"
      responses:
        200:
          description: "Auto reload updated."
  /v1/risk-score:
    post:
      operationId: risk_score
      summary: "Score the risk of a proposed agent action before execution."
      description: "Score the risk of a proposed agent action before execution."
      tags:
        - proxy
      responses:
        200:
          description: "Successful upstream response."
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        402:
          description: "Payment required. Retry with an x402 payment proof or a funded API key."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                request_id:
                  type: string
                  description: "Optional caller-supplied request identifier for tracing and receipts."
                actor:
                  type: object
                  description: "Actor metadata for the agent proposing the action."
                  properties:
                    actor_id:
                      type: string
                      description: "Stable actor identifier for the agent or wallet operator."
                    wallet_address:
                      type: string
                      description: "Optional onchain wallet address associated with the acting agent."
                  required:
                    - actor_id
                  additionalProperties: false
                action:
                  type: object
                  description: "Action payload to evaluate."
                  properties:
                    action_type:
                      type: string
                      description: "The proposed action category, such as transfer, swap, or approve."
                  required:
                    - action_type
                  additionalProperties: true
                context:
                  type: object
                  description: "Optional execution context such as chain state, balances, or treasury metadata."
                  additionalProperties: true
              required:
                - actor
                - action
              additionalProperties: false
  /v1/simulate:
    post:
      operationId: simulate
      summary: "Estimate cost, failure risk, and notable side effects for a proposed action."
      description: "Estimate cost, failure risk, and notable side effects for a proposed action."
      tags:
        - proxy
      responses:
        200:
          description: "Successful upstream response."
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        402:
          description: "Payment required. Retry with an x402 payment proof or a funded API key."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                request_id:
                  type: string
                  description: "Optional caller-supplied request identifier for tracing and receipts."
                actor:
                  type: object
                  description: "Actor metadata for the agent proposing the action."
                  properties:
                    actor_id:
                      type: string
                      description: "Stable actor identifier for the agent or wallet operator."
                    wallet_address:
                      type: string
                      description: "Optional onchain wallet address associated with the acting agent."
                  required:
                    - actor_id
                  additionalProperties: false
                action:
                  type: object
                  description: "Action payload to evaluate."
                  properties:
                    action_type:
                      type: string
                      description: "The proposed action category, such as transfer, swap, or approve."
                  required:
                    - action_type
                  additionalProperties: true
                context:
                  type: object
                  description: "Optional execution context such as chain state, balances, or treasury metadata."
                  additionalProperties: true
              required:
                - actor
                - action
              additionalProperties: false
  /v1/policy-gate:
    post:
      operationId: policy_gate
      summary: "Apply policy checks and return allow, deny, or allow-with-limits decisions."
      description: "Apply policy checks and return allow, deny, or allow-with-limits decisions."
      tags:
        - proxy
      responses:
        200:
          description: "Successful upstream response."
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        402:
          description: "Payment required. Retry with an x402 payment proof or a funded API key."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                request_id:
                  type: string
                  description: "Optional caller-supplied request identifier for tracing and receipts."
                actor:
                  type: object
                  description: "Actor metadata for the agent proposing the action."
                  properties:
                    actor_id:
                      type: string
                      description: "Stable actor identifier for the agent or wallet operator."
                    wallet_address:
                      type: string
                      description: "Optional onchain wallet address associated with the acting agent."
                  required:
                    - actor_id
                  additionalProperties: false
                action:
                  type: object
                  description: "Action payload to evaluate."
                  properties:
                    action_type:
                      type: string
                      description: "The proposed action category, such as transfer, swap, or approve."
                  required:
                    - action_type
                  additionalProperties: true
                context:
                  type: object
                  description: "Optional execution context such as chain state, balances, or treasury metadata."
                  additionalProperties: true
                policy:
                  type: object
                  description: "Policy pack input, including policy_id and any policy-specific override values."
                  additionalProperties: true
              required:
                - actor
                - action
                - policy
              additionalProperties: false
