Sessions
Create and manage isolated database sessions.
Create session
Creates a new isolated session. All mutations within this session are staged in shadow tables until approved.
POST /sessionsRequest
curl -X POST http://localhost:8080/sessions \
-H "Content-Type: application/json" \
-d '{
"project_id": "my-project"
}'Response
{
"session_id": "sess_abc123def456",
"project_id": "my-project",
"status": "active",
"created_at": "2024-01-15T10:30:00Z"
}Request body
| project_id | string | Project identifier for grouping sessions |
| metadata | object | Optional key-value metadata |
Get session
Retrieve details about an existing session including its status and mutation count.
GET /sessions/:idResponse
{
"session_id": "sess_abc123def456",
"project_id": "my-project",
"status": "active",
"mutation_count": 3,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z"
}Session statuses
| active | Session is open for mutations |
| proposed | Submitted for review, read-only |
| approved | Changes applied to production |
| rejected | Changes discarded |
Delete session
Destroy a session and discard all staged changes. Only works for active or proposed sessions.
DELETE /sessions/:idResponse
{
"session_id": "sess_abc123def456",
"status": "deleted",
"deleted_at": "2024-01-15T10:40:00Z"
}Connect via Postgres
Use the session ID to route your Postgres connection through the proxy. All queries will be isolated to your session.
psql
psql "host=localhost port=5433 dbname=mydb \
options='-c astapa_session=sess_abc123def456'"Connection string
postgresql://user:pass@localhost:5433/mydb?options=-c%20astapa_session%3Dsess_abc123def456