> ## 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.

# Create an intent

> Declare an intent to spend before accessing card credentials.



## OpenAPI

````yaml openapi.json post /cards/{cardId}/intents
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:
  /cards/{cardId}/intents:
    post:
      tags:
        - Intents
      summary: Create an intent
      description: Declare an intent to spend before accessing card credentials.
      operationId: createIntent
      parameters:
        - $ref: '#/components/parameters/CardId'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateIntentRequest'
      responses:
        '201':
          description: Intent created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Intent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    CardId:
      name: cardId
      in: path
      required: true
      description: Card ID (e.g., card_...)
      schema:
        type: string
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: Unique key for idempotent requests (24-hour cache)
      schema:
        type: string
  schemas:
    CreateIntentRequest:
      type: object
      required:
        - purpose
      properties:
        intentId:
          type: string
          description: Client-provided intent ID for idempotency
        purpose:
          type: string
          description: Description of intended spend
        expectedAmount:
          type: number
          description: Expected amount in cents
        expectedCurrency:
          type: string
          description: Expected currency (e.g., usd)
        expectedMerchant:
          type: string
          description: Expected merchant name
        expectedMccs:
          type: array
          items:
            type: string
          description: Expected merchant category codes
        tolerance:
          type: number
          description: Allowed amount tolerance in cents
        tolerancePercent:
          type: number
          description: Allowed amount tolerance as percentage
        ttlMinutes:
          type: number
          description: Intent time-to-live in minutes (max 1440)
        metadata:
          type: object
          additionalProperties: true
    Intent:
      type: object
      properties:
        id:
          type: string
          description: Unique intent ID
        cardId:
          type: string
          description: Associated card ID
        intentId:
          type: string
          nullable: true
          description: Client-provided intent ID for idempotency
        purpose:
          type: string
          description: Description of intended spend
        expectedAmount:
          type: number
          nullable: true
          description: Expected transaction amount in cents
        expectedCurrency:
          type: string
          nullable: true
        expectedMerchant:
          type: string
          nullable: true
        expectedMccs:
          type: array
          items:
            type: string
          nullable: true
          description: Expected merchant category codes
        toleranceAmount:
          type: number
          nullable: true
          description: Allowed amount tolerance in cents
        tolerancePercent:
          type: number
          nullable: true
          description: Allowed amount tolerance as percentage
        status:
          type: string
          enum:
            - pending_approval
            - pending
            - matched
            - mismatched
            - expired
            - rejected
            - canceled
          description: Intent status
        expiresAt:
          type: number
          nullable: true
          description: Intent expiration timestamp (ms)
        createdAt:
          type: string
          format: date-time
          nullable: true
        updatedAt:
          type: string
          format: date-time
          nullable: true
        approvedAt:
          type: string
          format: date-time
          nullable: true
        rejectedAt:
          type: string
          format: date-time
          nullable: true
        rejectionReason:
          type: string
          nullable: true
        canceledAt:
          type: string
          format: date-time
          nullable: true
        matchedAt:
          type: string
          format: date-time
          nullable: true
        mismatchedAt:
          type: string
          format: date-time
          nullable: true
      required:
        - id
        - cardId
        - purpose
        - status
    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
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: not_found
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key authentication. Include your API key in the Authorization header
        as `Bearer <api_key>`.

````