# TOML API
> Convert and validate TOML — the config format behind Cargo.toml, pyproject.toml, Netlify and many tools. Turn TOML into JSON, turn JSON back into clean spec-compliant TOML 1.0, and validate any TOML with a precise error message (line and column) when it is malformed. Tables, arrays of tables, inline tables, typed values and datetimes are all handled. Input via the query string or the request body (up to 4 MB). Pure local processing — no key, no third-party service, instant. Live. 4 endpoints. Completes the oanor config-format family alongside the JSON, YAML, XML and CSV APIs — built for build tooling, config editors, CI and data pipelines.

## 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/toml-api/..."
```

## Pricing
- **Free** (Free) — 1,480 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 27,000 calls/Mo, 8 req/s
- **Pro** ($26/Mo) — 180,000 calls/Mo, 20 req/s
- **Mega** ($62/Mo) — 920,000 calls/Mo, 50 req/s

## Endpoints

### Convert

#### `GET /v1/to-json` — TOML to JSON

**Parameters:**
- `toml` (query, required, string) — TOML text Example: `title = "oanor"
[owner]
name = "Ada"`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/toml-api/v1/to-json?toml=title+%3D+%22oanor%22%0A%5Bowner%5D%0Aname+%3D+%22Ada%22"
```

**Response:**
```json
{
    "data": {
        "json": {
            "owner": {
                "name": "Ada"
            },
            "title": "oanor"
        }
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:58.710Z",
        "request_id": "fbeb8f15-ebd2-46b9-a392-02301ae4d8ef"
    },
    "status": "ok",
    "message": "TOML to JSON",
    "success": true
}
```

#### `GET /v1/to-toml` — JSON to TOML

**Parameters:**
- `json` (query, required, string) — JSON object Example: `{"title":"oanor","owner":{"name":"Ada"}}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/toml-api/v1/to-toml?json=%7B%22title%22%3A%22oanor%22%2C%22owner%22%3A%7B%22name%22%3A%22Ada%22%7D%7D"
```

**Response:**
```json
{
    "data": {
        "toml": "title = \"oanor\"\n\n[owner]\nname = \"Ada\"\n"
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:58.830Z",
        "request_id": "dd645240-0cbf-4d21-8339-488d8f6c93b6"
    },
    "status": "ok",
    "message": "JSON to TOML",
    "success": true
}
```

### Validate

#### `GET /v1/validate` — Validate TOML

**Parameters:**
- `toml` (query, required, string) — TOML text Example: `a = 1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/toml-api/v1/validate?toml=a+%3D+1"
```

**Response:**
```json
{
    "data": {
        "valid": true
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:58.972Z",
        "request_id": "54a61854-1265-4c07-9961-6a2068398200"
    },
    "status": "ok",
    "message": "Validate TOML",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "auth": "none upstream; this gateway requires x-api-key",
        "name": "TOML API",
        "note": "Convert TOML to JSON (/v1/to-json?toml=...), JSON to TOML (/v1/to-toml?json=...), and validate TOML (/v1/validate?toml=...). Spec-compliant TOML 1.0. Input via query string or request body (up to 4 MB). Instant, nothing stored. Completes the config-format family (JSON, YAML, XML, CSV, TOML).",
        "source": "Local TOML processing (@iarna/toml) — no key, no upstream",
        "endpoints": 4
    },
    "meta": {
        "timestamp": "2026-06-02T16:51:59.074Z",
        "request_id": "45d809f3-bb4e-48f6-914c-84673adc5ebf"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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