Skip to content

Errors: machine-readable refusal reasons on 400 and 403 - #1232

Merged
kphurley7 merged 3 commits into
mainfrom
kph/grid-refusal-reason-codes
Oct 28, 2026
Merged

kphurley7 merged 3 commits into
mainfrom
kph/grid-refusal-reason-codes

Conversation

@kphurley7

@kphurley7 kphurley7 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What: 400, 403 and 409 error bodies document details.refusalReason, a machine-readable reason for the refusal, plus details.policyDenialReason (which agent policy rule denied), details.permission (the missing agent permission) and details.missingFields (the customer fields a cardholder still needs). All are open-ended strings with their known values listed, so new reasons can be added without breaking generated clients. Listed reasons cover agent actions, deposits, cardholder checks (including CARDHOLDER_HOLDS_CARD on 409), card program, purchase card and card handover refusals, purchase card policy denials, and Lightning invoice refusals (sub-satoshi amounts and invoices Lightspark issued to fund a deposit).

Why: clients could only tell refusals apart by matching the English message. Existing code and reason values are unchanged.

@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
grid-cards-demo Ignored Ignored Preview Oct 28, 2026 8:56pm UTC
grid-flow-builder Ignored Ignored Preview Oct 28, 2026 8:56pm UTC
grid-wallet-demo Ignored Ignored Preview Oct 28, 2026 8:56pm UTC

Request Review

@kphurley7
kphurley7 requested a review from k15z October 25, 2026 16:16
@mintlify

mintlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Grid 🟢 Ready View Preview Oct 28, 2026, 8:57 PM

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Documents machine-readable refusal details for 400 and 403 responses.

  • 403 errors can name what blocked an agent request.
  • 400 errors can name the customer fields a card still needs.

Reviews (1) · Last reviewed commit: "Errors: keep the refusal detail fields o..." · Reviewed by Greptile

@kphurley7
kphurley7 marked this pull request as draft October 25, 2026 17:05
@kphurley7
kphurley7 marked this pull request as ready for review October 28, 2026 20:21
kphurley7 and others added 3 commits October 28, 2026 15:51
Several refusals share one code (every agent refusal is FORBIDDEN), so
clients could only tell them apart by matching the English reason text.
Document details.refusalReason on 400 and 403 errors, with
details.permission and details.policyDenialReason on agent refusals and
details.missingFields when a cardholder record lacks fields a card needs.
Additive: code and reason are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSkWUSAw9qMByQhWaFyv9B
Grid documents that it may add refusal reasons, policy denial reasons,
permissions and customer fields, but closed enums make generated clients
reject a response carrying a value added after they were built. Type the
detail fields as strings with the known values in the description, as
PaymentDocumentRequirementId does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSkWUSAw9qMByQhWaFyv9B
Grid now names a refusal reason for the card program being off, agent
purchase cards and card hand-over being off, a purchase card its policy
denied, a cardholder whose bank account is not open yet or who already
holds their one card, a sub-satoshi Lightning invoice, and an invoice
that funds a Lightspark deposit. CONFLICT can now carry a refusal reason,
and policyDenialReason also explains purchase card denials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSkWUSAw9qMByQhWaFyv9B
@kphurley7
kphurley7 disabled auto-merge October 28, 2026 22:08
@kphurley7
kphurley7 merged commit 8aaf3d3 into main Oct 28, 2026
8 checks passed
@kphurley7
kphurley7 deleted the kph/grid-refusal-reason-codes branch October 28, 2026 22:08

This branch was successfully deployed

1 active deployment
staging - mintlify — 4acf2608 Deployed Oct 28, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants