Download OpenAPI specification:Download
HTTP API to sync partial replicas of your Postgres data into local apps and services.
See the Electric documentation for more information.
Load the initial data for a shape and poll for real-time updates.
Define your shape using the root_table
and where
parameters.
Use offset
to fetch data from a specific position in the shape
log and the live
parameter to consume real-time updates.
root_table required | string Examples:
Root table of the shape. Must match a table in your Postgres database. Can be just a tablename, or can be prefixed by the database schema
using a |
database_id | string The ID of the database to sync from. This is required only if Electric manages several databases. |
offset required | string Examples:
The offset in the shape stream. This is like a cursor that specifies the position in the shape log to request data from. When making an initial request to sync a shape from scratch, you
must set the Note that when |
live | boolean Whether to wait for live updates or not. When the Once you're up-to-date, you should set the This allows you to implement a long-polling strategy to consume real-time updates. |
cursor | string This is a cursor generated by the server during live requests. It helps bust caches for responses from previous long-polls. |
shape_id | string Example: shape_id=3833821-1721812114261 The shape ID returned by the initial shape request. This is a required parameter when this is not an initial sync request.
I.e. when offset is not |
where | string Examples:
Optional where clause to filter rows in the This should be a valid PostgreSQL WHERE clause using SQL syntax. |
columns | string Examples:
Optional list of columns to include in the rows from the They should always include the primary key columns, and should be formed as a comma separated list of column names exactly as they are in the database schema. If the identifier was defined as case sensitive and/or with special characters, then |
If-None-Match | string Re-validate the shape if the etag doesn't match. |
[- {
- "headers": {
- "operation": "insert"
}, - "offset": 0,
- "key": "issue-1",
- "value": {
- "id": "issue-1",
- "title": "Electric",
- "status": "backlog"
}
}, - {
- "headers": {
- "operation": "insert",
- "control": "up-to-date"
}, - "offset": 19340,
- "key": "issue-2",
- "value": {
- "id": "issue-2",
- "title": "Hello",
- "status": "backlog"
}
}
]
Deletes the shape from the Electric sync engine.
This clears the shape log and forces any clients requesting the shape to create a new shape and resync from scratch.
NOTE Delete shape only works if Electric is configured to allow_shape_deletion
.
root_table required | string Examples:
The name of the table for which to delete the shape. Can be qualified by the schema name. |
database_id | string The ID of the database from which to delete the shape. This is required only if Electric manages several databases. |
shape_id | string Example: shape_id=3833821-1721812114261 Optional, deletes the current shape if it matches the shape_id. If not provided, deletes the current shape. |
Adds a database to Electric.
DATABASE_URL required | string PostgreSQL connection URL for the database |
DATABASE_USE_IPV6 | boolean Default: false Whether to use IPv6 for database connections |
database_id required | string Unique identifier for the database (auto-generated UUID if not provided) |
{- "DATABASE_URL": "string",
- "DATABASE_USE_IPV6": false,
- "database_id": "string"
}
"string"