# PCB Tools - Agent API

Stateless HTTP API for AI agents and scripts. Send a Gerber archive, get a file back
in the same response. Nothing is stored: the upload is deleted after processing.
Free for now, rate limited. No editing features here (use https://pcbtools.eu/ for that).

Base URL: https://pcbtools.eu

## Input (both endpoints)

multipart/form-data with:
- `file` (required): ZIP or RAR with RS-274X Gerber + Excellon drill files
  (from KiCad, Altium, EasyEDA, Eagle, Fusion 360...). Max 15 MB.

## POST /agent/v1/pdf

Returns `application/pdf`: vector PDF of the board (all layers, real scale).

    curl -sS -X POST https://pcbtools.eu/agent/v1/pdf \
         -F "file=@gerbers.zip" -o board.pdf

## POST /agent/v1/3d

Returns `application/zip` with the 3D model files.

Optional form fields:
- `format`: `obj` (default), `stl_sep` (one STL per layer), `stl_one` (single STL), `ply`, `3mf`
- `board_thickness` mm (default 1.6, range 0.2-6)
- `copper` mm (default 0.035, range 0.005-0.2)
- `mask` mm (default 0.025, range 0.005-0.1)
- `silk` mm (default 0.010, range 0.002-0.1)
- `tolerance` mm curve approximation (default 0.010, range 0.002-0.1)

    curl -sS -X POST https://pcbtools.eu/agent/v1/3d \
         -F "file=@gerbers.zip" -F "format=3mf" -o board_3d.zip

## Errors

Always JSON `{"error": "..."}` with a proper HTTP status:
400 bad request or unreadable archive, 401 API key required/invalid, 413 file too large,
422 no Gerber layers found or conversion failed, 429 too many concurrent requests from your IP,
503 server busy (see `Retry-After`), 500 internal error.

## Notes

- Processing can take 5-60 s for big boards; use a timeout of at least 120 s.
- Authentication (only when enabled): `Authorization: Bearer <key>`.
- Machine-readable index of the site: https://pcbtools.eu/llms.txt
