# auth.md — Asbury AI Solutions

This document describes how AI agents register, authenticate, and call the
Asbury AI Solutions API. It is the machine-readable companion to the OAuth
discovery metadata published at `/.well-known/oauth-authorization-server`
and `/.well-known/oauth-protected-resource`.

## Resource identifier

The protected API resource is:

- `https://asburyaisolutions.com/api/v1`

The full OAuth Protected Resource Metadata (PRM) document lives at:

- `https://asburyaisolutions.com/.well-known/oauth-protected-resource`

The PRM advertises the resource, the authorization server, the supported
scopes, and the supported bearer-method (`header`).

## Authorization server

The advertised authorization server is:

- `https://asburyaisolutions.com`

Its full OAuth 2.0 Authorization Server Metadata document lives at:

- `https://asburyaisolutions.com/.well-known/oauth-authorization-server`

The `issuer` in the AS metadata matches the resource-server identifier
above (no trailing slash, exact match).

## Agent registration — `agent_auth`

Agents self-register by reading the `agent_auth` block of the Authorization
Server Metadata document. The block currently published looks like:

```json
{
  "register_uri": "https://asburyaisolutions.com/auth.md",
  "identity_types_supported": ["verified_email"],
  "credential_types_supported": ["api_key"],
  "claim_uri": "mailto:hello@asburyaisolutions.com"
}
```

The intended registration flow is:

1. Read the AS metadata at `/.well-known/oauth-authorization-server` and
   resolve the `agent_auth.register_uri`.
2. Identify yourself by a verified email address. The `identity_assertion`
   format used is `verified_email` — present an email address you control
   plus the verification artifact (a one-time code delivered to that
   inbox) as the identity assertion.
3. Use the contact channel at `claim_uri` to complete the verification
   step (manual today — see the note in `How to get an API key` below).
4. Receive an issued API key bound to the verified email.
5. Authenticate subsequent calls with `Authorization: Bearer ***` or
   `X-API-Key: ***`.

### Identity types supported

- `verified_email` — present an email address and the verification code
  delivered to it as the identity assertion. The current
  `assertion_types_supported` for this identity type is
  `urn:ietf:params:oauth:token-type:id-jag` style identity assertion
  wrapped around the verified-email claim.

### Credential types supported

- `api_key` — long-lived bearer secret issued per registered agent. Used
  in the `Authorization: Bearer ***` header or the `X-API-Key` header.

### Revocation

Send revocation requests to the address listed in `agent_auth.revocation_uri`
of the AS metadata, or email `hello@asburyaisolutions.com` with the key
identifier and a one-line reason.

## How to get an API key

Send a brief request to `hello@asburyaisolutions.com` with:

1. Your use case
2. Expected request volume
3. The verified email address you want bound to the key
4. A contact email for rate-limit notices

Keys are issued manually today. OAuth / OIDC client_credentials with the
`identity_assertion` grant is the target flow once automated provisioning
is live; the discovery documents above already declare the shape so that
agents can self-configure against them now.

## Authentication method

Most protected endpoints accept:

```
Authorization: Bearer ***
# or
X-API-Key: ***
```

The lead intake webhook additionally requires `X-Intake-Secret` in the
header.

## Endpoints

### Public

- `GET /api/v1/health` — return service status, expects no auth.

### Protected

- `POST /api/v1/leads` — submit a new lead. Requires `X-API-Key` header
  and `X-Intake-Secret`.
- `GET /api/v1/leads` — list leads. Requires `X-API-Key` + UI session or
  API key.
- `GET /api/v1/campaigns` — list outreach campaigns.
- `GET /api/v1/revenue/summary` — revenue summary.

## Rate limits

- Public endpoints: 60 requests/minute
- Protected endpoints: 100 requests/minute per key

## Scopes

- `leads:read`, `leads:write` — lead intake API
- `campaigns:read` — outreach campaigns API
- `revenue:read` — revenue summary API

## Contact

Peter Byrnes
`hello@asburyaisolutions.com`
`https://asburyaisolutions.com`
