# auth.md — AMZScout agent registration

This document tells AI agents how to obtain credentials for the AMZScout
machine-readable surfaces: the **AMZScout MCP server** and the **AMZScout Tools API**.

- Audience: autonomous agents and agent frameworks acting on behalf of an AMZScout user.
- Support: support@amzscout.net
- Human documentation: <https://amzscout.net/amazon-product-mcp-for-ai-agents/>

## Protected resources

| Resource | Endpoint | Description |
|---|---|---|
| MCP server (Streamable HTTP) | `https://chatbot.amzscout.net/mcp` | Amazon product, niche, keyword/PPC and brand research tools over MCP |
| MCP server (legacy SSE) | `https://chatbot.amzscout.net/mcp/sse` | Same tool catalogue over SSE |
| Tools API (HTTP) | `https://chatbot.amzscout.net/api/v1/tools/call` | Same tools as plain HTTP function calls |
| Checkout (ACP) | `https://amzscout.net/checkout/api/acp/v1` | Agentic Commerce Protocol checkout sessions for AMZScout plans and bundles |

Machine-readable descriptions:

- API catalog: <https://amzscout.net/.well-known/api-catalog>
- MCP server card: <https://amzscout.net/.well-known/mcp/server-card.json>
- OpenAPI description: <https://chatbot.amzscout.net/openapi.json>
- Agent skills index: <https://amzscout.net/.well-known/agent-skills/index.json>
- ACP discovery: <https://amzscout.net/.well-known/acp.json>

## Discovery

```
GET https://amzscout.net/.well-known/oauth-protected-resource
GET https://amzscout.net/.well-known/oauth-authorization-server
```

The protected-resource metadata advertises a single authorization server,
`https://amzscout.net/auth`. Its RFC 8414 metadata is served by the authorization server
itself, at <https://amzscout.net/auth/.well-known/oauth-authorization-server> and, for
convenience, at <https://amzscout.net/.well-known/oauth-authorization-server>.

Per-resource metadata for the MCP server is published by the resource itself:
<https://chatbot.amzscout.net/.well-known/oauth-protected-resource>.

## Registration methods

AMZScout supports two ways for an agent to get a credential. There is **no**
ID-JAG (`urn:ietf:params:oauth:token-type:id-jag`) or verified-email flow today; the
`agent_auth` block describes the anonymous flow below, mapped onto standard OAuth 2.1.

### 1. OAuth 2.1 — dynamic client registration + authorization code with PKCE

1. **Register** (no credentials required, RFC 7591):

   ```
   POST https://amzscout.net/auth/v1/oauth2/register
   Content-Type: application/json

   { "client_name": "<your agent>", "redirect_uris": ["<your callback>"],
     "grant_types": ["authorization_code"], "response_types": ["code"],
     "token_endpoint_auth_method": "none" }
   ```

   The response contains a public `client_id`. No client secret is issued
   (`token_endpoint_auth_methods_supported: ["none"]`), so PKCE is mandatory.

2. **Claim** — send the user to the authorization endpoint so they can attach the
   anonymous client to their AMZScout account:

   ```
   GET https://amzscout.net/auth/v1/oauth2/authorize
       ?response_type=code&client_id=<client_id>&redirect_uri=<callback>
       &scope=mcp&code_challenge=<S256 challenge>&code_challenge_method=S256
   ```

3. **Exchange** the authorization code for an access token:

   ```
   POST https://amzscout.net/auth/v1/oauth2/token
   Content-Type: application/x-www-form-urlencoded

   grant_type=authorization_code&code=<code>&redirect_uri=<callback>
   &client_id=<client_id>&code_verifier=<verifier>
   ```

4. **Use** the credential on every request to a protected resource:

   ```
   Authorization: Bearer <access_token>
   ```

Supported scope: `mcp`.

### 2. API key

Users can issue a long-lived AMZScout API key at
<https://amzscout.net/amazon-product-mcp-for-ai-agents/> and hand it to the agent.
Send it the same way:

```
Authorization: Bearer <API_KEY>
```

or, where headers are not available, as `?key=<API_KEY>` on the MCP endpoint. The
Tools API additionally accepts `X-AMZScout-Hash: <API_KEY>`.

## Checkout over ACP

The checkout API implements the
[Agentic Commerce Protocol](https://agenticcommerce.dev) (spec `2026-01-30`) at
`https://amzscout.net/checkout/api/acp/v1`:

```
POST   /checkout_sessions                  # quote a plan or bundle
GET    /checkout_sessions/{id}             # read the session back
POST   /checkout_sessions/{id}             # update buyer or discount code
POST   /checkout_sessions/{id}/complete    # pay
POST   /checkout_sessions/{id}/cancel      # close the session
```

Line item ids are AMZScout plan codes — `bundle:bundle-ai-monthly`,
`tariff:full_annual`, or a bare code. Send `Authorization: Bearer <credential>`
with the same credential the MCP server accepts: an AMZScout API key or a session
hash. The session is then bound to that account and the order is created for the
account's own email, so `buyer.email` supplied in the request is informational
only. Platforms holding no AMZScout credential can be issued a separate bearer
key on request (support@amzscout.net).

**Payment is not open to agents yet.** Completing a session needs a delegated
payment credential, which AMZScout does not accept at the moment: sessions report
`status: "not_ready_for_payment"` with an empty
`capabilities.payment.handlers`, and `POST …/complete` answers `400
payment_not_enabled`. Everything before payment — pricing, discount codes, totals
— is live, and the buyer can finish the same cart at
<https://amzscout.net/checkout/>. This page is updated when delegated payment is
enabled.

## Revocation

Access is revoked by the user from their AMZScout account; revoked keys and tokens stop
working immediately. There is no agent-facing revocation endpoint or event stream yet, so
treat `401`/`403` responses as terminal and re-run registration.

## Usage limits and terms

Calls consume the user's AMZScout plan quota. When the quota is exhausted the tools return
an account notice instead of data — surface it to the user verbatim rather than retrying.
Use is governed by the [Terms of Use](https://amzscout.net/terms-of-use) and the
[Privacy Policy](https://amzscout.net/privacy-policy). Content usage preferences for
crawling and AI training are declared in
[robots.txt](https://amzscout.net/robots.txt) and [llms.txt](https://amzscout.net/llms.txt).
