---
title: "Prepare a spending grant (step one of two)"
method: POST
path: "/v1/agents/{agent_id}/pay/grants/prepare"
tags: ["Pay"]
---

# Prepare a spending grant (step one of two)

`POST /v1/agents/{agent_id}/pay/grants/prepare`

## Request

- Base URL: `https://api.1claw.co`
- URL: `https://api.1claw.co/v1/agents/{agent_id}/pay/grants/prepare`
- Auth: HTTP bearer

Fixes the grant terms and a server-side nonce and returns the `grant_digest` the person must assert over with a passkey (`action=x402_grant`). Then call `POST .../pay/grants` with the same terms, the digest, and the passkey token. Preparations are single-use, bound to the caller and agent, and expire after ten minutes. The nonce never leaves the server, so the digest cannot be recomputed for different terms. Human callers only; terms are validated against the agent's maximum cap and window here as well. Owners and admins only.

## Path parameters

- `agent_id` string, uuid, required

## Request body

- object
  - `cap_usd` string, required
  - `ttl_secs` integer, required
  - `allowed_paytos` string[], nullable

## Response `200`

The digest to assert over

- object
  - `grant_digest` string, required
  - `action` 'x402_grant', required
  - `expires_in_secs` integer, required

## Other responses

- `400`: Invalid terms
- `403`: Not a human owner or admin, grant mode disabled, or over the agent's maximum

---

[API](https://skmtc.dev/1claw/apis/1claw-api.md) · [All operations](https://skmtc.dev/1claw/apis/1claw-api/llms.txt) · [OpenAPI document](https://skmtc.dev/1claw/apis/1claw-api/revisions/5fa0918f3b41?raw)
