> ## Documentation Index
> Fetch the complete documentation index at: https://exegia.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Upload, convert, and query corpora over REST

## Upload and convert a corpus

Send a `multipart/form-data` request with the corpus archive and its metadata:

```bash theme={null}
curl -X POST http://localhost:54321/functions/v1/convert-corpus \
  -F "file=@corpus.zip" \
  -F "name=my-corpus" \
  -F "type=bible" \
  -F "language=hebrew" \
  -F "period=Biblical" \
  -F "repository=https://github.com/..." \
  -F "category=biblical"
```

The request returns immediately while conversion continues in the background:

```json theme={null}
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "processing"
}
```

## Query corpora

```bash theme={null}
# Get all corpora
curl http://localhost:54321/rest/v1/corpora \
  -H "apikey: YOUR_ANON_KEY"

# Filter by language
curl "http://localhost:54321/rest/v1/corpora?language=eq.hebrew" \
  -H "apikey: YOUR_ANON_KEY"
```

<Tip>
  The REST API is standard PostgREST — any PostgREST filter syntax (`eq.`, `ilike.`, `in.`, ordering, pagination) works on the `corpora` table.
</Tip>

## Download a converted corpus

Converted `.exg` files are publicly readable from Storage:

```text theme={null}
/storage/v1/object/public/corpora/datasets/{name}.exg
```
