# Data

> Your tables as an API, protected by row-level security, plus SQL and migrations over HTTPS, on any Postgres.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://data.docs.sypnia.com/data/

For agents: Section index for data access in Sypnia Data: the Data API (/rest/v1, PostgREST-compatible filters, embedding, upsert, rpc), row-level security (SET LOCAL ROLE + request.jwt.claims, auth.uid()/auth.role()/auth.jwt()), the SQL endpoint (/sql/v1/query, migrations, schema), running on any Postgres 14+ (installed schemas and roles, privileges, manual install), the @sypnia/data package, and using any ORM.

Your data is in Postgres, in ordinary tables. The engine gives it three doors, and the same rules guard all three.

- [The Data API](/data/rest-api/): Every table and view as REST, filtered, sorted, paged and joined in the URL, compatible with PostgREST's syntax.
- [Row-level security](/data/row-level-security/): How each request runs as a database role with the caller's claims, the helper functions your policies use, and patterns for users, teams and machines.
- [SQL and migrations](/data/sql-and-migrations/): Run SQL over HTTPS, apply and track migrations, and read your schema as JSON, for servers, the console and agents.
- [Any Postgres](/data/any-postgres/): What the engine needs from a database, what it installs in it, and how to install it by hand when your database is locked down.
- [@sypnia/data, the package](/data/sdk/): One package for browsers, phones and servers: /client for auth and data, /server for secret keys, machines and direct Postgres, and the CLI.
- [Use any ORM](/data/any-orm/): Sypnia Data is plain Postgres. Use plain SQL, Prisma, Drizzle, Sypnorm or nothing at all, and mix them.

| Door                    | For                                           | Runs as                                     |
| ----------------------- | --------------------------------------------- | ------------------------------------------- |
| The Data API `/rest/v1` | apps, ORMs that use the API (Sypnorm), agents | the caller's role, under row-level security |
| SQL `/sql/v1`           | servers, the console, agents with `sql:*`     | `sypnia_admin`, the owner of your schemas   |
| A direct connection     | your servers, migrations tools, BI            | whatever user you connect as                |
