> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getopenrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run an agent action

> Runs a typed action such as checkout creation, fee estimation, or webhook example generation.



## OpenAPI

````yaml /api-reference/openapi.json post /api/agent/actions/{action}
openapi: 3.1.0
info:
  title: Open Rails API
  version: 0.1.0
  description: >-
    Hosted checkout, provider routing, runtime schemas, and normalized webhook
    examples for Open Rails merchants and agents.
servers:
  - url: https://dash.getopenrails.com
    description: Production dashboard and API origin
security: []
tags:
  - name: Gateway
  - name: Agent
  - name: Routing
  - name: Webhooks
paths:
  /api/agent/actions/{action}:
    post:
      tags:
        - Agent
      summary: Run an agent action
      description: >-
        Runs a typed action such as checkout creation, fee estimation, or
        webhook example generation.
      operationId: runAgentAction
      parameters:
        - name: action
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/AgentAction'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/CheckoutActionInput'
                - $ref: '#/components/schemas/FeeEstimateInput'
                - $ref: '#/components/schemas/WebhookExampleInput'
                - $ref: '#/components/schemas/WebhookVerifySampleInput'
      responses:
        '200':
          description: Action succeeded
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/CheckoutActionResponse'
                  - $ref: '#/components/schemas/FeeEstimateResponse'
                  - $ref: '#/components/schemas/WebhookExampleResponse'
                  - $ref: '#/components/schemas/WebhookVerifySampleResponse'
        '400':
          description: Action failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionErrorResponse'
components:
  schemas:
    AgentAction:
      type: string
      enum:
        - checkout.preview
        - checkout.create
        - fees.estimate
        - webhook.example
        - webhook.verify_sample
    CheckoutActionInput:
      type: object
      additionalProperties: false
      required:
        - product
        - amount
        - customer
      properties:
        product:
          type: string
          minLength: 1
          maxLength: 120
        amount:
          type: number
          exclusiveMinimum: 0
          maximum: 10000
        customer:
          type: string
          format: email
        preferredRoute:
          $ref: '#/components/schemas/RouteKind'
        redirectUrl:
          type: string
          format: uri
        metadata:
          $ref: '#/components/schemas/Metadata'
        environment:
          $ref: '#/components/schemas/Environment'
        idempotencyKey:
          type: string
          minLength: 8
          maxLength: 120
        clientReferenceId:
          type: string
          minLength: 3
          maxLength: 120
    FeeEstimateInput:
      type: object
      additionalProperties: false
      required:
        - amount
      properties:
        amount:
          type: number
          exclusiveMinimum: 0
          maximum: 10000
        preferredRoute:
          $ref: '#/components/schemas/RouteKind'
        routeId:
          type: string
          minLength: 3
          maxLength: 120
        environment:
          $ref: '#/components/schemas/Environment'
    WebhookExampleInput:
      type: object
      additionalProperties: false
      properties:
        event:
          type: string
          enum:
            - payment.provider_pending
            - payment.paid
            - payment.failed
          default: payment.paid
        provider:
          type: string
          default: transak-direct
        sessionId:
          type: string
          default: chk_nimbus_1056
        customerId:
          type: string
          default: cus_7G42M9
        amount:
          type: number
          default: 899
        routeId:
          type: string
          default: card-bridge-a
        txHash:
          type:
            - string
            - 'null'
          default: '0xabc123'
        livemode:
          type: boolean
          default: false
        metadata:
          $ref: '#/components/schemas/Metadata'
    WebhookVerifySampleInput:
      type: object
      additionalProperties: false
      properties:
        provider:
          type: string
          default: transak-direct
        signature:
          type: string
        payload:
          $ref: '#/components/schemas/ProviderWebhookInput'
    CheckoutActionResponse:
      type: object
      required:
        - ok
        - action
        - result
      properties:
        ok:
          type: boolean
          enum:
            - true
        action:
          type: string
          enum:
            - checkout.preview
            - checkout.create
        result:
          $ref: '#/components/schemas/CheckoutResult'
    FeeEstimateResponse:
      type: object
      required:
        - ok
        - action
        - result
      properties:
        ok:
          type: boolean
          enum:
            - true
        action:
          type: string
          enum:
            - fees.estimate
        result:
          type: object
          properties:
            environment:
              $ref: '#/components/schemas/Environment'
            route:
              $ref: '#/components/schemas/RouteSummary'
            feeSplit:
              $ref: '#/components/schemas/FeeSplit'
    WebhookExampleResponse:
      type: object
      required:
        - ok
        - action
        - result
      properties:
        ok:
          type: boolean
          enum:
            - true
        action:
          type: string
          enum:
            - webhook.example
        result:
          type: object
          properties:
            headers:
              type: object
              additionalProperties:
                type: string
            payload:
              $ref: '#/components/schemas/MerchantWebhookEvent'
    WebhookVerifySampleResponse:
      type: object
      required:
        - ok
        - action
        - result
      properties:
        ok:
          type: boolean
          enum:
            - true
        action:
          type: string
          enum:
            - webhook.verify_sample
        result:
          type: object
          properties:
            accepted:
              type: boolean
              enum:
                - true
            provider:
              type: string
            eventId:
              type: string
            sessionId:
              type: string
            status:
              type: string
              enum:
                - provider_pending
                - paid
                - failed
            merchantWebhookQueued:
              type: boolean
    ActionErrorResponse:
      type: object
      required:
        - ok
        - action
        - error
      properties:
        ok:
          type: boolean
          enum:
            - false
        action:
          type: string
        error:
          $ref: '#/components/schemas/ActionError'
    RouteKind:
      type: string
      enum:
        - card
        - wallet
        - local
    Metadata:
      type: object
      additionalProperties:
        type: string
        maxLength: 500
      default: {}
    Environment:
      type: string
      enum:
        - sandbox
        - production
      default: sandbox
    ProviderWebhookInput:
      type: object
      required:
        - eventId
        - sessionId
        - status
        - amount
      properties:
        eventId:
          type: string
        sessionId:
          type: string
        status:
          type: string
          enum:
            - provider_pending
            - paid
            - failed
        txHash:
          type: string
        amount:
          type: number
          exclusiveMinimum: 0
    CheckoutResult:
      type: object
      required:
        - id
        - merchant
        - product
        - amount
        - customer
        - route
        - feeSplit
        - checkoutUrl
        - redirectUrl
        - status
      properties:
        id:
          type: string
        merchant:
          type: string
        product:
          type: string
        amount:
          type: number
        customer:
          type: string
          format: email
        route:
          $ref: '#/components/schemas/RouteSummary'
        feeSplit:
          $ref: '#/components/schemas/FeeSplit'
        checkoutUrl:
          type: string
          format: uri
        redirectUrl:
          type: string
          format: uri
        status:
          type: string
          enum:
            - routed
        environment:
          $ref: '#/components/schemas/Environment'
        dryRun:
          type: boolean
        idempotencyKey:
          type: string
        clientReferenceId:
          type: string
    RouteSummary:
      type: object
      required:
        - id
        - label
        - integrationId
        - integrationLabel
        - kind
        - network
        - asset
        - score
        - health
        - payerLabel
        - eta
        - buyerFeeRate
        - gatewayFeeRate
        - providerCostRate
        - kycPolicy
      properties:
        id:
          type: string
        label:
          type: string
        integrationId:
          type: string
        integrationLabel:
          type: string
        kind:
          $ref: '#/components/schemas/RouteKind'
        network:
          type: string
        asset:
          type: string
        score:
          type: number
        health:
          type: string
          enum:
            - live
            - degraded
            - standby
        payerLabel:
          type: string
        eta:
          type: string
        buyerFeeRate:
          type: number
        gatewayFeeRate:
          type: number
        providerCostRate:
          type: number
        kycPolicy:
          type: string
    FeeSplit:
      type: object
      required:
        - buyerFee
        - gatewayFee
        - merchantNet
        - total
      properties:
        buyerFee:
          type: number
        gatewayFee:
          type: number
        merchantNet:
          type: number
        total:
          type: number
    MerchantWebhookEvent:
      type: object
      required:
        - id
        - type
        - livemode
        - created
        - data
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - payment.provider_pending
            - payment.paid
            - payment.failed
        livemode:
          type: boolean
        created:
          type: string
          format: date-time
        data:
          type: object
          required:
            - session_id
            - customer_id
            - status
            - amount
            - currency
            - asset
            - network
            - route
            - fees
            - tx_hash
            - metadata
          properties:
            session_id:
              type: string
            customer_id:
              type: string
            status:
              type: string
              enum:
                - provider_pending
                - paid
                - failed
            amount:
              type: number
            currency:
              type: string
            asset:
              type: string
            network:
              type: string
            route:
              type: object
              properties:
                id:
                  type: string
                kind:
                  $ref: '#/components/schemas/RouteKind'
                label:
                  type: string
                provider:
                  type: string
            fees:
              type: object
              properties:
                buyer_fee:
                  type: number
                gateway_fee:
                  type: number
                merchant_net:
                  type: number
                total:
                  type: number
            tx_hash:
              type:
                - string
                - 'null'
            metadata:
              $ref: '#/components/schemas/Metadata'
    ActionError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
        field:
          type: string
        suggestion:
          type: string
        issues:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              code:
                type: string
              message:
                type: string

````