# Set Operations API
> Treat lists as sets. Compute the union, intersection, difference or symmetric difference of two lists; deduplicate a single list; and compare two lists to learn whether one is a subset of the other, whether they are equal as sets, whether they are disjoint and how many items they share. Items can be plain strings (comma- or newline-separated) or arbitrary JSON values, and an optional case-insensitive mode treats differently-cased strings as equal. Order is preserved (first occurrence wins). Perfect for data wrangling and reconciliation, tag and permission maths, deduplication, A/B list comparison and ETL. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 4 endpoints. Distinct from CSV/JSON toolkits — this is pure set logic.

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

## Pricing
- **Free** (Free) — 1,155 calls/Mo, 2 req/s
- **Starter** ($2/Mo) — 9,950 calls/Mo, 8 req/s
- **Pro** ($22/Mo) — 150,500 calls/Mo, 20 req/s
- **Mega** ($60/Mo) — 795,000 calls/Mo, 50 req/s

## Endpoints

### Set Ops

#### `GET /v1/compare` — Compare two lists

**Parameters:**
- `a` (query, required, string) — First list Example: `a,b`
- `b` (query, required, string) — Second list Example: `a,b,c`
- `case_insensitive` (query, optional, string) — true/false (default false)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/setops-api/v1/compare?a=a%2Cb&b=a%2Cb%2Cc"
```

**Response:**
```json
{
    "data": {
        "a_unique": 2,
        "b_unique": 3,
        "disjoint": false,
        "common_count": 2,
        "a_subset_of_b": true,
        "b_subset_of_a": false,
        "equal_as_sets": false
    },
    "meta": {
        "timestamp": "2026-06-03T01:09:39.772Z",
        "request_id": "947595b5-c19e-4119-9894-c3e39fd2fcdb"
    },
    "status": "ok",
    "message": "Compare two lists",
    "success": true
}
```

#### `GET /v1/dedupe` — Deduplicate a list

**Parameters:**
- `list` (query, required, string) — A list Example: `a,b,a,c,b`
- `case_insensitive` (query, optional, string) — true/false (default false)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/setops-api/v1/dedupe?list=a%2Cb%2Ca%2Cc%2Cb"
```

**Response:**
```json
{
    "data": {
        "result": [
            "a",
            "b",
            "c"
        ],
        "removed": 2,
        "input_count": 5,
        "unique_count": 3
    },
    "meta": {
        "timestamp": "2026-06-03T01:09:39.871Z",
        "request_id": "f3110614-3856-4f6b-b1fa-25dd104f784f"
    },
    "status": "ok",
    "message": "Deduplicate a list",
    "success": true
}
```

#### `GET /v1/operate` — Set operation on two lists

**Parameters:**
- `a` (query, required, string) — First list Example: `a,b,c`
- `b` (query, required, string) — Second list Example: `b,c,d`
- `operation` (query, required, string) — union|intersection|difference|symmetric_difference Example: `intersection`
- `case_insensitive` (query, optional, string) — true/false (default false)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/setops-api/v1/operate?a=a%2Cb%2Cc&b=b%2Cc%2Cd&operation=intersection"
```

**Response:**
```json
{
    "data": {
        "count": 2,
        "result": [
            "b",
            "c"
        ],
        "operation": "intersection"
    },
    "meta": {
        "timestamp": "2026-06-03T01:09:39.966Z",
        "request_id": "76e6aee6-5a04-4de6-820f-878b2d1ade03"
    },
    "status": "ok",
    "message": "Set operation on two lists",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "name": "Set Operations API",
        "notes": "Lists may be a JSON array or a comma/newline-separated list. Order is preserved (first occurrence wins). Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/operate",
                "params": {
                    "a": "list (required)",
                    "b": "list (required)",
                    "operation": "union|intersection|difference|symmetric_difference",
                    "case_insensitive": "true/false"
                },
                "returns": "the resulting list"
            },
            {
                "path": "/v1/dedupe",
                "params": {
                    "list": "a list (required)",
                    "case_insensitive": "true/false"
                },
                "returns": "the list with duplicates removed"
            },
            {
                "path": "/v1/compare",
                "params": {
                    "a": "list (required)",
                    "b": "list (required)"
                },
                "returns": "subset / equality / disjoint / overlap info"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Treat lists as sets: union, intersection, difference and symmetric difference of two lists, deduplicate a single list, and compare two lis
…(truncated, see openapi.json for full schema)
```


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