Authorize · Guide
Sell to agents
Use this to let other companies' agents buy from your agent with a signed offer, and to get proof of who accepted it and what you delivered. Your agent signs offers and deliveries with its own Ed25519 key; it never calls Provenance to sign.
Before you begin: register your agent and give it an Identify signing key.
1. Mark the agent as a seller
curl -s -X PATCH $PROVENANCE_API/v1/mandate/agents/$AGENT_ID \
-H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
-d '{ "selling": true, "seller_origin": "https://saltmarsh.example" }'
await fetch(`${process.env.PROVENANCE_API}/v1/mandate/agents/${agentId}`, {
method: "PATCH",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ selling: true, seller_origin: "https://saltmarsh.example" }),
});
import os
import httpx
api, h = os.environ["PROVENANCE_API"], {"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}
httpx.patch(f"{api}/v1/mandate/agents/{agent_id}", headers=h, json={"selling": True, "seller_origin": "https://saltmarsh.example"})
2. Publish the well-known file
Serve this at https://saltmarsh.example/.well-known/provenance-agent.json, listing the agent and its key ids:
{ "agents": [{ "id": "agt_01M67P48DDK4HRGG0BR457KQJN", "kids": ["poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U"] }] }
Then run POST /. The check runs daily too. While it passes, buyers see domain_verified: true; a failure clears it and sends authorize.agent.seller_check_failed. domain_verified means your origin lists the agent, nothing more.
3. Sign an offer
An offer expires within 7 days and is at most 8 KB. total must equal the items. To require a person at the buyer, add requires: { buyer_person: true, buyer_method: "passkey", agree_terms: true }; their passkey then signs your terms.hash. seller_confirmation must match your settings exactly (step 5), or the offer is refused.
To sell over x402 v2, put the offer in the 402 with x402OfferRequired({ resource, accepts, offer }). The buyer accepts it and pays with the acceptance token in the extension.
4. Check the acceptance
When the buyer pays, check its token offline against our JWKS and your own offer:
import { verifyDealAcceptance, verifyX402DealPayment } from "@provenanceauth/rails/deals";
const r = await verifyDealAcceptance(token, offer, { jwks });
// over x402: await verifyX402DealPayment(req.headers["payment-signature"], offer, { jwks })
if (!r.valid) throw new Error(r.reason);
from provenanceauth_verify import verify_deal_acceptance
r = verify_deal_acceptance(token, offer, jwks)
assert r.valid, r.reason
r := provenanceverify.VerifyDealAcceptance(token, offer, jwks, "", nil, 0)
It checks our signature and expiry, that the token's deal.offer_hash is your offer's hash and you are the seller, the revocations you pass, and that every person the offer required approved with the method, tier and terms you asked for. chain is not_checked: agent-team chains aren't issued yet.
5. Set when your people confirm
In Settings → Store → Selling → Confirmations, or PUT /, choose never, on_request (orders at or over min_amount, or with listed SKUs or categories) or always, and your usual response time. The policy goes into every offer and the counterparty check, beside the measured median over 30 days. Confirmations go to all of your approvers; with none, an order that needs one is refused at acceptance with deal_person_required.
To send some orders to particular people, add a rule on action_type: "deal.sell" with a route: the rule can read the order's order.* facts (amount, SKUs, categories, the buyer company and its rating), and the confirmation then follows the route's people, wait and escalation.
Your confirmation page shows the buyer, the agent it's buying with, a one-line summary, the delivery date and the total. Show the buyer's record (show_buyer_record) adds the buyer's two facts: never (the default), new_or_low (a new buyer, or one rated under the value you set, 4 by default) or always. The record is always in Details.
6. Deliver
Sign a delivery receipt and record it with your key:
import { signDelivery, contentHash } from "@provenanceauth/rails/deals";
const { receipt } = await signDelivery({ iss: agentId, deal_id: deal.id, offer_hash, content_hash: await contentHash(pdfBytes) }, privateJwk);
Then POST /. The buyer confirms the hash; a silent buyer leaves the deal completed_unconfirmed after the confirm window. You pay per completed deal. You may cancel any time before delivery with POST /.
Errors you might see
| Code | What to do |
|---|---|
offer_ | Re-sign the offer; check the totals and that seller_ matches your settings. |
offer_ | Sign with an active key. |
delivery_ | Sign the receipt with this deal's id and offer_. |
deal_ | Read the deal and act on its current status. |
See also
- Deals between agents
- Pay per call with tabs: many small calls under one approval
- When a deal goes wrong: disputes, evidence and who decides
- Act as an arbiter: decide disputes you are named in
- Buy from agents