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

# Evaluate spend policy

> Evaluate whether a proposed spend would be approved based on current policy rules.



## OpenAPI

````yaml openapi.json post /spend/evaluate
openapi: 3.0.3
info:
  title: Proxy API
  description: >-
    Card issuance and transaction management API for AI agents and automation.
    Proxy enables customers to issue virtual cards with policy-based spending
    controls.
  version: 1.0.0
  contact:
    name: Proxy Support
    url: https://useproxy.ai
servers:
  - url: https://api.useproxy.ai/v1
    description: Production API
security:
  - BearerAuth: []
tags:
  - name: KYC
    description: Know Your Customer application management
  - name: Customers
    description: Manage customers who own agents and cards
  - name: Agents
    description: Manage autonomous agents that can spend on behalf of customers
  - name: Cards
    description: Manage virtual spending cards with policy controls
  - name: Intents
    description: Pre-transaction declarations for spend approval workflows
  - name: Spend
    description: Spend policy evaluation
  - name: Access Events
    description: Card credential access grants with attestation windows
  - name: Transactions
    description: View and manage transaction records
  - name: Balances
    description: View customer balances and funding instructions
  - name: Webhooks
    description: Configure outbound webhook subscriptions
paths:
  /spend/evaluate:
    post:
      tags:
        - Spend
      summary: Evaluate spend policy
      description: >-
        Evaluate whether a proposed spend would be approved based on current
        policy rules.
      operationId: evaluateSpendPolicy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluateSpendRequest'
      responses:
        '200':
          description: Policy evaluation result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluateSpendResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    EvaluateSpendRequest:
      type: object
      required:
        - amount
      properties:
        customerId:
          type: string
        agentId:
          type: string
        cardId:
          type: string
        amount:
          type: number
          description: Amount in cents
        currency:
          type: string
        merchant:
          type: object
          properties:
            mcc:
              type: string
            name:
              type: string
    EvaluateSpendResponse:
      type: object
      properties:
        decision:
          type: string
          enum:
            - approve
            - decline
        reasons:
          type: array
          items:
            $ref: '#/components/schemas/PolicyReason'
        flags:
          type: object
          additionalProperties:
            type: boolean
        context:
          type: object
          properties:
            customerId:
              type: string
              nullable: true
            agentId:
              type: string
              nullable: true
            cardId:
              type: string
              nullable: true
            amount:
              type: number
            currency:
              type: string
              nullable: true
            available:
              type: number
            agentLimit:
              $ref: '#/components/schemas/SpendingLimit'
            cardLimit:
              $ref: '#/components/schemas/SpendingLimit'
            spendStats:
              type: object
              properties:
                totalDay:
                  type: number
                totalMonth:
                  type: number
                lastSpendAt:
                  type: number
                  nullable: true
            policy:
              $ref: '#/components/schemas/Policy'
      required:
        - decision
        - reasons
    PolicyReason:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable reason code
        message:
          type: string
          description: Human-readable reason message
      required:
        - code
        - message
    SpendingLimit:
      type: object
      properties:
        amount:
          type: number
          description: Limit amount in cents
        currency:
          type: string
          description: Currency code (e.g., usd)
        interval:
          type: string
          nullable: true
          description: >-
            Limit interval (e.g., daily, weekly, monthly, all_time,
            per_authorization)
      required:
        - amount
        - currency
    Policy:
      type: object
      description: Spending policy controls
      properties:
        requireIntent:
          type: boolean
          description: Require an intent before card access
        requireAttestation:
          type: boolean
          description: Require attestation for card access
        requireApproval:
          type: boolean
          description: Require manual approval for intents
        autoApproveBelow:
          type: number
          description: Auto-approve intents below this amount (in cents)
        attestationWindowMinutes:
          type: number
          description: Minutes that access credentials remain valid
        cooldownMinutes:
          type: number
          description: Minimum minutes between transactions
        ttlMinutes:
          type: number
          description: Card time-to-live in minutes
        ttlDays:
          type: number
          description: Card time-to-live in days
        limits:
          type: object
          properties:
            perAuth:
              type: number
              description: Maximum amount per authorization (in cents)
            perDay:
              type: number
              description: Maximum daily spend (in cents)
            perMonth:
              type: number
              description: Maximum monthly spend (in cents)
        allowedMccs:
          type: array
          items:
            type: string
          description: Allowed merchant category codes
        blockedMccs:
          type: array
          items:
            type: string
          description: Blocked merchant category codes
        allowedMerchants:
          type: array
          items:
            type: string
          description: Allowed merchant names
        lockToFirstMerchant:
          type: boolean
          description: Lock card to first merchant used
    Error:
      type: object
      properties:
        error:
          oneOf:
            - type: string
            - type: object
              properties:
                code:
                  type: string
                message:
                  type: string
                details:
                  type: object
                  nullable: true
              required:
                - code
                - message
      required:
        - error
  responses:
    BadRequest:
      description: Bad request - invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized - missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: unauthorized
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Include your API key in the Authorization header
        as `Bearer <api_key>`.

````