POST
/
accounts
/
{address}
/
spending-limit
Create spending limit
curl --request POST \
  --url https://grid.squads.xyz/api/grid/v1/accounts/{address}/spending-limit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-grid-environment: <api-key>' \
  --data '{
  "amount": "1000000000",
  "mint": "So11111111111111111111111111111111111111112",
  "period": "DAILY",
  "spending_limit_signers": [
    "11111111111111111111111111111112"
  ],
  "destinations": [
    "22222222222222222222222222222223"
  ]
}'
{
  "data": {
    "spending_limit_address": "11111111111111111111111111111112",
    "transaction": "<string>",
    "kms_payloads": [
      {
        "provider": "privy",
        "address": "11111111111111111111111111111112",
        "payload": "<string>"
      }
    ],
    "transaction_signers": [
      "11111111111111111111111111111112"
    ]
  },
  "metadata": {
    "request_id": "123e4567-e89b-12d3-a456-426614174000",
    "timestamp": "2023-07-15T14:30:00.000Z"
  }
}
Create a spending limit to enable controlled, recurring payments without requiring full account authority signatures. Spending limits provide a secure way to delegate payment authority for specific tokens and amounts.

Spending Limit Concepts

Period Types

  • ONE_TIME: Single-use allowance
  • DAILY: Resets every 24 hours
  • WEEKLY: Resets every 7 days
  • MONTHLY: Resets every 30 days

Key Components

  • Amount: Maximum spendable amount in smallest token units
  • Mint: Token contract address (e.g., USDC, SOL)
  • Period: How often the limit resets
  • Spending Limit Signers: Authorized addresses that can use the limit
  • Destinations: Optional list of allowed recipient addresses
  • Expiration: Optional expiration timestamp

Security Model

Spending limits operate with reduced security requirements compared to full account operations:
  1. Creation: Requires full account authority signatures
  2. Usage: Only requires spending limit signer authorization
  3. Updates: Requires full account authority signatures
  4. Deletion: Requires full account authority signatures

Use Cases

  • Employee Expenses: Allow employees to spend within limits
  • Subscription Payments: Automate recurring payments
  • DeFi Operations: Enable automated DeFi strategies
  • Bill Payments: Simplify recurring bill payments

Important Notes

  • Amounts are specified in the token’s smallest unit (e.g., 1 USDC = 1,000,000 units)
  • Spending limits reset automatically based on the period
  • Unused amounts don’t carry over to the next period
  • Multiple spending limits can exist for different tokens
  • Spending limit addresses are generated deterministically

Authorizations

Authorization
string
header
required

API key authentication with Bearer token. Include the API key in the Authorization header as 'Bearer YOUR_API_KEY'

x-grid-environment
string
header
required

Environment identifier for the Grid API. Use 'sandbox' for testing on devnet or 'production' for production on mainnet.

Path Parameters

address
string
required

Account address

Example:

"11111111111111111111111111111112"

Body

application/json

Response

201
application/json

Spending limit creation transaction prepared successfully

The response is of type object.