# auth.md · apexlinks

How an agent authenticates to https://apexlinks.org. Read this before touching anything that needs an account.

## Discover

There is no API key, no client registration and no agent identity provider. The public API is
read-only and open:

- https://apexlinks.org/openapi.json describes every public endpoint.
- https://apexlinks.org/.well-known/api-catalog is the RFC 9727 catalog that points at it.
- https://apexlinks.org/.well-known/oauth-protected-resource is not published, because apexlinks does not
  run an OAuth authorization server for agents.

## Pick a method

1. **Anonymous, for reads.** Use `GET /ask?q=...` or `GET /api/discover?q=...`. No header, no
   key, no cookie. Rate limits are per caller (10 searches a minute by default); a 429 means
   wait, not retry in a loop.
2. **The person's browser session, for account actions.** Listing something (/new), messaging
   (/@chat/{handle}) and settings (/me) are for a signed-in human. The session is an
   HttpOnly cookie set after the person signs in with Google or an email and password at
   https://apexlinks.org/login. An agent must not hold, copy or replay that cookie, and must not act on the
   account without the person present and consenting.

## Register

Nothing to register. There is no `agent_auth` identity endpoint, no `identity_endpoint`, no
`identity_assertion` flow and no ID-JAG support. Do not attempt to create an account for an
agent: accounts belong to people, and automated sign-up is refused.

## Claim

No claim ceremony exists. If a user asks an agent to do something that needs an account, the
agent should hand them the link (https://apexlinks.org/login?next=...) and let them sign in.

## Exchange

No token exchange. There is no `/oauth2/token`, no `service_auth` grant and no bearer token to
mint. Public reads need no token at all.

## Use the access_token

There is no access token. For reads, call the endpoint directly. For writes, the person uses
the site.

## Errors

- 429 `slow_down`: the rate limit. Honour Retry-After if present, otherwise back off.
- 401 / 302 to /login: the action needs a signed-in person.
- 403 `bad_origin`: a mutating request came from another origin; only the site itself may
  change things.
- 404: the listing or person is gone.

Errors from the API are JSON or plain text with a short code, never an HTML page. If you get a
`WWW-Authenticate` challenge you are on a path that does not exist here.

## Revocation

Nothing to revoke: no agent credential is issued. If a person deletes their account, ask them
to do it through the feedback button at https://apexlinks.org/contact, or write to hi@x2.studio.
