# Purchase a personal recommendation

x402 v2 exact payment through Monetization Gateway. No request body. PAYMENT-SIGNATURE is a client authorization; PAYMENT-CONTEXT is supplied and verified at the origin only. One generation attempt per offer; ambiguous outcomes require reconciliation, not another payment. No automatic retries.

Operation: purchaseAskBrendan
POST /api/ask-brendan/orders/{offerId}

Access: x402. Automatic retries: none. Redirects: manual. Request body limit: 0 bytes.
Default timeout: 30 seconds. Response limit: 16 MiB. Pagination is opt-in and bounded; an exhausted bound reports incomplete execution.

[HTML reference](/developers/api/purchaseAskBrendan) · [Authoritative schemas](/api/openapi.json)

## Wire contract

```json
{
  "operationId": "purchaseAskBrendan",
  "summary": "Purchase a personal recommendation",
  "tags": [
    "Ask Brendan"
  ],
  "description": "x402 v2 exact payment through Monetization Gateway. No request body. PAYMENT-SIGNATURE is a client authorization; PAYMENT-CONTEXT is supplied and verified at the origin only. One generation attempt per offer; ambiguous outcomes require reconciliation, not another payment. No automatic retries.",
  "x-public-access": "x402",
  "x-public-side-effect": "model",
  "x-public-body-limit": 0,
  "parameters": [
    {
      "name": "offerId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Recommendation after Gateway settlement; PAYMENT-RESPONSE carries the receipt",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "authorship": {
                "const": "AI recommendations drawn from Brendan's collection and taste"
              },
              "generatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "city": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "occasion": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "limitations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "selections": {
                "minItems": 3,
                "maxItems": 5,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "canonicalId": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "first-choice",
                        "alternative"
                      ]
                    },
                    "evidence": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "canonicalId",
                    "title",
                    "url",
                    "role",
                    "evidence",
                    "reason"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "authorship",
              "generatedAt",
              "city",
              "occasion",
              "limitations",
              "selections"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "400": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "402": {
      "description": "Gateway payment challenge. PAYMENT-REQUIRED contains Base64-encoded x402 v2 requirements. A direct origin request without context is rejected and cannot issue a Gateway challenge.",
      "headers": {
        "PAYMENT-REQUIRED": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "403": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "409": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "410": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "413": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "415": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "422": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "429": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "502": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "503": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    },
    "504": {
      "description": "Request failed; never automatically retry a purchase. Retain the order reference for reconciliation.",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ProblemDetails"
          }
        }
      }
    }
  }
}
```

## Synthetic examples

### curl

```bash
curl --fail-with-body --max-time 30 --max-filesize 16777216 --request POST 'https://irvinebroque.com/api/ask-brendan/orders/00000000-0000-4000-8000-000000000000' --header 'Accept: application/json'
```

### TypeScript

```typescript
import { PublicApi } from '@irvinebroque/public-api';
const api = new PublicApi();
const result = await api.askBrendan.purchase({
  "offerId": "00000000-0000-4000-8000-000000000000"
});
console.log(result.status, result.headers.get('content-type')); // Keep transient capabilities in memory.
```

### CLI

```bash
irvinebroque askBrendan purchase --offer-id '00000000-0000-4000-8000-000000000000'
```
