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 |
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. |
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. |
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.
WARNING Delete shape should only be used in development and 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. |
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. |