CLI docs

Trusted Agent ProtocolVerify a signed request

Trusted Agent ProtocolVisa CLI's profile

Verify a signed request

From a request with a Signature header to a decision: the lookup, each header, every refusal, a runnable verifier and its output.

Markdownllms.txt
On this page

This page takes you from a request with a Signature header to a decision, in Node 22 with no dependencies. You don't need an account, an API key or a card to check someone else's agent. When a request passes, you know the agent was admitted to Visa CLI's registry, which tells you what a check means. If you run a marketplace, Add verified agents to a marketplace builds on this page.

You look up the key that signed a request at the registry:

GEThttps://auth.visacli.sh/v1/tap/registry/keys/{jkt}

A key that production's registry doesn't list returns the documented not-listed 404, as a real lookup shows. To see a pass without a listed agent signing for you, use Try it in your browser, npm test in the shortest working verifier, or the test vectors. Test values has everything else you can run without a listed agent.

Decisions

DecisionWhat to do
PinYour public https:// origin, passed once through pinnedOrigin() at startup, and the origin you read keys from: Visa CLI's registry, https://auth.visacli.sh, or for agents registered through an enabler, the Visa Agent Directory, https://agenticdirectory.visa.com (https://sbx.agenticdirectory.visa.com in sandbox). Never take either from Host, forwarding headers or Signature-Agent
AcceptA request in the exact profile, signed by a key that's listed and active, with no Signature-Agent or one on your allowlist, "https://sbx.agenticdirectory.visa.com" or "https://agenticdirectory.visa.com". From the Visa Agent Directory, accept only the TRIDs you list: in sandbox that's Basis Theory's shared 40010092347, which is for tests only, and in production the integrators you've chosen
What a pass tells youIt depends on where the key is listed. From Visa CLI's registry, the agent's owner passed Visa CLI's card step with a Visa card. From the Visa Agent Directory, it's what the integrator under that TRID checks before it registers an agent, so ask each integrator you accept. From the sandbox TRID, nothing: anyone with a Basis Theory test tenant can register an agent
Refuse, 403Every code except the two below, as the table lists. tap_key_unknown covers an unknown, paused or revoked key alike, and tap_key_inactive a key whose expirationDate has passed
Couldn't check, 503tap_trust_unavailable and tap_trust_invalid. Answer 503 with Retry-After, don't let the request through, and don't record it against the agent
Look up freshOnce without the cache after a signature fails, before you release money, by the agent ID you bound, and wherever acting on a key revoked in the last 60 seconds would matter. Otherwise an answer may be cached for up to 60 seconds

Try it

Break a request on purpose and watch which check refuses it. It runs in your browser with no account, and a first check takes under a minute. It runs on a recorded signature with the freshness check off, against a stand-in registry, and the block labels it that way. The signature was made with a throwaway test key, not a real agent's, and the listing is marked simulated. The demo accepts that simulated listing so you can see a pass. The real verifier refuses a simulated listing as tap_simulated_not_accepted, unless you create it with acceptSimulated: true for a test. The shortest working verifier checks a signature made by Visa CLI's own signing code.

SimulationRuns in your browser on a recorded test signature from a throwaway key, with the freshness check off, against a stand-in registry. Nothing is sent anywhere.

This step was not reached.

Read the signature headers
const input = /^(\w+)=\(([^)]*)\)(.*)$/.exec(
  request.headers['signature-input'] ?? '',
)
const signed = /^\w+=:([A-Za-z0-9+/]+={0,2}):$/.exec(
  request.headers.signature ?? '',
)
if (!input || !signed) return refuse('tap_missing')

Getting ready…

Run it on your machine

This needs Node 22 and no dependencies, and the script itself makes no network calls:

The docs serve these files themselves, so you can also download try-it.mjs and verify-example.zip from this page. DOCS defaults to https://app.visacli.sh; if you're reading these docs at another address, run export DOCS=<that address> first. While the docs are private, add -H "Authorization: Bearer <your docs key>" to each curl.

There's no published checksum or signature, so read the file before you run it: the less line opens what you saved. It's the same file as the try-it.mjs printed in full on Verifier code, because the download is served from that printed code, byte for byte.

That's the same code the block above runs, and it prints the same six results. Verifier code has it, along with the verifier to copy and its tests.

Shell
DOCS="${DOCS:-https://app.visacli.sh}"
curl -fsSO "$DOCS/examples/try-it.mjs"
less try-it.mjs
node try-it.mjs

How far this has been run

A real Visa CLI signature has passed this page's verifier against the real sandbox registry. On 18 November 2026 a newly connected production agent's key resolved in the Visa Agent Directory as active, ed25519, with agentType: "known", and Visa CLI's registry answered 200 with directoryOrigin set to https://agenticdirectory.visa.com. On 17 November 2026 we also revoked a real sandbox key through Basis Theory: the Visa Agent Directory sandbox answered 404 for it straight away, and the verifier, reading the Visa Agent Directory, refused the next request as tap_key_unknown.

What we tested with a real agent

The agent was a real one, connected through Visa CLI by an owner who had passed the card step. It signed an identity request with attest_http_request, and we sent that request to the verifier on this page, which read the sandbox registry.

  • The key's status. In the Visa Agent Directory sandbox, the key was active and the agent read agentType: "known". The registry answered 200 for the same key.
  • The sandbox registry. Its key list, /.well-known/http-message-signatures-directoryAPI, held 25 keys at the time, and a key lookup answered 200 with cache-control: public, max-age=60.
  • Money. No money moved. It was an identity request, so nothing was paid or charged.
  • The key ID. The keyid was a UUID from the Visa Agent Directory, 36 characters, not a 43-character thumbprint. The agent also signed signature-agent and sent Signature-Agent: "https://sbx.agenticdirectory.visa.com", quotes included, which is the value an agent in the Visa Agent Directory sandbox sends. Visa CLI agents send it. The example verifier accepts a request without it and checks it when it's sent.
What we sent, and what came back
What we sentResult
The real signed requestAccepted
The same request againtap_replayed
The body changedtap_signature_invalid
The URL changedtap_signature_invalid
No signaturetap_missing

The verifier's code names have changed since that run, and these are today's names. Since that run we've added several refusals to the verifier. We ran the new version offline against a recording of that real signature, and it was accepted. There's no public test agent, so to test against a real one, see Before you start.

The shortest working verifier

This is a whole server that verifies signed requests and answers each one with the result, in Node or in Python. Every check described below is already wired up in it. verify-example.zip has both servers, with the verifier beside each and their tests, and npm test runs all of them without the network. It needs Node 22 and Python 3, and no packages.

The zip has no published checksum or signature, so read it before you run it: the less line opens every code file you unpacked. Each one is the same file as the one printed in full on Verifier code and Test your verifier, because the zip is built from that printed code, byte for byte.

Run it
DOCS="${DOCS:-https://app.visacli.sh}"
curl -fsSO "$DOCS/examples/verify-example.zip"
unzip verify-example.zip && cd verify-example
less *.mjs *.py
npm test
PUBLIC_ORIGIN=https://market.example node server.mjs
  1. Run npm test. Each test ends with all passed, and both vector runners end with 94 of 94 passed.
  2. Set PUBLIC_ORIGIN to the https:// origin agents sign for, then start node server.mjs or python3 server.py. It listens on port 8080, or on PORT.
  3. Send it a signed request. A pass answers 200 with the key ID and agent ID. A refusal answers 403, except a body over 1 MiB, which the server refuses with 413 before the check runs. A check that couldn't run answers 503 with Retry-After.

REGISTRY_ORIGIN sets where keys are looked up, and defaults to https://auth.visacli.sh. The verifier never follows a redirect from the registry, which counts as couldn't check, tap_trust_unavailable with 503, and it accepts a plain http:// registry origin only for the exact loopback origins localhost, 127.0.0.1 and [::1], refusing any other at startup. A redirect is refused because trust in a key must not move to another origin: Node reads with redirect: 'error', Python with redirects turned off, and a test vector pins it. The loopback origins are for development, which is how the tests reach their stand-in registry. Visa CLI's own verifier has the same http:// rule.

Download
import { createServer } from 'node:http'
import { createVerifier, memoryNonceStore, pinnedOrigin, readBody, requestHeaders } from './verify-agent.mjs'

export function startMarketplace({ registryOrigin, directoryOrigin, publicOrigin: configured, port = 0, extraTransportHeaders }) {
  const publicOrigin = pinnedOrigin(configured)
  const verifyRequest = createVerifier({ registryOrigin, directoryOrigin, reserveNonce: memoryNonceStore(), extraTransportHeaders })

  const answer = (res, status, body, headers = {}) => {
    if (res.headersSent || res.destroyed) return
    res.writeHead(status, { 'content-type': 'application/json', ...headers })
    res.end(JSON.stringify(body))
  }

  async function handle(req, res) {
    const read = await readBody(req)
    if (read.aborted) return
    if (read.tooLarge) return answer(res, 413, { ok: false, code: 'body_too_large' }, { connection: 'close' })
    const result = await verifyRequest({
      method: req.method,
      publicOrigin,
      target: req.url,
      headers: requestHeaders(req),
      rawBody: read.body,
    })
    const retry = result.judged === false ? { 'retry-after': String(result.retryAfterSeconds ?? 5) } : {}
    answer(res, result.ok ? 200 : result.status, result, retry)
  }

  const server = createServer((req, res) => {
    handle(req, res).catch(() => answer(res, 500, { ok: false, code: 'internal_error' }))
  })

  return new Promise((resolve) => {
    server.listen(port, '127.0.0.1', () => resolve(server))
  })
}

if (process.argv[1]?.endsWith('server.mjs')) {
  const server = await startMarketplace({
    registryOrigin: process.env.REGISTRY_ORIGIN ?? 'https://auth.visacli.sh',
    directoryOrigin: process.env.DIRECTORY_ORIGIN,
    publicOrigin: process.env.PUBLIC_ORIGIN,
    port: Number(process.env.PORT ?? 8080),
  })
  console.log(`listening on http://127.0.0.1:${server.address().port}`)
}
import json
import os
import re
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

from verify_agent import MAX_BODY_BYTES, create_verifier, memory_nonce_store, pinned_origin


def make_server(registry_origin, public_origin, port=0, now=lambda: int(time.time()), **options):
    origin = pinned_origin(public_origin)
    verify_request = create_verifier(registry_origin, memory_nonce_store(now), now=now, **options)

    class Handler(BaseHTTPRequestHandler):
        def answer(self, status, body, headers=None):
            data = json.dumps(body).encode()
            self.send_response(status)
            for name, value in {'content-type': 'application/json', 'content-length': str(len(data)), **(headers or {})}.items():
                self.send_header(name, value)
            self.end_headers()
            if self.command != 'HEAD':
                self.wfile.write(data)

        def read_chunked(self):
            body = b''
            while True:
                size = self.rfile.readline(1026).split(b';')[0].strip()
                if not size or size.strip(b'0123456789abcdefABCDEF'):
                    return 400, 'bad_chunk', None
                size = int(size, 16)
                if size == 0:
                    while self.rfile.readline(1026).strip():
                        pass
                    return None, None, body
                if len(body) + size > MAX_BODY_BYTES:
                    return 413, 'body_too_large', None
                chunk = self.rfile.read(size)
                if len(chunk) < size or self.rfile.read(2) != b'\r\n':
                    return None, None, None
                body += chunk

        def read_body(self):
            encoding = self.headers.get('transfer-encoding')
            if encoding is not None:
                if encoding.strip().lower() != 'chunked' or 'content-length' in self.headers:
                    return 400, 'bad_transfer_encoding', None
                return self.read_chunked()
            lengths = self.headers.get_all('content-length') or ['0']
            if len(set(lengths)) != 1 or not re.fullmatch(r'[0-9]{1,16}', lengths[0]):
                return 400, 'bad_content_length', None
            length = int(lengths[0])
            if length > MAX_BODY_BYTES:
                return 413, 'body_too_large', None
            body = self.rfile.read(length)
            return (None, None, body) if len(body) == length else (None, None, None)

        def handle_request(self):
            status, code, body = self.read_body()
            if body is None:
                self.close_connection = True
                if status:
                    self.answer(status, {'ok': False, 'code': code}, {'connection': 'close'})
                return
            headers = {name.lower(): ', '.join(self.headers.get_all(name)) for name in set(self.headers.keys())}
            result = verify_request(self.command, origin, self.path, headers, body)
            retry = {'retry-after': str(result['retryAfterSeconds'] or 5)} if result.get('judged') is False else {}
            self.answer(200 if result['ok'] else result['status'], result, retry)

        def __getattr__(self, name):
            if name.startswith('do_'):
                return self.handle_request
            raise AttributeError(name)

        def log_message(self, *args):
            pass

    return ThreadingHTTPServer(('127.0.0.1', port), Handler)


if __name__ == '__main__':
    server = make_server(os.environ.get('REGISTRY_ORIGIN', 'https://auth.visacli.sh'), os.environ['PUBLIC_ORIGIN'], int(os.environ.get('PORT', '8080')), directory_origin=os.environ.get('DIRECTORY_ORIGIN'))
    print(f'listening on http://127.0.0.1:{server.server_address[1]}')
    server.serve_forever()

The full verifier files are on Verifier code: verify-agent.mjs, and verify_agent.py with its test.

One signed request, step by step

A Visa CLI agent signs one request with Visa CLI's profile of TAP, named tap-http-request-v1. The name doesn't appear in the headers, so you recognize it by the tag and the signed components. These headers are in the exact form Visa CLI's signer produces, signed with a throwaway test key:

In words: the signature covers the method, scheme, host, path, query and body digest, and the headers the agent chose to sign, so changing any of them makes the check fail. keyid says which key to look up, and the nonce lets you refuse a replay.

What each piece is, and what it proves
PieceValue hereWhat it proves
signaturesig2=:EN91…:The holder of the private key signed everything below
keyid11111111-…Which key to look up. Its listing tells you which agent it belongs to
tagagent-browser-authThis is an identity request and not a payment
alged25519Which algorithm to verify with. Earlier Visa CLI releases sent Ed25519, so accept both
created, expires60 seconds apartThe signature is fresh
nonce32 random bytesWith your store, that you haven't accepted it before
@method, @scheme, @authority, @path, @queryPOST, https, market.example, /tasks/42/claim, ?ref=aIt was signed for this action at this address, and can't be pointed elsewhere. @authority is the host the client dialled, your public origin, even behind a CDN
content-digestsha-256=:lVH0…:The body is the one the agent signed
accept, content-type*/*, application/jsonThese headers weren't changed
signature-agentThe Visa Agent Directory sandboxWhether the agent says it's in the Visa Agent Directory or its sandbox. It's only a claim, so compare it to an allowlist and never fetch from it
x-idempotency-keyabcThe agent's own header, also signed. Any header it signs gets this protection

Host is deliberately missing from that table, because you rebuild @authority from your own origin rather than trusting it. That's why the verifier takes your pinned origin and the request target as two separate inputs, publicOrigin and target in Node, and builds the URL itself: it refuses a target that doesn't start with a single / first, so nothing in the request line can change the host or port it checks against. Pass the target exactly as it arrived, such as req.url in Node's http module or self.path in Python's http.server.

For a JSON POST that a Visa CLI agent signs with a UUID keyid, the signed headers after content-digest are accept, content-type and signature-agent, sorted by name together with any other header the agent asked to sign, such as x-idempotency-key here.

The signature base is what actually got signed: one "name": value line per signed component, in the signed order, then the @signature-params line. That last line is "@signature-params": followed by the Signature-Input member value exactly as it arrived, everything after sig2=, copied as received rather than parsed and serialised again.

What arrives
POST /tasks/42/claim?ref=a HTTP/1.1
Host: market.example
accept: */*
content-type: application/json
signature-agent: "https://sbx.agenticdirectory.visa.com"
x-idempotency-key: abc
content-digest: sha-256=:lVH0Kpm71IxwuPvOjdCShjrzCouWTVbs3GY4TjGfhnk=:
signature-input: sig2=("@method" "@scheme" "@authority" "@path" "@query" "content-digest" "accept" "content-type" "signature-agent" "x-idempotency-key");created=1794000000;expires=1794000060;keyid="11111111-2222-4333-8444-555555555555";alg="ed25519";nonce="BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc=";tag="agent-browser-auth"
signature: sig2=:EN91F8w5ZqTf9qkqzbm8c5MJp4Bj/OK99LlwyZN1Mx31F52vRlTxU9yhNazy6gsrK5FCI2LcCB6lU2bSP694AA==:

{"task":42}
The signature base for that request
"@method": POST
"@scheme": https
"@authority": market.example
"@path": /tasks/42/claim
"@query": ?ref=a
"content-digest": sha-256=:lVH0Kpm71IxwuPvOjdCShjrzCouWTVbs3GY4TjGfhnk=:
"accept": */*
"content-type": application/json
"signature-agent": "https://sbx.agenticdirectory.visa.com"
"x-idempotency-key": abc
"@signature-params": ("@method" "@scheme" "@authority" "@path" "@query" "content-digest" "accept" "content-type" "signature-agent" "x-idempotency-key");created=1794000000;expires=1794000060;keyid="11111111-2222-4333-8444-555555555555";alg="ed25519";nonce="BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwc=";tag="agent-browser-auth"

The exact profile

In words: the label is sig2, the tag is agent-browser-auth, alg is Ed25519 or ed25519, a signature lives at most 60 seconds, the nonce is 32 random bytes, and the covered components always start with @method, @scheme, @authority, @path, @query and content-digest, in that order.

The full profile, field by field
FieldRule
Labelsig2. attest_http_request signs with sig2, and that's the only label this check accepts. Visa CLI's built-in task tools sign the same tag and components with the label sig1, and this check refuses those as tap_malformed. They only reach a marketplace that's in those tools, as Sign requests as an agent explains
Tagagent-browser-auth for identity requests. attest_http_request answers with "profile": "tap-http-request-v1", which names the profile. The signature itself carries tag="agent-browser-auth", so check the tag, not the profile name. With its default settings, the example verifier refuses any other tag, including the paid tag agent-payer-auth, as tap_malformed with the reason signature_input_format. It has no separate code for a tag, such as tag_not_accepted
AlgorithmEd25519. The alg value is exactly Ed25519 or ed25519. Other spellings, such as ED25519, are refused. The listed key has to be an Ed25519 key too, or the check can't use it. Reading the Visa Agent Directory, the example verifier also accepts a P-256 key with alg="ecdsa-p256-sha256", as Read the Visa Agent Directory instead explains. A signature whose alg doesn't match the key is refused as tap_signature_invalid, with the reason algorithm_mismatch
keyidA lowercase UUID when the key has metadata from the Visa Agent Directory, otherwise a thumbprint. The registry resolves both
LifetimeAt most 60 seconds, with up to 30 seconds of clock skew on created
Nonce32 random bytes in canonical base64
Covered, in order@method, @scheme, @authority, @path, @query, content-digest, then every application header the agent asked to sign, sorted by name. Headers the agent didn't sign are refused, except the transport headers, which include accept and user-agent because HTTP clients add them on their own. Don't rely on an unsigned accept Two of those headers can come from the signer rather than your app: signature-agent, which the signer adds when it names the Visa Agent Directory, and accept, which sign.mjs and sign.py sign as */* unless you pass one. Every other header after content-digest is one your app chose to sign. When you list your app's own signed headers for a signer, leave those two and the derived components out, or they're signed twice
Never signedOrigin, Host, Via, Forwarded, Referer, Connection, Content-Length, Transfer-Encoding, Cookie, Authorization, the payment headers, and any name starting x-forwarded-, sec- or proxy-. A signature that covers one is refused, as Visa CLI's own verifier does
LimitsAt most 38 covered components. Each signed header value is printable ASCII, at most 4096 characters, with no space at either end, and the signed headers come to at most 16384 characters
@queryThe raw query with its ?, or a lone ? when there's none
content-digestSHA-256 of the raw body, as sha-256=:<base64>:. Always present, including for an empty body
MethodsGET, HEAD and POST over HTTPS. The check refuses a pinned origin that isn't https://, as origin_not_https

A Visa CLI agent with a UUID keyid also signs signature-agent. The example verifier accepts a request without that header, and checks it when it's sent. A generic TAP library may not accept this profile, as the next section explains.

How this differs from Visa's published TAP

These pages describe the profile Visa CLI's agents sign with. A tool built only for Visa's published TAP won't necessarily accept it. For example, Visa CLI signs @scheme, which Visa's published minimum doesn't include, so a verifier that only allows the published components will refuse it.

It works the other way too. The example verifier checks Visa CLI's profile only, so it refuses a signature made to Visa's published minimum, such as one from mppx's TAP signer: label tap, only @authority and @path, and up to 480 seconds. To accept those agents, use a verifier for the published minimum, such as mppx's TAP verifier, with a key resolver that reads the Visa Agent Directory and applies the example's listing checks: key status, expiry and the keyid match. Know what mppx's verifier refuses before you choose it:

  • It reads alg only as ed25519 or rsa-pss-sha512, so it refuses Ed25519 and P-256 keys, which Basis Theory recommends. If you accept agents registered through Basis Theory, use the example verifier with the Visa Agent Directory instead.
  • It can't rebuild @method, @query or @scheme, so it refuses Visa CLI's agents and any agent that signs more than the minimum.
  • It reports an outage of the Visa Agent Directory, or a failed nonce store, as a 403 refusal. Treat that as couldn't check, not as a bad agent.
  • It doesn't check the tag per route. A payment signature passes an identity route, and the reverse, so your handler has to check the returned intent on every route.

An mppx agent-payer-auth signature covers only @authority and @path, not Authorization, so it says nothing about who paid. Visa CLI's paid signatures do cover it.

Visa's published TAPVisa CLI
Tagsagent-browser-auth, agent-payer-authagent-browser-auth on identity requests, such as a claim or a pitch. agent-payer-auth only on paid requests, which an identity check refuses
Minimum signed components@authority, @path@method @scheme @authority @path @query content-digest, then every application header, for identity requests
Signature lifetimeUp to 480 seconds60 seconds for identity requests. Paid requests are in the table below
AlgorithmMatches the keyEd25519
Where you look up keysThe Visa Agent DirectoryThe Visa Agent Directory, or Visa CLI's registry. See Where to look up a key

Visa CLI signs three kinds of request, and a paid request has two forms. The maximum is the longest a verifier should accept.

Identity request (sig2)

Maximum lifetime: 60 seconds

Covered components: As in the table above

Tag: agent-browser-auth

Built-in verified task (sig1)

Maximum lifetime: 60 seconds

Covered components: The same as an identity request

Tag: agent-browser-auth

Paid request, UUID keyid

Maximum lifetime: 300 seconds

Covered components: The paid components below, plus signature-agent, @query when the URL has a query, and accept and content-type when the request carries them

Tag: agent-payer-auth

Paid request, thumbprint keyid

Maximum lifetime: 480 seconds

Covered components: @method @authority @path authorization, plus content-digest when there's a body

Tag: agent-payer-auth

On a paid request authorization is the Authorization: Payment credential, and only that scheme counts. A Bearer or Basic value never binds to an identity. Checking the signature doesn't check the payment: verify the credential and its settlement through your payment integration before you deliver anything, as Pay with MPP describes.

Run the checks in this order

The order decides which code comes back when a request has more than one fault, and the test vectors pin it.

  1. Parse Signature-Input and Signature, and keep the raw parameters.
  2. Refuse a pinned origin that isn't https:// or isn't in normal form. Then refuse a request target that doesn't start with a single /, before building any URL from it, and one that isn't in normal form: dot segments, encoded dots or slashes, backslashes or a fragment. What counts as normal form is explained below the list.
  3. Enforce the components a key ID from the Visa Agent Directory needs, the lifetime, the required components, the method, and refuse Authorization, Cookie, X-Payment or Payment-Signature, even unsigned. If your API uses a login, take it off first.
  4. Refuse a covered header that's out of order, missing, over the limits or never signed in this profile. Then refuse any header the signature doesn't cover, unless it's a transport header.
  5. Refuse a body over 1 MiB and a content-digest that isn't sha-256=:<base64>:, as tap_malformed. Then recompute content-digest from the raw body bytes, before anything parses them.
  6. Compare any Signature-Agent to your allowlist.
  7. Fetch the key. A listing whose key isn't one the source allows (Ed25519 from Visa CLI's registry; Ed25519 or P-256 from the Visa Agent Directory), or whose expirationDate isn't an RFC 3339 date-time with a zone, such as 2027-01-01T00:00:00Z, is couldn't check, tap_trust_invalid with 503, not a refusal. Use the listed key only if the thumbprint you compute from its publicKey equals the keyid, or, when the keyid is a 36-character UUID, the key's id equals the keyid and its jkt equals the thumbprint you computed. Never take a thumbprint keyid on the listing's word: a listing that pairs it with a different key is refused as tap_key_inactive, as Visa CLI's own verifier does. A key whose expirationDate has passed is refused, as tap_key_inactive. Visa CLI's registry sends the date the key's listing in the Visa Agent Directory ends. Then rebuild the signature base from your own public origin, not from Host or forwarding headers, and verify the signature. If it fails, fetch the key once more without the cache and verify again before refusing, even if the cached key is only seconds old, in case the key has just changed. The example does exactly this. If that fresh fetch can't be made, the answer is couldn't check, not a refusal, and the cached key stays in the cache.
  8. Reserve keyid plus nonce until expires. Do this last, so a forged request can't use up a nonce. Once a signature verifies, its nonce is used up, even if your own later step, such as taking payment, then refuses or fails, so a retry needs a freshly signed request with a new nonce.
What counts as normal form, and why

Pasted after your origin, a target such as .attacker.example/tasks/42/claim, :8443/tasks/42/claim or @attacker.example/tasks/42/claim would move @authority to a host or port the agent signed for elsewhere, so a signature meant for another site would pass. The signature covers the path exactly, and many servers would route /tasks/43/../42/claim to task 42, so it's refused rather than normalized. Check each path segment yourself and refuse any that is . or ..: some URL parsers, Node 22's among them, leave /tasks/43/.x/../../42/claim as it is, though other parsers route it to task 42. A target is in normal form when a standard URL parser would leave it exactly as sent. So [, ] and | in the path, the same plus ^, {, } and a backtick in the query, and a % that isn't followed by two hex digits all pass as they are. A space, a non-ASCII character, ", < or > anywhere, ^, {, } or a backtick in the path, or ' in the query is refused, because a parser would encode it.

The check never throws. A request it can't read is refused as tap_malformed, and a nonce store that fails is "couldn't check".

Which key in a listing to verify with

A listing, from /v1/tap/registry/keys/{jkt}API or /v1/tap/registry/agents/{tapAgentId}API, is an agent document with a keys array. Verify with one entry only, and trust it only when all of this holds:

  1. Pick the entry by the keyid. For a 43-character thumbprint keyid, take the entry whose jkt equals it. For a 36-character UUID keyid, take the entry whose id equals it.
  2. The thumbprint rule. Compute the RFC 7638 thumbprint of the entry's publicKey yourself. Use the entry only if that thumbprint equals the keyid, or, for a UUID keyid, if the entry's id equals the keyid and its jkt equals the thumbprint you computed. Never take a thumbprint keyid on the listing's word.
  3. status is active and algorithm is ed25519 on every entry, and each entry's agentId is the document's id. Anything else means the answer is unusable: couldn't check, tap_trust_invalid.
  4. The agent is live: isActive is true, or the refusal is tap_key_inactive.
  5. Not expired: expirationDate is null or an RFC 3339 date-time still ahead. Passed is tap_key_inactive; unreadable is couldn't check.

If no entry matches, the key isn't one of the agent's live keys, tap_key_inactive. The example's readListing and judgeKey do exactly this.

Transport headers

These may arrive unsigned, and every other header has to be signed or the request is refused. Is a request refused for a header that isn't in Signature-Input? No, if it's one of these transport headers, such as x-request-id or cf-ray: the check ignores it. Yes for any other header: the example refuses it as tap_malformed with the reason uncovered_header, as Visa CLI's own verifier does, which is stricter than plain RFC 9421, where an uncovered header is simply not checked. In words: standard client, proxy and tracing headers, such as host, user-agent, x-forwarded-for and traceparent, may arrive unsigned, and so may every request header that Cloudflare, Vercel, Fly.io and Google Cloud document. Any other header, including an identity header that a proxy adds, has to be signed.

Every transport header, by host
Added byHeaders
HTTP clients and servershost, content-length, connection, transfer-encoding, keep-alive, accept, accept-language, accept-encoding, user-agent, and anything starting sec-fetch-
Proxies, as standard forwardingforwarded, via, x-forwarded-for, x-forwarded-proto, x-forwarded-host, x-forwarded-port, x-forwarded-ssl, x-real-ip, true-client-ip, cdn-loop
Tracing: W3C, Zipkin, AWS and request IDstraceparent, tracestate, x-request-id, x-amzn-trace-id, x-cloud-trace-context, b3, x-b3-traceid, x-b3-spanid, x-b3-parentspanid, x-b3-sampled
Cloudflare, from its request headers and visitor location headerscf-ray, cf-connecting-ip, cf-connecting-ipv6, cf-pseudo-ipv4, cf-connecting-o2o, cf-ew-via, cf-worker, cf-visitor, cf-ipcountry, cf-ipcity, cf-ipcontinent, cf-iplatitude, cf-iplongitude, cf-region, cf-region-code, cf-metro-code, cf-postal-code, cf-timezone
Vercel, from its request headersx-vercel-id, x-vercel-forwarded-for, x-vercel-deployment-url, x-vercel-ip-continent, x-vercel-ip-country, x-vercel-ip-country-region, x-vercel-ip-city, x-vercel-ip-latitude, x-vercel-ip-longitude, x-vercel-ip-timezone, x-vercel-ip-postal-code
Fly.io, from its request headersfly-client-ip, fly-forwarded-port, fly-region, fly-request-id
Google Cloud's load balancer, from its target proxiesvia, x-forwarded-for, x-forwarded-proto, x-cloud-trace-context, all in the rows above

Each host's row holds every request header its page lists, checked on 7 November 2026, and the test vectors have one accepted case per host that sends all of them unsigned. A few host headers are left out on purpose, because an app might act on them: Cloudflare's optional bot score, client certificate and leaked-credential headers, and Vercel's x-vercel-signature, which Vercel sends only with its own webhooks.

When your host adds a header that isn't listed

Hosts add headers over time, and other hosts add their own. If yours adds one that isn't listed, the refusal is tap_malformed with the reason uncovered_header, and header names the one that caused it. You can then take it off before the check, the way the marketplace example takes off Authorization and Cookie, or name it once when you create the verifier:

Allow one more host header
const verifyRequest = createVerifier({
  registryOrigin: 'https://auth.visacli.sh',
  reserveNonce: memoryNonceStore(),
  extraTransportHeaders: ['x-my-host-request-id'],
})

Only name a header there that your own edge sets on every request and that you never act on.

Don't trust an unsigned identity header. Headers such as x-forwarded-user or x-forwarded-email aren't on the list, so the check refuses a request that carries them unsigned. If your proxy adds them, take them off before the check, and never act on one that the agent didn't sign.

Refuse a request

Every outcome of the check is one of three kinds: verified, refused or couldn't check. judged keeps the last two apart, and that's what stops a registry outage from reading as a bad agent. These are the codes the check returns, so they're safe to branch on.

In words: tap_trust_unavailable and tap_trust_invalid are the only codes that mean couldn't check, and they answer 503 with judged: false. Every other code is a refusal that answers 403 with judged: true, and tap_key_unknown covers an unknown, paused or revoked key alike.

The answers people look for most:

  • tap_key_unknown is 403, judged: true. The registry answered 404.
  • tap_key_inactive is 403, judged: true. The registry answered 200, but the agent isn't live or this keyid isn't one of its live keys, such as a key whose expirationDate has passed.
  • A paused Visa CLI agent gets tap_key_unknown, 403, because Visa CLI's registry answers 404 for a paused agent. You'd see tap_key_inactive only from a source that answers 200 with isActive: false.
  • A registry 200 whose body the verifier can't parse or use gets tap_trust_invalid, 503, judged: false, with reason: "listing_unusable". It's couldn't check, never a refusal.
  • A registry, or the Visa Agent Directory, that can't be reached, times out, redirects, or answers anything other than 200 or 404, such as 401, 429 or 5xx, gets tap_trust_unavailable, 503, judged: false.

Every refusal code and its HTTP status

tap_missing

Status: 403

judged: true

What it means: No signature headers

What to do: The sender needs to sign the request

tap_malformed

Status: 403

judged: true

What it means: Not this profile: wrong label or tag, a nonce that isn't 32 bytes, a required component left out, Authorization, Cookie, X-Payment or Payment-Signature still on the request, a header the signature doesn't cover, a covered header that's out of order or never signed in this profile, a content-digest that isn't sha-256=:<base64>:, a request target that doesn't start with a single / or isn't in normal form, or a pinned origin that isn't https:// or isn't in normal form. reason says which, and header names an uncovered header

What to do: Remove your own login headers before the check. Otherwise refuse, because something added a header or the sender isn't using this profile

tap_expired

Status: 403

judged: true

What it means: Past expires, created more than 30 seconds in the future, or a lifetime over 60 seconds

What to do: A new signature fixes it. If every request fails, check your clock

tap_signature_invalid

Status: 403

judged: true

What it means: The body or the rebuilt signature doesn't match, or the signature's alg isn't the listed key's algorithm. reason is body_digest_mismatch, signature_mismatch or algorithm_mismatch

What to do: Check you're digesting raw bytes and that your pinned origin is what the agent signed for. Otherwise refuse

tap_replayed

Status: 403

judged: true

What it means: You've already accepted this keyid and nonce, even if your own step after the check then failed

What to do: The agent asks Visa CLI to sign the request again, which gives it a new nonce, and sends that. Never accept the same nonce twice

tap_key_unknown

Status: 403

judged: true

What it means: Registry 404: unknown, paused, revoked or still publishing

What to do: Refuse. These look the same on purpose

tap_key_inactive

Status: 403

judged: true

What it means: A listing that says the agent isn't live, or has no live key for this keyid, such as a key whose expirationDate has passed. Visa CLI's registry answers 404 for a paused agent instead, so from it you'll see tap_key_unknown. The check handles isActive: false for other sources

What to do: Refuse

tap_signature_agent_not_accepted

Status: 403

judged: true

What it means: The value isn't on your allowlist

What to do: Allow only the values you accept

tap_simulated_not_accepted

Status: 403

judged: true

What it means: The listing is marked simulated, so it's a test

What to do: Refuse outside a test

tap_trust_unavailable

Status: 503

judged: false

What it means: Couldn't check. The registry, or the Visa Agent Directory, couldn't be reached, timed out, answered with a redirect, which the check never follows, or answered anything other than 200 or 404, such as 401, 429 or 5xx

What to do: Answer 503 with Retry-After. Don't record a failure, and don't let the request through. A verified label you show should read as "check unavailable, retrying", never "unverified"

tap_trust_invalid

Status: 503

judged: false

What it means: Couldn't check. The registry answered something that can't be right: a 200 body that isn't JSON or isn't a listing, a key whose status is missing or isn't active, since the registry only lists active keys and always says so, a key whose algorithm is missing or that isn't Ed25519, or an expirationDate that isn't an RFC 3339 date-time with a zone

What to do: The same as above

When the registry answers 200 with a body that isn't a usable listing, the example answers tap_trust_invalid with 503 and Retry-After, while Visa CLI's own verifier answers 500 and treats it as not worth retrying. The example uses 503 because the fault is upstream rather than in the request, so the agent can try again later and nobody reads it as a bad agent.

Every result of the check that isn't a pass carries reason, which is finer than the code and meant for your logs, and message, which says what to fix. Branch on code.

Errors the example servers answer before the check

The example servers also answer a few HTTP errors before the check runs. These aren't results of the check, so they carry only ok: false and code, with no judged, reason or message: 413 with body_too_large for a body over 1 MiB, from both servers, 500 with internal_error when the server fails unexpectedly, where server.py closes the connection instead, and, from server.py only, 400 with bad_content_length (a missing number, a sign, or two different values), bad_transfer_encoding or bad_chunk for a body it can't read. Node's own HTTP parser answers those cases with a plain 400 before server.mjs sees them. A client can treat any of them as "the request didn't reach the check".

When a request passes you get ok: true, with keyId, jkt, agentId, agentName, simulated, covered and expires. Keep the key ID, agent ID and the time you checked.

A 404 from the registry looks the same for unknown, revoked, paused and expired keys, and Visa sends no notice when a key is revoked. The body also carries guidance fields worded for Visa CLI's own agent, such as message and fix, which a verifier doesn't read, so branch on the status and code. Real responses are on Where to look up a key.

What differs from Visa CLI's own verifier

There's no installable package, so you copy the example file.

  • The example fetches a key again after a failed signature, so a replaced key doesn't fail for up to 60 seconds. Visa CLI's own verifier doesn't. Step 7 of the checks is our advice for your verifier.
  • Visa CLI's own verifier takes a Fetch API Request, which has already parsed the target and uppercased the method. So it checks the signature against the parsed path where the example refuses a target that isn't in normal form, it accepts a ^ in the path where the URL parser leaves it, as Node 22's does. Node 22's parser also leaves .. in place after a segment that starts with a dot, as in /tasks/43/.x/../../42/claim, so on Node 22 Visa CLI's own verifier accepts that path when it was signed as sent, where the example refuses it. And it reads post as POST where the example refuses it.
  • The example requires isActive on the listing. Visa CLI's own verifier also accepts the agent's status in its place. Visa CLI's registry always sends isActive.
  • When the registry answers 200 with an unusable body, Visa CLI's own verifier answers 500. The example answers 503 with Retry-After, as couldn't check, for the reason under Refuse a request.
  • Visa CLI's own verifier returns only a code: no reason, and no wait taken from the registry's Retry-After.
  • Visa CLI's own verifier reads only Visa CLI's registry, never the Visa Agent Directory, and has no settings for which Signature-Agent values, simulated listings or extra transport headers it accepts. It always uses the example's defaults.

If you find documentation for a verifier that expects a payment credential, that's the paid path. It refuses every unpaid identity request as though the signature were missing. The relying-party handler in Visa CLI's verifier SDK, and the sample server built on it, are the legacy x402 path, from before Visa CLI retired x402, so don't use them for a new paid endpoint.

Why the example accepts both Signature-Agent values

The example accepts the sandbox value and the production value of Signature-Agent, so one verifier keeps working when listings move. The header is only the agent's claim about whether it's in the Visa Agent Directory or its sandbox. You compare it to your allowlist and never fetch from it. What decides a pass is the registry you read and pin in config, so accepting both values doesn't widen who passes. If you want only one, pass allowedSignatureAgents.

Mistakes that cost the most time

A wrong public origin

Behind a proxy, a rebuilt @authority that differs from what the agent signed fails every request with the same tap_signature_invalid. Behind a load balancer, proxy or CDN, @authority is the host the client dialled, which is your public origin, not the internal hostname your app sees in Host. So verify against the public origin you pinned. The example never reads X-Forwarded-Host or Forwarded for this, even though they often carry the public host. Anyone who reaches your app can set those headers, so a request signed for another site could be sent to yours with that site's name in X-Forwarded-Host, and a check that trusted it would pass. A pinned origin makes the check ask whether the agent signed for your address. Pin the origin in config, and pass it through pinnedOrigin() once at startup: it lowercases the host, drops :443 and a trailing slash, and stops the server with a clear message if the origin isn't https://, or if its host isn't plain DNS labels or an IP address, such as one with a trailing dot or an underscore. A pinned origin with capitals or :443 that reaches the check directly is refused as origin_not_normal, so it doesn't send you looking at paths that are fine. Agents can only sign https:// URLs, so in local development pin the HTTPS origin you asked the agent to sign for, even if your server listens on plain HTTP.

A proxy that drops headers

Your proxy or gateway has to forward every signed header, along with signature, signature-input and content-digest, and pass Retry-After back. A gateway that forwards only content-type and authorization removes the signature entirely.

A proxy in front of the check

A gateway that passes requests through to the app doing the check is fine, as long as it forwards everything above and the app pins the public origin. What fails is checking a signature and then sending it on to another service to check again: a signature is for one request to one address, and the nonce is used up after the first check.

Parsed bodies

Digest the raw bytes. Re-serialised JSON won't match. Reading the raw body shows it for Next.js and Express.

Your API already uses Authorization

Agents can't sign it. Authenticate first, remove it before the check, and have the agent sign a header naming the account, then compare the two. Here's the whole pattern.

A per-process nonce store

The example's in-memory store only works for one process, and a restart empties it, so a request captured in the last 60 seconds is accepted again after a restart. Production needs an atomic shared store, such as a Redis SET NX with an expiry or a unique SQL row.

Assuming an outage always shows up

A key cached in the last 60 seconds keeps verifying while the registry is down, so a request can still pass in an outage. A key you don't have cached gets 503, as does a signature that fails against a cached key, because it forces a fetch. To refuse during an outage instead, pass cacheSeconds: 0: every check then reads the registry, so an outage gives 503 for every key, and each check uses up a lookup. In a test, an outage right after a good request still passes on the cached key, which looks like a bug and isn't. Use cacheSeconds: 0 to see the 503. A failed refresh keeps a still-valid cached key, so a forged signature during an outage can't knock out real requests.

Trusting a test key or a stand-in

The test values' key is public, so anyone can sign with it. A stand-in key lookup you run for tests isn't Visa's. Keep both behind a test-only switch that production refuses, never let a stand-in answer for the Visa Agent Directory hosts, and never accept a header that names a key without a signature. Testing in your own code shows the pattern.

Trusting the cache for something consequential

Revocation can take up to 60 seconds to reach you through a cached answer. Make a fresh lookup before a payout. Which ID to use.

Letting bad signatures reach the registry

Each failed signature forces a fresh lookup, so a stream of bad signatures turns into load on the registry. Rate-limit callers before the check.

A paid request

A paid request carries a different tag and component set, described in Sign requests as an agent. The example refuses it as tap_malformed. When a paid request carries more than one payment credential, such as X-Payment and Authorization: Payment, its signature must cover every one of them, so a signature over one can't carry another along unsigned. Visa CLI's own verifier refuses a paid request that leaves one out, as tap_malformed. Verify the payment yourself, since the signature doesn't prove settlement.

If you're a wallet or protocol

The check is the same for any service that receives HTTPS requests from an agent, not only a marketplace. To verify an agent on demand, give it a nonce of your own and have it sign a POST to your endpoint with that nonce in the body. That shows it controls a listed key for that one exchange.

Two things aren't possible today. You can't start from a wallet address and ask whether it's a verified agent, since lookups are by key or agent only. Signing also covers HTTPS GET, HEAD and POST, so there's no on-chain or other non-HTTP proof.

Copy the verifier

The whole verifier and its tests are on Verifier code: three files for Node 22 with no dependencies, the output to compare with yours, and a recorded signature for testing a rebuild in another language.

Updated 18 Nov 2026