PostgreSQL REST API
Open-source relational database with powerful SQL features
PostgreSQL is a powerful, open-source object-relational database system with over 35 years of active development. It provides robust ACID compliance, advanced data types, full-text search, and extensive indexing capabilities. Developers choose PostgreSQL for its reliability, data integrity, and support for complex queries, JSON operations, and geospatial data through PostGIS.
https://api.postgresql.rest/v1
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /databases | List all databases in the PostgreSQL instance, including system and user-created databases. |
| POST | /databases | Create a new database with specified configuration including encoding and owner. |
| DELETE | /databases/{database_name} | Drop a database permanently, requiring database_name in the path. Cannot be undone. |
| GET | /databases/{database_name}/tables | List all tables in a specific database, excluding system tables by default. |
| POST | /databases/{database_name}/tables | Create a new table with defined schema including columns, data types, and constraints. |
| GET | /databases/{database_name}/tables/{table_name}/schema | Get the schema definition for a specific table including columns, types, and constraints. |
| POST | /databases/{database_name}/query | Execute a SQL query and return results as an array of row objects with column names. |
| POST | /databases/{database_name}/tables/{table_name}/rows | Insert new rows into a table, accepting an array of row objects matching the table schema. |
| GET | /databases/{database_name}/tables/{table_name}/rows | Retrieve rows from a table with optional filtering using WHERE conditions and pagination. |
| PATCH | /databases/{database_name}/tables/{table_name}/rows/{row_id} | Update specific rows in a table by row_id, applying partial column updates. |
| DELETE | /databases/{database_name}/tables/{table_name}/rows/{row_id} | Delete rows from a table by row_id, permanently removing matching records. |
| GET | /databases/{database_name}/indexes | List all indexes in the database including index names, associated tables, and columns. |
| POST | /databases/{database_name}/indexes | Create a new index on specified columns, supporting B-tree, hash, and other index types. |
| GET | /databases/{database_name}/users | List database users and their permissions including roles and access privileges. |
| POST | /databases/{database_name}/backup | Create a backup of the database, returning a backup ID and storage location. |
Sponsor this page
AvailableReach developers actively building with PostgreSQL. See live pageview data and self-serve checkout — your slot goes live in minutes.
View inventory & pricing →Code Examples
curl -X POST https://api.postgresql.rest/v1/databases/myapp/query \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"query": "SELECT * FROM users WHERE created_at > $1 LIMIT 10",
"params": ["2024-01-01"]
}'
Use PostgreSQL from Claude / Cursor / ChatGPT
Get a hosted MCP endpoint for PostgreSQL. Paste your PostgreSQL API key, copy back one URL, drop it into Claude Desktop, Cursor, or any AI client that supports remote MCP. Your AI calls PostgreSQL directly with your credentials — no local install, works on mobile.
execute_sql_query
Execute arbitrary SQL queries against PostgreSQL databases with parameter binding and return structured results
get_table_schema
Retrieve complete table schema including columns, data types, constraints, and indexes for analysis and migration
analyze_query_performance
Run EXPLAIN ANALYZE on queries to get execution plans and performance metrics for optimization
manage_database_users
Create, modify, and manage PostgreSQL users with granular permissions and role-based access control
create_backup_restore
Generate database backups and restore from previous snapshots for disaster recovery and data protection
Connect in 60 seconds
Paste your PostgreSQL key → get an MCP URL → paste into Claude/Cursor. Hosted by IOX, encrypted at rest.
Connect PostgreSQL to your AI →