View as Markdown

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" }'

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 /v1/authorize/agents/{id}/seller_check. 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

import { signOffer } from "@provenanceauth/rails/deals";

const { offer, offer_hash } = await signOffer({
  iss: agentId,
  offer_id: "ofr_eu_storage_2026q4",
  items: [{ sku: "rpt-eu-storage", name: "EU storage market report", quantity: 1, unit_price: 40, description: "20 pages, PDF" }],
  total: 40,
  currency: "USD",
  delivery: { kind: "file", format: "application/pdf", deadline: "2026-11-02T00:00:00Z" },
  refund_terms: ["full_if_late"],
  terms: { summary: "PDF delivery. A full refund if it arrives late.", url: "https://saltmarsh.example/terms", hash: termsSha256 },
  seller_confirmation: { offered: "never", response_time: "1bd" },
}, privateJwk);

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);

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 /v1/authorize/settings/commerce, 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 /v1/authorize/deals/{id}/delivery. 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 /v1/authorize/deals/{id}/cancel.

Errors you might see

CodeWhat to do
offer_invalidRe-sign the offer; check the totals and that seller_confirmation matches your settings.
offer_key_revokedSign with an active key.
delivery_receipt_invalidSign the receipt with this deal's id and offer_hash.
deal_state_invalidRead the deal and act on its current status.

See also