# ScrewTube

> ScrewTube generates genuine parametric CAD for standard fasteners (screws, nuts, washers, set screws):
> pick a family and a standard size or design from scratch, validate, preview (GLB) and export STEP/STL/3MF.

- Every dimension is in millimetres (mm; angles in degrees).
- Standards datasets are **draft** unless marked verified. ScrewTube never claims compliance:
  `compliance` is `draft_data` or `none` for drafts and customized designs.
- Parts are generated on demand from parameters; STEP comes from the B-rep kernel, never from a mesh.

## Access
- Get a personal access token in the web app: Profile -> Access tokens. Tokens expire after at most 365 days.
- Send it as `Authorization: Bearer st_pat_...`.
- Scopes: `catalogue:read` (standards, fasteners, validate), `designs:read`, `designs:write`, `cad:run` (jobs, files).

## Endpoints
- OpenAPI (REST, stable operation ids): https://screwtube.xydirect.com/api/v1/openapi.json
- MCP (Streamable HTTP, Bearer token): https://screwtube.xydirect.com/mcp
- Docs: https://screwtube.xydirect.com/api/v1/docs

## Limits (per token)
- 300 requests/min; anonymous 60/min per IP.
- Previews 60/min; exports 20/min and 300/day.
- At most 2 jobs queued or running at once.
- Responses carry `RateLimit-*` headers; a 429 carries `Retry-After`. Jobs run for at most 120 s.
- `POST /cad/jobs` and `POST /designs` accept `Idempotency-Key`.

## Minimal session
```sh
T=st_pat_...   # your token
A="Authorization: Bearer $T"
Q="standard=iso4762&size=M8&length=30"
curl -s -H "$A" "https://screwtube.xydirect.com/api/v1/fasteners/socket_head_cap_screw/defaults?$Q" > params.json
curl -s -H "$A" -H 'Content-Type: application/json' \
  -d "{\"params\": $(cat params.json), \"purpose\": \"export\", \"formats\": [\"step\"]}" \
  https://screwtube.xydirect.com/api/v1/cad/jobs
curl -s -H "$A" "https://screwtube.xydirect.com/api/v1/cad/jobs/<job_id>?wait=30"
curl -s -H "$A" "https://screwtube.xydirect.com/api/v1/cad/jobs/<job_id>/files/step/link"   # signed URL, 15 min
```
