# Check who you're paying

Before your agent pays another agent, check the seller's key, its verified origin, its track record and its confirmation policy with one keyless call.

Use this before your agent pays another agent. One keyless call tells you which agent signed an offer, whether its origin lists it, whether its key is active, and how it has done as a seller.

**Before you begin:** have the offer's `kid` (its JWS header), or the seller's agent id and origin.

## 1. Call the check

Pass the `kid` an offer is signed with, or an agent id and the origin it claims:

**curl**

```bash
curl -s "$PROVENANCE_API/v1/public/counterparties/check?kid=poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U"
```

**Node**

```ts
import { verifyCounterparty } from "@provenanceauth/rails/deals";

const c = await verifyCounterparty({ kid }, { apiBase: process.env.PROVENANCE_API! });
```

**Python**

```python
from provenanceauth_verify import verify_counterparty

c = verify_counterparty(os.environ["PROVENANCE_API"], kid=kid)
```

No API key is needed; it allows 60 calls a minute per IP, and the TypeScript, Python and Go helpers cache each answer for 5 minutes. [`GET /v1/public/counterparties/check`](https://provenanceauth.com/docs/api/deals.md#get-v1-public-counterparties-check) has the full shape.

## 2. Read the answer

| Field | Meaning |
| --- | --- |
| `agent` | The seller agent's id and name, or null when the key is unknown |
| `domain_verified` | The origin's `/.well-known/provenance-agent.json` listed the agent within 48 hours |
| `key_status` | `active`, `revoked` or `unknown` |
| `track_record` | Completed deals, on-time, mismatch and cancel rates, buyer companies, and a rating once there are 20 ratings from 5 companies. Rates stay null until 50 completed deals from 5 buyer companies |
| `seller_confirmation` | When a person at the seller confirms orders |
| `confirmation_response_median_s` | Their measured median response time over 30 days |

`domain_verified` means the origin lists the agent. It isn't a statement about the business behind it.

## 3. Decide

Refuse an offer from a `revoked` key. In your [policy](https://provenanceauth.com/docs/concepts/policies.md), the same values are facts on `deal.accept` (`counterparty.domain_verified`, `counterparty.rating`, and the rest), so a rule can ask a person before buying from a seller without a record. See [Buy from agents](https://provenanceauth.com/docs/authorize/guides/buy-from-agents.md#5-set-your-seller-rules).

## Errors you might see

| Code | What to do |
| --- | --- |
| `parameter_invalid` | Send `kid`, or both `agent_id` and `origin`. |
| `rate_limit_exceeded` | Cache answers for 5 minutes; the helpers do it for you. |

## See also

- [Deals between agents](https://provenanceauth.com/docs/authorize/concepts/agent-commerce.md)
- [Verify signed agents](https://provenanceauth.com/docs/identify/guides/verify-signed-agents.md)
