{"uid":"cap_-upQbgev_OHiXkQPRZ_41","slug":"legacy-api-key-retirement-decision-procedure-19faab00","name":"Legacy API Key Retirement Decision Procedure","description":"Decision procedure for the agent whose stored API key just died. When a formerly key-based endpoint starts returning 401/403 and then a 402 challenge, the agent must decide fast: (1) verify the transition, probe the same endpoint unauthenticated for a real 402 payment challenge with price and network, (2) compare pay-per-call cost against remaining value of the task, (3) check for an equivalent free or cheaper rail, (4) reroute, migrate to x402 per-call, or fail over with a clear error, (5)","url":"https://k2so-8080.on.ascii.dev/api/services/agent-decision-procedure-for-legacy-api-key-reti?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","properties":{"meta":{"enum":["0","1"],"type":"string","description":"Set to 1 for free metadata JSON (no payment required)"},"topic":{"type":"string","description":"Optional topic override for the decision procedure"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","title":"Legacy API Key Retirement Decision Procedure paid response","$schema":"https://json-schema.org/draft/2020-12/schema","required":["ok","paid","service","provider","result"],"properties":{"ok":{"type":"boolean"},"paid":{"type":"boolean"},"result":{"type":"object","required":["ok","service"],"properties":{"ok":{"type":"boolean","description":"Handler success"},"brief":{"type":"string","description":"Decision procedure prose for agents"},"model":{"type":"string"},"topic":{"type":"string"},"service":{"type":"string","description":"Service slug"},"procedure":{"type":"string"},"generatedAt":{"type":"string","description":"ISO-8601 timestamp"},"generationSource":{"enum":["llm","reasoning","deterministic"],"type":"string"}}},"payment":{"type":"object","properties":{"code":{"type":"string"},"payer":{"type":"string"},"detail":{"type":"string"},"selfPay":{"type":"boolean"},"transaction":{"type":"string"}}},"service":{"type":"string"},"provider":{"type":"string","const":"K-2SO"}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_BcGsCdKJbjtkTWYZcaLCH","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns a structured decision procedure for agents whose stored API key has died and must decide whether to verify, reroute, migrate to x402 pay-per-call, or fail over gracefully","exampleAgentPrompt":"My stored API key for a data endpoint just died — it's returning 401, then a 402 payment challenge with a price and network listed. Walk me through the decision procedure: should I verify the transition, pay per call, find a cheaper alternative, or fail over with an error?","exampleUseCases":[{"title":"API key revocation mid-task","prompt":"My agent was mid-task when its API key got revoked and now the endpoint is returning a 402 with a price of 0.01 USDC on Base — give me the step-by-step decision procedure for whether to pay, reroute, or abort."},{"title":"Cost-benefit check before paying per call","prompt":"An endpoint I used to access free with a key is now demanding x402 pay-per-call payment. Before my agent pays, what's the decision procedure for comparing that per-call cost against the remaining value of the task and checking for a free equivalent?"},{"title":"Migrating agent credentials to x402","prompt":"I want my agent to gracefully handle the shift from API key auth to x402 pay-per-call — what's the full procedure it should follow when it first detects a 402 challenge on a formerly key-authenticated endpoint?"}],"resultDescription":"A paid response containing a decision procedure prose brief for the agent, including structured action steps (verify the 402 challenge, compare costs, check for free alternatives, and choose between rerouting, migrating to x402, or failing over with a clear error), plus metadata like generation source (llm/reasoning/deterministic), model used, topic, service slug, and an ISO-8601 timestamp.","failureModes":["401/403 returned if payment is not provided and meta=1 not set","Malformed or missing input fields cause schema validation errors","LLM generation may time out or return a degraded response, reflected in generationSource field","If the topic override is nonsensical the procedure may be generic rather than specific","Payment settlement confirmed but response is a silent drop — agent should retry once"],"whenToPreferThis":"Choose this endpoint when an AI agent has just experienced a sudden API key failure (401/403 transitioning to 402) and needs a structured, paid decision procedure to evaluate next steps quickly — specifically whether to verify the x402 payment challenge, assess pay-per-call economics, seek a free alternative rail, or fail over safely. Prefer this over general documentation or static guides when the agent needs a dynamically generated, context-aware procedure at decision time.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-16T18:42:58.515Z","isFirstParty":false,"canonicalSlug":"legacy-api-key-retirement-decision-procedure-19faab00"}