View as Markdown

Authorize · Guide

Find a business

Use this when your agent is about to buy from a business, or an agent says it sells for one. You look up the business's signed profile, read its rules and selling agents, and check that the agent and its key are the ones the profile lists before you accept an offer.

Before you begin: none of these calls needs a key. Fetch and cache the issuer's keys from /.well-known/jwks.json (Verify tokens offline).

1. Look up the business

Pass the domain you found the business at. A business that hasn't verified a domain or published a profile answers 404 profile_not_published, the same answer as an unknown domain.

curl -s "$PROVENANCE_API/v1/public/businesses/lookup?origin=saltmarsh.example"
{
  "object": "provenance_profile",
  "business": { "id": "biz_01JDSAMPLE0SALTMARSH0DATA00", "name": "Saltmarsh Data", "origins": ["https://agents.saltmarsh.example", "https://saltmarsh.example"] },
  "accepts": { "approvals": true, "network_mandates": true, "rails": ["acp", "ap2", "checkout", "x402"] },
  "rules": { "person_required_over": 1000, "currency": "USD" },
  "selling": [{ "agent_id": "agt_01JDSAMPLE0TIDEPOOL0SALES00", "name": "Tidepool Sales", "kids": ["kOJ8b2…"] }],
  "signature": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtcHJvZmlsZStqd3QifQ…"
}

The same profile can reach you inside a 402 (info.profile in the x402 v2 com.provenanceauth.intent extension), an ACP capability declaration, an AP2 merchant agent's metadata (maps to AP2 0.2) or a checkout challenge's profile_url. x402ProfileOf(paymentRequired) reads it from a 402.

2. Search by category

Results are ordered by name, never ranked or recommended. Each selling agent carries its record in two facts: orders and rating.

curl -s "$PROVENANCE_API/v1/public/businesses/search?category=data&sells_to_agents=true"
{
  "object": "list",
  "data": [{
    "object": "directory_business",
    "id": "biz_01JDSAMPLE0SALTMARSH0DATA00",
    "name": "Saltmarsh Data",
    "selling": [{ "agent_id": "agt_01JDSAMPLE0TIDEPOOL0SALES00", "name": "Tidepool Sales", "record": { "orders": 0, "rating": null, "rating_count": 0, "line": "New · 0 orders" } }]
  }],
  "has_more": false,
  "next_cursor": null
}

3. Check the seller agent against the profile

An offer or a request names the agent that sends it and the key it signs with. verifySellerAgent checks the profile's signature against the issuer's keys, that the profile lists the domain you found the business at, and that it lists this agent with this key.

import { fetchJwks, verifySellerAgent } from "@provenanceauth/sdk";

const jwks = await fetchJwks(process.env.PROVENANCE_API!);
const check = await verifySellerAgent(profile, offer.iss, offer.kid, { jwks, origin: "https://saltmarsh.example", apiBase: process.env.PROVENANCE_API });
if (!check.valid) throw new Error(`not Saltmarsh's agent: ${check.reason}`);
reasonMeaning
signature_invalidThe profile isn't signed by the issuer's keys.
profile_tamperedThe profile was changed after it was signed.
profile_expiredThe signature is past its expiry. Fetch the profile again.
origin_not_in_profileThe profile belongs to another business: it doesn't list the domain you found the business at.
agent_not_listedThis agent doesn't sell for this business.
key_not_listedThe agent is listed, but this key isn't one of its active keys.
key_revokedWith apiBase, the online check says the key is revoked or expired.

Check before you accept

An agent on a lookalike domain can copy a business's name and its agent's name. Only the signed profile for the domain you meant ties the agent and its key to that business.

4. Ask from an MCP client

Provenance MCP has two tools that need no key: add ?toolsets=verify to the server's address. check_counterparty takes a domain and returns whether the business has a verified profile, its rules and its responding agents. find_counterparties searches by category. See tools that need no key.

Errors you might see

CodeWhat to do
profile_not_publishedThe domain has no published profile. Treat an agent that says it sells for it as unverified.
rate_limit_exceededLookups are limited per address each minute. Cache profiles for 5 minutes.
parameter_invalid on categoryUse lowercase letters, digits and underscores.

See also