> ## Documentation Index
> Fetch the complete documentation index at: https://open-fi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Make your first OpenFi API call in the testnet environment.

<Steps>
  <Step title="Create a testnet account">
    Sign up at [openfi.co](https://openfi.co) and generate a testnet API key from the developer dashboard.
  </Step>

  <Step title="Set your API key">
    ```bash theme={null}
    export OPENFI_API_KEY="sk_testnet_..."
    ```
  </Step>

  <Step title="Make a one-time payment">
    ```bash theme={null}
    curl https://api.openfi.co/v1/payments \
      -H "Authorization: Bearer $OPENFI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "amount": 2500,
        "currency": "USD",
        "source": { "type": "bank_account", "id": "src_123" },
        "destination": { "type": "wallet", "address": "0xabc123..." }
      }'
    ```
  </Step>

  <Step title="Set up an agentic (recurring) debit">
    Recurring, agent-initiated pulls require three calls in sequence: a mandate, a session key, and then one or more debit pulls.

    ```bash theme={null}
    # 1. Create the mandate (the standing authorization)
    curl https://api.openfi.co/v1/mandates \
      -H "Authorization: Bearer $OPENFI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "payer_account_id": "acc_123",
        "max_amount": 50,
        "currency": "USD",
        "interval": "daily",
        "purpose": "AI agent operational expenses"
      }'

    # 2. Issue a session key scoped to that mandate
    curl https://api.openfi.co/v1/session-keys \
      -H "Authorization: Bearer $OPENFI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "mandate_id": "man_123",
        "expires_in": 86400
      }'

    # 3. Execute a pull against the session key
    curl https://api.openfi.co/v1/debit-pulls \
      -H "Authorization: Bearer $OPENFI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "session_key_id": "sk_123",
        "amount": 12.50
      }'
    ```
  </Step>
</Steps>

<Note>
  Testnet mandates and session keys run against a simulated allowance state machine. No real bank pull or on-chain transaction occurs until you switch to a mainnet key.
</Note>
