# Projection Finder API — Agent & Developer Authentication

This document explains how agents and developers authenticate with the Projection
Finder API at `https://api.projectionfinder.com`.

## Current State: Open Access

The API is currently **open**. No authentication is required for basic usage of any
endpoint. You can call every route described in the [OpenAPI
specification](https://api.projectionfinder.com/openapi.json) and the [API
catalog](https://api.projectionfinder.com/.well-known/api-catalog) directly.

CORS is permitted for the following browser origins:

- `https://projectionfinder.com`
- `https://www.projectionfinder.com`
- `http://localhost:5173` (local development)
- `http://localhost:4173` (local preview)

Non-browser clients (scripts, agents, CLIs) are not subject to CORS and may call
the API directly.

## Rate Limits

All mutating (`POST`) endpoints are rate-limited per IP address, per hour. Read
endpoints (`GET`) are not rate-limited.

| Endpoint           | Method | Limit (per hour per IP) |
|--------------------|--------|-------------------------|
| `/feedback`        | POST   | 10                      |
| `/events`          | POST   | 120                     |
| `/project`        | POST   | 30                      |
| `/ai/explain`      | POST   | 60                      |

When a rate limit is exceeded the API responds with HTTP `429` and a body of:

```json
{ "ok": false, "error": "rate_limited", "retry_after": 3600 }
```

`retry_after` is the number of seconds until the current window resets.

## Future: OAuth2 Client Credentials

A formal OAuth2 `client_credentials` flow is planned for higher-volume and
programmatic access. The following discovery documents are already published so
agents can discover the configuration before the flow is activated:

- **Authorization Server Metadata**:
  `https://api.projectionfinder.com/.well-known/oauth-authorization-server`
- **Protected Resource Metadata**:
  `https://api.projectionfinder.com/.well-known/oauth-protected-resource`

Supported scopes (planned):

- `feedback:write`
- `events:write`
- `project:write`
- `ai:write`

Once activated, clients will request a bearer token from
`https://api.projectionfinder.com/oauth/token` using the `client_secret_basic`
authentication method and pass it in the `Authorization` header as
`Bearer <token>`.

Until then, no token is required.

## How to Register

To request API credentials, higher rate limits, or report an issue:

- **Email**: [najah@axisspatial.com](mailto:najah@axisspatial.com)
- **Web**: visit [projectionfinder.com/auth](https://projectionfinder.com/auth)

When the OAuth2 flow is activated, this page will be updated with the client
registration portal link and credential-issuing steps.
