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 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.
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. |
handle | string Example: handle=3833821-1721812114261 The shape handle 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 |
replica | string Enum: "default" "all" Modifies the data sent in update and delete change messages. When When set to Note that insert operations always include the full row, in either mode. |
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
.
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. |
handle | string Example: handle=3833821-1721812114261 Optional, deletes the current shape if it matches the |
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"