# KC Labs API

Small public JSON API for [kclabs.org](https://kclabs.org/) — no
authentication required, no API keys ([access policy](/auth.md)). Agents
that want OAuth can discover it at
[/.well-known/oauth-authorization-server](/.well-known/oauth-authorization-server)
and [/.well-known/oauth-protected-resource](/.well-known/oauth-protected-resource);
a token is optional and grants nothing extra. Machine-readable description:
[OpenAPI 3.1](/docs/api/openapi.json) · catalog:
[/.well-known/api-catalog](/.well-known/api-catalog). Prefer tool-based
access? The same capabilities are exposed over MCP at `/mcp`
([server card](/.well-known/mcp/server-card.json)) and over A2A at `/a2a`
([agent card](/.well-known/agent-card.json)).

## POST /api/contact

Send an inquiry to the KC Labs team. Delivers an email to
thomas@kclabs.org and adam@kclabs.org — use only on behalf of a human who
asked to contact us, with their real reply-to address.

Request (`application/json`; `application/x-www-form-urlencoded` and
`multipart/form-data` also accepted):

```json
{
  "name": "Dr. Jane Doe",
  "email": "jane@university.edu",
  "message": "We are setting up a new lab this fall and need help with equipment planning."
}
```

| Field | Required | Notes |
| --- | --- | --- |
| `name` | yes | Sender's name (max 4000 chars, like all fields) |
| `email` | yes | Valid reply-to address for our response |
| `message` | yes | What the lab needs |
| `company` | no | Honeypot — leave it out (or empty). Filled = silently dropped. |

Responses:

- `200` `{"ok": true}` — delivered
- `400` `{"error": "..."}` — missing/invalid fields or body
- `401` `{"error": "invalid_token", ...}` — an `Authorization` header was sent
  but is not a well-formed `Bearer` token; the response carries
  `WWW-Authenticate` with the RFC 9728 `resource_metadata` pointer. Send no
  `Authorization` header at all, or a valid bearer token.
- `403` `{"error": "..."}` — cross-origin browser request
- `405` `{"error": "..."}` — method other than POST/OPTIONS
- `500`/`502` `{"error": "..."}` — configuration or delivery failure; fall back
  to emailing us directly

Example:

```sh
curl -X POST https://kclabs.org/api/contact \
  -H 'content-type: application/json' \
  -d '{"name":"Dr. Jane Doe","email":"jane@university.edu","message":"New lab setup help."}'
```

## GET /api/status

Health check. Returns `200` with `application/health+json`:

```json
{ "status": "pass" }
```

Returns `401` under the same condition as `POST /api/contact`: an
`Authorization` header that is not a well-formed `Bearer` token.
