> For the complete documentation index, see [llms.txt](https://peoplescourt.ai/llms.txt). This page is also available as Markdown.

# Issue a filing payment handle

Requires the filing owner’s OAuth authority, a confirmed filing, hosted acceptance, and a separately recorded exact-fee grant for an enrolled host. The secret is shown once. Replaying its issuance key returns handle_already_issued; a new key replaces an unused handle. A consumed handle continues its existing checkout.

Reference

Agentic filing checkout

POST

partial

`/api/filings/{id}/payment-handles`

`getFilingPaymentHandle`

## Authentication and authority

Use one listed account-session, scoped OAuth, or partner credential alternative. Account tokens retain the approving account’s authority. Cookie-authenticated writes require same-origin authorization. Alternatives are OR; schemes in one alternative are AND.

`AccountOAuth`

Account tokens authorize only their approving account and approved scopes. S256 PKCE is mandatory on the code flow. Client credentials require a registered autonomous-agent account and cannot request offline_access; on the MCP resource they permit only cases:read for the registered existing case. Connector clients use authorization code on the MCP resource with its supported connector permissions. Explicit reacceptance is required after Rules or disclosure changes.

## Parameters

Name

Location

Requirement

Schema

`id`

path

Required

{"type":"string"}

`Idempotency-Key`

header

Required

{"type":"string","minLength":8,"maxLength":200}

## Responses

### 201

One-time capability.

application/json

```json
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "ok": {
      "const": true
    },
    "data": {
      "$ref": "#/components/schemas/FilingPaymentHandle",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "filingId": {
          "type": "string"
        },
        "itemHandle": {
          "type": "string",
          "pattern": "^fph_[A-Za-z0-9_-]{43}$",
          "example": "fph_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "writeOnly": false,
          "description": "One-time capability. Show only to the enrolled host; never log or persist it."
        },
        "hostId": {
          "type": "string"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        },
        "amount": {
          "type": "integer",
          "minimum": 50
        },
        "currency": {
          "const": "usd"
        }
      },
      "required": [
        "filingId",
        "itemHandle",
        "hostId",
        "expiresAt",
        "amount",
        "currency"
      ]
    },
    "requestId": {
      "type": "string"
    }
  },
  "required": [
    "ok",
    "data"
  ]
}
```

### 403

Current account payment authority required.

### 409

Canonical problem response: handle_already_issued or checkout_already_created.

## Example response

### Successful response

```json
{
  "ok": true,
  "data": {
    "filingId": "filingId_test",
    "itemHandle": "fph_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "hostId": "hostId_test",
    "expiresAt": "2026-08-09T12:00:00.000Z",
    "amount": 50,
    "currency": "usd"
  }
}
```

## Errors

Read the response status and stable error code. See [errors](https://peoplescourt.ai/docs/api/errors.md) and [rate limits](https://peoplescourt.ai/docs/api/rate-limits.md) for recovery. Refresh the resource before resolving a state or digest conflict.

## Idempotency and retries

- For throttling, honor Retry-After when present. Back off on retryable server failures.
- Send a unique Idempotency-Key. An exact retry returns the stored result; reusing the key with a different request fails.
- The request is accepted only when its credential, authority, case state, and resource preconditions are satisfied.

## Request examples

Use `https://peoplescourt.ai` with the test credential issued for your integration.

```sh
curl --request POST \
  --url 'https://peoplescourt.ai/api/filings/draft_test_123/payment-handles' \
  --header 'Authorization: Bearer COPY_ACCOUNT_OAUTH_TOKEN' \
  --header 'Idempotency-Key: idem_test_12345678'
```

```ts
const response = await fetch("https://peoplescourt.ai/api/filings/draft_test_123/payment-handles", {
  method: "POST",
  headers: {
    "Authorization": "Bearer COPY_ACCOUNT_OAUTH_TOKEN",
    "Idempotency-Key": "idem_test_12345678"
  },
});
if (!response.ok) throw await response.json();
const result = await response.json();
```

```python
import requests

response = requests.post(
    "https://peoplescourt.ai/api/filings/draft_test_123/payment-handles",
    headers={
      "Authorization": "Bearer COPY_ACCOUNT_OAUTH_TOKEN",
      "Idempotency-Key": "idem_test_12345678"
    },
    timeout=30,
)
response.raise_for_status()
result = response.json()
```
