# India Tenders Register auth.md

You are an AI agent. India Tenders Register (https://indiatendersregister.com) is the register of public tenders in India: central and state
government departments, PSUs, local bodies and GeM bids, read from the official procurement portals, with every corrigendum and change,
the tender documents, buyer organisations, and results and awards where published. Use it through the REST API
(`https://indiatendersregister.com/api/v1`, OpenAPI: `https://indiatendersregister.com/api/v1/openapi.json`) or the MCP server (`https://indiatendersregister.com/mcp`, Streamable HTTP).
Every call needs a credential of a person's India Tenders Register account, sent as `Authorization: Bearer <token>`.

Billing: each account has a prepaid wallet. New accounts get ₹50 of free credit. Each successful call
(HTTP 200) costs ₹0.50; errors are free. Each tender document download costs ₹10
(a repeat within 30 days is free, and it is refunded if it cannot be delivered). Top-ups: ₹500, ₹5,000 or ₹50,000 of credit, plus 18% GST.

Discovery: protected resource metadata `https://indiatendersregister.com/.well-known/oauth-protected-resource` (and `/mcp` suffixed),
authorization server metadata `https://indiatendersregister.com/.well-known/oauth-authorization-server` (its `agent_auth` block
describes method 2 below). Scope: `api`.

## 1. OAuth 2.1 (when the person can use a browser)

Authorization code + PKCE (S256). Register with `POST https://indiatendersregister.com/oauth/register` (RFC 7591, public client,
`token_endpoint_auth_method: none`) or use a Client ID Metadata Document URL as `client_id`. Send the person
to `https://indiatendersregister.com/oauth/authorize`; they sign in with a code emailed to them, or create an account there (with the
free credit), and allow your client. Exchange the code at `https://indiatendersregister.com/oauth/token`. Access tokens last 30 days;
refresh with `grant_type=refresh_token` (refresh tokens last 180 days and rotate). Revoke at
`https://indiatendersregister.com/oauth/revoke`. MCP clients (Claude, ChatGPT, Cursor and others) do all of this when given `https://indiatendersregister.com/mcp`.

## 2. Agent sign-up by email (verified email, no browser)

Ask the person first: tell them you will create or connect their India Tenders Register account, and get their email.

```http
POST https://indiatendersregister.com/agent/identity
Content-Type: application/json

{"login_hint": "person@example.com", "name": "Asha Verma", "company": "Verma Traders", "agent_name": "My Assistant"}
```

`name`, `company` and `agent_name` are optional (they fill in a new account and name you in the mail).
`{"type": "identity_assertion", "assertion_type": "verified_email", "assertion": "<email>"}` is accepted too.
We email the person a 6-digit code (valid 10 minutes) and answer `202` with `status: "code_sent"`.

Ask the person for the code, then:

```http
POST https://indiatendersregister.com/agent/identity/claim
Content-Type: application/json

{"login_hint": "person@example.com", "code": "123456"}
```

Response `201`: `{"api_key": "itr_...", "token_type": "Bearer", "new_account": true, "account": {"balance_inr": 50, ...}}`.
A new account is created when none exists, with ₹50 of free credit. Errors: `invalid_code` (ask again),
`expired_token` or `too_many_attempts` (start again at /agent/identity), `rate_limited`.
Keep the key secret and use it only for this person. They can see and revoke it at https://indiatendersregister.com/account/keys.

## 3. Use, check the wallet, and top up

- Data: `GET https://indiatendersregister.com/api/v1/tenders/search?q=road&state=maharashtra`, `/api/v1/tender/{irn}`, `/api/v1/tender/{irn}/history`,
  `/api/v1/tender/{irn}/documents`, `/api/v1/awards/search?winner=` ... (OpenAPI lists all). MCP: `https://indiatendersregister.com/mcp`.
- Documents: `POST https://indiatendersregister.com/api/v1/documents/{id}/download` costs ₹10; ask the person before buying one.
- Wallet (free): `GET https://indiatendersregister.com/api/v1/account` gives the balance and calls remaining.
- `402 insufficient_balance` means the wallet is empty. With the person's OK, `POST https://indiatendersregister.com/api/v1/account/topup`
  with `{"amount": 500}` (or 5000, 50000; 18% GST is added to the amount paid). The answer has a `pay_url`: give it to the person, who
  pays by UPI, card, net banking or wallet. Poll `status_url` until `"status": "paid"`; the credit is then
  in the wallet. The same top-up is offered as UCP (`https://indiatendersregister.com/.well-known/ucp`) and ACP (`https://indiatendersregister.com/.well-known/acp.json`)
  checkout sessions with hosted payment (`requires_escalation` + `continue_url`). You never handle card or UPI details.
- Usage log (free): `GET https://indiatendersregister.com/api/v1/account/usage`; the person can download every call as CSV from https://indiatendersregister.com/account/usage.

Rules: act only on what the person asked; do not top up or buy documents without their OK; do not bulk-scrape or resell data.
Bids are submitted only on the source portal each tender names: say so, and check dates against the latest corrigendum.
Terms: https://indiatendersregister.com/terms. Privacy: https://indiatendersregister.com/privacy. Refunds: https://indiatendersregister.com/refunds. Help: support@indiatendersregister.com.
