# Linepo API v1 foundation

Linepo exposes a read-only database API for published language knowledge. The MVP database is empty of published language profiles and lexical entries, so queries currently return empty arrays. Draft and review records remain private.

## Base URL

`https://funybsquwsjsgjvoujye.supabase.co/rest/v1`

Use the Supabase **publishable** key in the `apikey` header. It is intended for public clients and is constrained by row-level security. Never use a service-role key in browser or mobile code.

## Endpoints

| Resource | Path | Purpose |
| --- | --- | --- |
| Language profiles | `/languages?select=slug,name,autonym,description,regions&profile_status=eq.published` | Published atlas profiles |
| Dictionary entries | `/lexical_entries?select=id,headword,normalized_headword,pronunciation_ipa,part_of_speech,languages(name,slug),entry_senses(*)&status=eq.published` | Published headwords and senses |
| Domains | `/domains?select=id,label,description,icon&is_active=eq.true` | Active subject areas |
| Health assessments | `/language_health_assessments?select=*&status=eq.published` | Sourced assessments only |

## Request example

```sh
curl 'https://funybsquwsjsgjvoujye.supabase.co/rest/v1/languages?select=slug,name,autonym,description,regions&profile_status=eq.published' \
  -H 'apikey: YOUR_SUPABASE_PUBLISHABLE_KEY' \
  -H 'Accept: application/json'
```

The current API is the database REST surface. A stable `/api/v1` facade should be introduced when response envelopes, pagination, search semantics, and deprecation policy have been agreed with initial integrators. The facade should preserve source attribution and review metadata, keep writes out of public API scopes, and publish documented rate limits.

## Publication and knowledge rights

- Only reviewed, published records are returned publicly.
- Each entry should carry source and editorial history.
- Media requires rights clearance; cultural access can be public, community-only, or restricted.
- Health assessments require methodology, date, confidence and limitations.
- Public read access does not grant reuse rights to source material or media; check each record's licence.

## Offline delivery

The current app shell is cacheable after first visit. Once records exist, publish small, versioned JSON packs by language and domain, with an explicit update date and licence metadata. Do not cache restricted media or drafts. Let people choose packs before download and show storage size.
