Repository navigation
Errors: machine-readable refusal reasons on 400 and 403 - #1232
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Contributor
[Medium impact] The PR appears safe to merge. SummaryDocuments machine-readable refusal details for 400 and 403 responses.
Reviews (1) · Last reviewed commit: "Errors: keep the refusal detail fields o..." · Reviewed by Greptile |
kphurley7
marked this pull request as draft
October 25, 2026 17:05
kphurley7
marked this pull request as ready for review
October 28, 2026 20:21
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
force-pushed
the
kph/grid-refusal-reason-codes
branch
from
October 28, 2026 20:56
470cb99 to
4acf260
Compare
kphurley7
enabled auto-merge (squash)
October 28, 2026 22:08
k15z
approved these changes
Oct 28, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: 400, 403 and 409 error bodies document
details.refusalReason, a machine-readable reason for the refusal, plusdetails.policyDenialReason(which agent policy rule denied),details.permission(the missing agent permission) anddetails.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 (includingCARDHOLDER_HOLDS_CARDon 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
codeandreasonvalues are unchanged.