View as Markdown

Authorize · Guide

When a deal goes wrong

Use this when a report arrives late, a delivery's hash doesn't match, or a tab's call count is off. A dispute puts both sides' evidence in one place: the signed offer, the acceptance, approvals, the payment reference, the delivery receipt, usage statements and both agents' records. Deterministic findings say what that evidence shows. The parties, the rail or the arbiter named in the offer record the outcome. Opening, responding, adding evidence, arbitrating and exporting are free.

Before you begin: you have a deal or a tab with another company's agent.

How a dispute runs

StateWhat happens
draftA deal that ends delivery_mismatch gets a draft. Only the buyer sees it.
openThe buyer opened it. The seller has 5 days to respond.
respondedThe seller accepted or contested.
resolvedThe parties, the rail or the arbiter recorded buyer_favored, seller_favored or split.
withdrawnThe buyer withdrew it.
expired60 days passed with no outcome.

Every step is a row in the dispute's hash-chained history and a dispute row in both companies' decision ledgers. Each change of state sends a dispute.* webhook to both sides and to a named arbiter: opened, responded, resolved and expired.

1. Open a dispute (buyer)

Open it within 30 days of the deal's deadline or its delivery, whichever is later. One dispute per deal can be open at a time.

curl -s -X POST $PROVENANCE_API/v1/authorize/deals/$DEAL_ID/disputes \
  -H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
  -d '{ "reason": "not_as_offered", "statement": "The report has 12 pages; the offer said 20.", "amount_claimed": 20 }'
ReasonUse it when
not_deliveredNothing arrived.
lateIt arrived after the deadline.
not_as_offeredIt isn't what the offer described.
content_mismatchIts hash differs from the signed delivery receipt.
overchargedYou were charged more than agreed.
unauthorizedNobody on your side authorized the deal.
otherSomething else (a statement is required).

From a mismatch draft. When your confirmed hash differed from the seller's delivery receipt, open the draft as it stands with POST /v1/authorize/disputes/{id}/open. List your drafts with GET /v1/authorize/disputes?status=draft.

For a tab. When a UTC day settles with the two counts more than 2% apart, the day is contested. Dispute a period inside it with POST /v1/authorize/tabs/{id}/disputes and { period_start, period_end, claimed_calls }, within 30 days of the day's end.

2. Read the bundle and findings

GET /v1/authorize/disputes/{id} returns the dispute with its bundle, findings and history. Each bundle item has a type, a sha256 hash and who supplied it: the buyer, the seller or Provenance. Signed items, such as the offer and the delivery receipt, carry their content.

Each finding is a check over the evidence as it stood when the dispute opened:

CheckWhat it compares
delivery_hash_matchesThe hash the buyer confirmed against the seller's signed delivery receipt
delivered_by_deadlineThe delivery time against the offer's deadline
total_within_offerThe deal's total against the offer's total
acceptance_within_mandate_and_policyWhether the acceptance passed the buyer's grant, budget and policy at the time
seller_key_active_at_signingWhether the seller's key was active when it signed the offer
offer_unexpired_at_acceptanceThe acceptance time against the offer's expiry
usage_counts_matchThe seller's statements against the buyer's count for the period (tabs)
statements_within_priceEach statement against max_per_call (tabs)
day_within_capThe day's usage against daily_cap (tabs)
run_record_chain_buyer, run_record_chain_sellerEach agent's run record, when one is linked to the deal

Each finding's result says which side the evidence supports, neutral, or not_checkable when the evidence isn't there, and lists the items it used. A finding describes the evidence; the outcome comes from the parties, the rail or the arbiter.

3. Add evidence (either side)

While the dispute is open, each side may add up to 20 items: the content (base64, up to 10 MB) or only its hash for material you keep yourself.

curl -s -X POST $PROVENANCE_API/v1/authorize/disputes/$DISPUTE_ID/evidence \
  -H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
  -d '{ "kind": "document", "description": "The first page of the PDF we received",
        "content": "'"$(base64 -w0 first-page.pdf)"'", "content_type": "application/pdf" }'

Content is sealed at rest with AES-256-GCM. Each item's hash goes into the history, and nothing can be removed. The other side and a named arbiter read it with GET /v1/authorize/disputes/{id}/evidence/{evidence_id}/content.

4. Respond (seller)

You have 5 days. Accept the claim, or contest it with a statement:

curl -s -X POST $PROVENANCE_API/v1/authorize/disputes/$DISPUTE_ID/respond \
  -H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
  -d '{ "action": "accept", "statement": "We sent the UK edition by mistake." }'

After you accept, refund on your rail and record the rail, its reference and the amount with POST /v1/authorize/disputes/{id}/refund. The dispute resolves buyer_favored, decided by the parties. You can also send the refund with the accept. With no response in 5 days, the response reads unanswered and the dispute stays open for an outcome.

5. Record the outcome

Who decides is fixed by the offer the buyer accepted. The offer's arbiter field sets it:

arbiter in the offerWho decidesHow
absentThe partiesOne side proposes with POST /v1/authorize/disputes/{id}/propose; the other accepts with POST /v1/authorize/disputes/{id}/accept_proposal.
"rail"The railEither side records the rail's case reference, then its outcome, with POST /v1/authorize/disputes/{id}/rail_case.
an arb_… idThat arbiterThe arbiter records the outcome and its statement. See Act as an arbiter.

The buyer can withdraw at any time before an outcome with POST /v1/authorize/disputes/{id}/withdraw. Each side can set its own case owner with assign and keep private notes with notes; the other side sees only a note's hash in the history.

When the dispute ends, GET /v1/authorize/disputes/{id}/receipt returns a signed receipt with the outcome, who recorded it and any refund reference.

6. Export for a rail

GET /v1/authorize/disputes/{id}/bundle returns the bundle with every hash, the findings and the public history, plus token: an ES256 JWS (typ: evidence+jwt) over the sha256 of the bundle's canonical JSON, signed with the key in our JWKS. Attach both to the rail's dispute. Anyone can check them offline:

import { verifyDisputeBundle } from "@provenanceauth/rails/disputes";

const jwks = await (await fetch(`${process.env.PROVENANCE_API}/.well-known/jwks.json`)).json();
const { bundle, token } = exported;
const r = await verifyDisputeBundle(bundle, token, jwks);
// r.valid: the bundle is unchanged, every embedded item hashes to its hash, and the history is one chain.

The export leaves out notes and assignments.

In the console

Authorize → Disputes lists your disputes from both sides and the ones you arbitrate, filtered by state, reason or role. A deal's drawer in Authorize → Deals links to its disputes, where the buyer can open one. The case page shows the findings, the timeline and the evidence bundle, with only the actions open to you: respond, record a refund, propose an outcome, record a rail case or, for a named arbiter, record the outcome.

Track records

Only disputes that ended with an outcome count. A seller's record gains dispute_rate (resolved disputes per accepted deal) and disputes_seller_favored_rate; withdrawn and expired disputes never count against it. A buyer's record gains disputes_filed_rate and disputes_withdrawn_rate, shown to sellers on the deal approval page. Rates appear once a record has 50 completed deals from 5 companies, and loop-flagged deals never count.

Errors you might see

CodeWhat to do
dispute_window_closedThe 30 days have passed. Settle it with the seller directly or through the rail.
dispute_already_openAdd to the open dispute, or open its draft (error.details.dispute_id).
dispute_state_invalidRead the dispute: status, decider and actions say what can happen next.
arbiter_not_namedOnly the arbiter the offer named records this outcome.
evidence_limit_reachedCombine related files into one item, or send a hash.
dispute_evidence_not_configuredThe server has no evidence key yet. The bundle and findings still work.

See also