> For the complete documentation index, see [llms.txt](https://docs.prestd.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.prestd.com/api-reference.md). Agents can also search and read this documentation through its [MCP server](https://docs.prestd.com/~gitbook/mcp).

# API Reference

pREST API reference — REST (Representational State Transfer) HTTP endpoints that map to SQL on the native PostgreSQL adapter (and certified engines).

**pREST** generates HTTP APIs from your database catalog. Today the **native** dialect is PostgreSQL (and Postgres-compatible engines documented under [Databases](https://docs.prestd.com/databases.md)). This reference covers endpoints, parameters, auth, and advanced query patterns.

## What is REST?

**REST (Representational State Transfer)** is an [architectural style](https://developer.mozilla.org/en-US/docs/Glossary/REST) for building APIs over HTTP. pREST exposes your SQL tables as REST resources at `/{database}/{schema}/{table}`, mapping standard verbs to CRUD on the same server as MCP.

Application backends, mobile and web clients, and any HTTP client that needs CRUD on SQL tables use that surface. This reference documents the endpoints below; see also [Parameters](https://docs.prestd.com/api-reference/parameters.md) and [Auth](https://docs.prestd.com/api-reference/auth.md).

***prestd*** implements HTTP verbs that map to SQL data operations on the connected engine.

### GET

> SQL `SELECT` (PostgreSQL dialect mapping)

| Endpoints                           | Description                                                                                                                                                                                     |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/_health`                          | Liveness probe — pings default database                                                                                                                                                         |
| `/_ready`                           | Readiness probe — pings default database and all registered aliases                                                                                                                             |
| `/_mcp`                             | MCP discovery — server metadata and available read-only tools ([guide](https://docs.prestd.com/get-started/mcp-over-http.md), [stdio adapter](https://docs.prestd.com/ai/install-prest-mcp.md)) |
| `/databases`                        | List served databases (registry aliases, or `pg.database` + `pg.allowed_databases`)                                                                                                             |
| `/schemas`                          | List all schemas                                                                                                                                                                                |
| `/tables`                           | List all tables                                                                                                                                                                                 |
| `/show/{DATABASE}/{SCHEMA}/{TABLE}` | Lists table structure - all fields contained in the table                                                                                                                                       |
| `/{DATABASE}/{SCHEMA}`              | Lists table tables - find by schema                                                                                                                                                             |
| `/{DATABASE}/{SCHEMA}/{TABLE}`      | List all rows, find by database, schema and table                                                                                                                                               |
| `/{DATABASE}/{SCHEMA}/{VIEW}`       | List all rows, find by database, schema and view                                                                                                                                                |

With `auth.enabled = true`, the catalog routes (`/databases`, `/schemas`, `/tables`, `/{DATABASE}/{SCHEMA}`) and `/show/...` require a bearer token and follow table ACL, like CRUD (v2.5.2). pREST's own `prest_users` and `prest_queries` tables are never served. See [Auth — Routes that require auth](https://docs.prestd.com/api-reference/auth.md#routes-that-require-auth-v252) and [Permissions — Reserved tables](https://docs.prestd.com/get-started/permissions.md#reserved-tables-v252).

### POST

| Endpoints | Description                                                                                                                                                                               |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/_mcp`   | MCP JSON-RPC — `initialize`, `tools/list`, `tools/call` ([guide](https://docs.prestd.com/get-started/mcp-over-http.md), [stdio adapter](https://docs.prestd.com/ai/install-prest-mcp.md)) |

> SQL `INSERT` (PostgreSQL dialect mapping)

```
/{DATABASE}/{SCHEMA}/{TABLE}
```

**JSON DATA:**

```
{
    "FIELD1": "string value",
    "FIELD2": 1234567890
}
```

With `[access] restrict = true`, the body may set only the columns in the table's `fields`, and the response shows only the columns you may read (v2.5.3). See [Permissions — Column permissions](https://docs.prestd.com/get-started/permissions.md#column-permissions-fields).

### PATCH and PUT

> SQL `UPDATE` (PostgreSQL dialect mapping)

Using query string to make filter (WHERE), example:

```
/{DATABASE}/{SCHEMA}/{TABLE}?{FIELD NAME}={VALUE}
```

JSON DATA:

```
{
    "FIELD1": "string value",
    "FIELD2": 1234567890,
    "ARRAYFIELD": ["value 1","value 2"]
}
```

From v2.5.3, a `PUT` or `PATCH` with no filter is **400** `refusing PATCH without a WHERE condition: add a filter query parameter`, because it would update every row. See [Permissions — Unscoped writes](https://docs.prestd.com/get-started/permissions.md#unscoped-writes-v253).

### DELETE

> SQL `DELETE` (PostgreSQL dialect mapping)

Using query string to make filter (WHERE), example:

```
/{DATABASE}/{SCHEMA}/{TABLE}?{FIELD NAME}={VALUE}
```

From v2.5.3, a `DELETE` with no filter is **400** `refusing DELETE without a WHERE condition: add a filter query parameter`, because it would delete every row. Set `[access] allow_unscoped_writes = true` to allow it. See [Permissions — Unscoped writes](https://docs.prestd.com/get-started/permissions.md#unscoped-writes-v253).

### Related

* [Databases](https://docs.prestd.com/databases.md)
* [Acronyms](https://docs.prestd.com/readme/acronyms.md) ([REST](https://docs.prestd.com/readme/acronyms.md#rest), [MCP](https://docs.prestd.com/readme/acronyms.md#mcp))
* [Parameters](https://docs.prestd.com/api-reference/parameters.md)
* [MCP over HTTP](https://docs.prestd.com/get-started/mcp-over-http.md)
* [Auth](https://docs.prestd.com/api-reference/auth.md)
* [Permissions](https://docs.prestd.com/get-started/permissions.md)
