# Cross Stitch API
> Cross-stitch and counted-thread maths as an API, computed locally and deterministically — the design-size and floss numbers a stitcher plans a pattern with. The design endpoint turns a stitch count into a finished size on a given fabric count: design size = stitch count ÷ fabric count (stitches per inch), so a 140×98-stitch chart on 14-count Aida stitches up at 10×7 inches (25.4×17.8 cm); it adds the fabric to cut with a margin (≈3 inches each side for the hoop and finishing), reports the total stitches, and converts the same chart to another count — that 140×98 design shrinks to 7.8×5.4 inches on 18-count. The floss endpoint estimates the skeins of thread: skeins ≈ ceil(stitches ÷ stitches-per-skein), where about 1,200 full cross-stitches per skein is typical for two strands on 14-count, and it makes sure you buy at least one skein per colour. Everything is computed locally and deterministically, so it is instant and private. Ideal for cross-stitch, embroidery, needlework and craft-pattern app developers, pattern-and-kit and fabric tools, and needlework education. Pure local computation — no key, no third-party service, instant. Fabric count is stitches per inch; sizes in inches and centimetres. Live, nothing stored. 2 compute endpoints. Floss/skein figures are estimates — buy a little extra.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/crossstitch-api/..."
```

## Pricing
- **Free** (Free) — 5,850 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 55,500 calls/Mo, 6 req/s
- **Pro** ($10/Mo) — 236,000 calls/Mo, 15 req/s
- **Mega** ($33/Mo) — 1,335,000 calls/Mo, 40 req/s

## Endpoints

### CrossStitch

#### `GET /v1/design` — Design size & fabric

**Parameters:**
- `stitch_width` (query, required, string) — Stitches across Example: `140`
- `stitch_height` (query, required, string) — Stitches down Example: `98`
- `fabric_count` (query, required, string) — Fabric count (stitches/inch) Example: `14`
- `margin` (query, optional, string) — Margin each side (in, default 3) Example: `3`
- `convert_to_count` (query, optional, string) — Also convert to this count Example: `18`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/crossstitch-api/v1/design?stitch_width=140&stitch_height=98&fabric_count=14&margin=3&convert_to_count=18"
```

**Response:**
```json
{
    "data": {
        "note": "Design size = stitch count ÷ fabric count (stitches per inch). Add a margin (≈3\") each side for the hoop and finishing. A higher count makes a smaller, finer piece.",
        "inputs": {
            "margin": 3,
            "fabric_count": 14,
            "stitch_width": 140,
            "stitch_height": 98
        },
        "converted": {
            "fabric_count": 18,
            "design_width_inches": 7.7778,
            "design_height_inches": 5.4444
        },
        "total_stitches": 13720,
        "design_width_cm": 25.4,
        "fabric_width_cm": 40.64,
        "design_height_cm": 17.78,
        "fabric_height_cm": 33.02,
        "design_width_inches": 10,
        "fabric_width_inches": 16,
        "design_height_inches": 7,
        "fabric_height_inches": 13
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:09.146Z",
        "request_id": "0b08efc5-c3b6-43b2-a409-ec2c783cf507"
    },
    "status": "ok",
    "message": "Design size",
    "success": true
}
```

#### `GET /v1/floss` — Floss / skein estimate

**Parameters:**
- `stitches` (query, required, string) — Total stitches Example: `5000`
- `stitches_per_skein` (query, optional, string) — Stitches per skein (default 1200)
- `colors` (query, optional, string) — Number of colours Example: `8`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/crossstitch-api/v1/floss?stitches=5000&colors=8"
```

**Response:**
```json
{
    "data": {
        "note": "Skeins ≈ ceil(stitches ÷ stitches-per-skein); ~1,200 stitches/skein is typical for 2 strands on 14-count (more on finer counts). Buy at least one skein per colour — partial colours still need a whole skein.",
        "inputs": {
            "colors": 8,
            "stitches": 5000,
            "stitches_per_skein": 1200
        },
        "skeins_to_buy": 8,
        "skeins_by_thread": 5
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:09.238Z",
        "request_id": "12f5977b-d6ba-42aa-bc8b-fd2c493a5e0e"
    },
    "status": "ok",
    "message": "Floss estimate",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/crossstitch-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "notes": "Fabric count is stitches per inch (14/16/18 Aida; for evenweave stitched over 2, halve the thread count). Add ~3\" margin each side. Floss/skein counts are estimates — buy a little extra.",
        "service": "crossstitch-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/floss": "Skeins of floss to buy from the stitch count (and colour count).",
            "GET /v1/design": "Stitched size, fabric to buy and a count conversion from the stitch count and fabric count."
        },
        "description": "Cross-stitch maths: design size on a fabric count, fabric needed with margin, count conversion and floss/skein estimating."
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:09.302Z",
        "request_id": "8821249b-6295-46ac-9552-aa0fc355aa95"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/crossstitch-api
OpenAPI spec: https://www.oanor.com/api/crossstitch-api/openapi.json
