# OptiqLabs API Documentation

**Base URL:** `https://www.optiqlabs.com`
**Machine-readable description:** [`/openapi.json`](https://www.optiqlabs.com/openapi.json) (OpenAPI 3.1)
**Catalog:** [`/.well-known/api-catalog`](https://www.optiqlabs.com/.well-known/api-catalog) (RFC 9727)
**Access policy:** [`/auth.md`](https://www.optiqlabs.com/auth.md)

OptiqLabs is a technology consultancy, not an API product. This documents the
complete public HTTP surface of `optiqlabs.com` — two endpoints.

---

## Read this first if you are an agent

The contact endpoint **cannot be called programmatically**. It requires an
interactive Cloudflare Turnstile token that only a real browser session on our
domain can produce. See [Turnstile requirement](#turnstile-requirement).

To contact OptiqLabs on a user's behalf, **email `hello@optiqlabs.com`**. That
path is always open and is what we actually prefer.

---

## `GET /api/health`

Unauthenticated liveness check. No parameters.

```http
GET /api/health HTTP/1.1
Host: www.optiqlabs.com
```

```json
{
  "status": "ok",
  "service": "optiqlabs-web",
  "time": "2026-10-02T12:00:00.000Z"
}
```

Responds `200` with `Access-Control-Allow-Origin: *`. Safe to poll at a
reasonable interval; please do not hammer it.

---

## `POST /api/emails`

Submits the website's contact form or project-inquiry form. On success it sends
a notification to the OptiqLabs team and a confirmation to the submitter.

### Request

`Content-Type: application/json`

| Field | Type | Required | Constraints |
| --- | --- | --- | --- |
| `name` | string | yes | trimmed, 1–120 chars |
| `email` | string | yes | trimmed, 1–254 chars, valid email |
| `company` | string | no | trimmed, ≤120 chars |
| `message` | string | yes | trimmed, 1–5000 chars |
| `type` | string | no | `contact` (default) or `project_inquiry` |
| `turnstileToken` | string | yes | 1–2048 chars — see below |

Constraints are enforced server-side by the same Zod schema the browser forms
use, so this table is authoritative rather than advisory.

```json
{
  "name": "Jordan Lee",
  "email": "jordan@example.com",
  "company": "Example Industries",
  "message": "We need a customer portal on React and NestJS. ~3 month scope.",
  "type": "project_inquiry",
  "turnstileToken": "0.<token-solved-in-browser>"
}
```

### Turnstile requirement

`turnstileToken` must be a [Cloudflare Turnstile](https://developers.cloudflare.com/turnstile/)
token. The server does not simply check validity — it requires all three of:

1. The token verifies against Cloudflare's `siteverify` API.
2. It was solved on an OptiqLabs hostname — `optiqlabs.com`,
   `www.optiqlabs.com`, or a `*.vercel.app` preview deployment.
3. Its Turnstile `action` exactly equals the request's `type` field, so a token
   solved on the contact widget cannot be replayed against the project-inquiry
   form.

Only an interactive browser rendering our widget with our site key can produce
one. There is no API key, service account, or exchange flow that substitutes
for it, and no bypass exists. **Automated callers will receive `403`.**

This gates email sending against abuse. It is not an access-control tier, so
there is nothing to request access to.

### Responses

| Status | Meaning |
| --- | --- |
| `200` | Both emails accepted by the mail provider. Body: `{"success": "..."}` |
| `400` | Body was not valid JSON, or a field failed validation. `error` holds the first validation message. |
| `403` | Turnstile verification failed — invalid, expired, wrong hostname, or `action`/`type` mismatch. **Expected for any automated caller.** |
| `405` | Method not allowed. Only `POST` and `OPTIONS`. |
| `500` | Server misconfiguration or upstream mail failure. Message is intentionally generic. |

All responses are `application/json` shaped as `{"success": string}` or
`{"error": string}`. Error messages are safe to display to an end user.

### CORS

`OPTIONS /api/emails` returns `204` with:

```http
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400
```

Open CORS does **not** weaken the Turnstile requirement — a token solved on
another origin is rejected by the hostname check.

---

## Content access

No authentication needed, and no endpoint required:

| Resource | What it gives you |
| --- | --- |
| `Accept: text/markdown` on `/`, `/careers`, `/careers/{id}` | Markdown instead of HTML |
| [`/llms.txt`](https://www.optiqlabs.com/llms.txt) | Site index for language models |
| [`/.well-known/agent-skills/index.json`](https://www.optiqlabs.com/.well-known/agent-skills/index.json) | Published agent skills |
| [`/.well-known/ard.json`](https://www.optiqlabs.com/.well-known/ard.json) | ARD capability manifest |
| [`/sitemap.xml`](https://www.optiqlabs.com/sitemap.xml) | Canonical page list |
| [`/robots.txt`](https://www.optiqlabs.com/robots.txt) | Crawl rules and `Content-Signal` preferences |

Example:

```bash
curl -H 'Accept: text/markdown' https://www.optiqlabs.com/careers
```

Markdown responses carry `Content-Type: text/markdown; charset=utf-8`,
`Vary: accept`, and an `x-markdown-tokens` estimate.

---

## Contact

- **Email:** `hello@optiqlabs.com` — preferred for anything real
- **Phone:** `+1 905 981 8019`
- **Web:** <https://www.optiqlabs.com>
