Posts Resource Documentation

Read operations merge shared global posts with your session's overlay (newly created posts appear at the top, updates apply in-place, deletes are filtered). Each post belongs to a user (`user_id` foreign key). Mutations are session-scoped and capped at 30 created records.

GET /posts

Retrieve a paginated list of posts. Results merge shared global posts with session sandbox overlays (newly created posts appear at the top).

Request Parameters
Name Type Location Description
page integer query Page number (1-indexed, default 1).
limit integer query Number of records per page (default 10, max 30).
curl -X GET 'http://localhost:3000/posts' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid"

Response Schema Example

{
  "data": [
    {
      "id": "local-b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "user_id": 1,
      "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
      "_sandbox": "created"
    },
    {
      "id": 1,
      "user_id": 1,
      "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
      "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 101,
    "totalPages": 11,
    "hasNextPage": true,
    "hasPrevPage": false
  }
}
⚡ Try it out — Test endpoint live Run fetch
GET /posts/:id

Retrieve a single post by ID. Supports plain integer IDs for global records (e.g. 1) and string IDs formatted as local-<uuid> for session sandbox records.

Request Parameters
Name Type Location Description
id string | integer path Post ID (e.g. 1 for global post or local-<uuid> for sandbox post).
curl -X GET 'http://localhost:3000/posts/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid"

Response Schema Example

{
  "id": 1,
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}
⚡ Try it out — Test endpoint live Run fetch
POST /posts

Create a new session sandbox post record. Returns a local-<uuid> formatted ID with _sandbox: 'created'. Each session identity is capped at 30 created records.

Request Parameters
Name Type Location Description
user_id integer body Author user ID.
title string body Post title.
body string body Post body text content.
curl -X POST 'http://localhost:3000/posts' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid" \
  -d '{
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}'

Request Payload Example

{
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}

Response Schema Example

{
  "id": "local-b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto",
  "_sandbox": "created"
}
⚡ Try it out — Test endpoint live Run fetch
PUT /posts/:id

Replace an existing post record in the session overlay. Global records remain untouched for other visitors and preserve original list position.

Request Parameters
Name Type Location Description
id string | integer path Post ID to update (e.g. 1 or local-<uuid>).
curl -X PUT 'http://localhost:3000/posts/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid" \
  -d '{
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}'

Request Payload Example

{
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}

Response Schema Example

{
  "id": 1,
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto",
  "_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
PATCH /posts/:id

Partially update specific fields of a post record in the session overlay.

Request Parameters
Name Type Location Description
id string | integer path Post ID to patch (e.g. 1 or local-<uuid>).
curl -X PATCH 'http://localhost:3000/posts/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid" \
  -d '{
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)"
}'

Request Payload Example

{
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)"
}

Response Schema Example

{
  "id": 1,
  "user_id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit (Updated)",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto",
  "_sandbox": "updated"
}
⚡ Try it out — Test endpoint live Run fetch
DELETE /posts/:id

Remove a post record from the requesting session view. The underlying global record is unaffected for other visitors.

Request Parameters
Name Type Location Description
id string | integer path Post ID to delete (e.g. 1 or local-<uuid>).
curl -X DELETE 'http://localhost:3000/posts/:id' \
  -H 'Content-Type: application/json' \
  -b "pg_identity=your_cookie_uuid"

Response Schema Example

204 No Content
⚡ Try it out — Test endpoint live Run fetch