{
  "openapi": "3.0.3",
  "info": {
    "title": "ReqRes API",
    "description": "OpenAPI specification for the ReqRes API. Covers legacy demo endpoints, collections, app-user auth flows, custom endpoints, and the Agent Sandbox (/agent/v1/*) for AI coding agents. All /api/* endpoints require x-api-key. All /app/* endpoints require Authorization: Bearer <session_token>. /agent/v1/* endpoints work without auth (100 req/day per IP); send x-agent-id (agt_ key) for Agent Developer limits. 3 of 15 failure scenarios are free; the rest return 403 scenario_requires_upgrade without a paid key. World v1.1.0: every /agent/v1/* response carries an X-World-Version header, and responses are byte-deterministic - same seed, same path, same world version means identical bytes (deterministic X-Request-ID, nonce-free cursors, timestamps anchored to a fixed clock). Only /health reports live uptime/rate-limit state.",
    "version": "2.1.0",
    "contact": {
      "name": "ReqRes Support",
      "url": "https://reqres.in",
      "email": "hello@reqres.in"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://reqres.in",
      "description": "Production server"
    }
  ],
  "tags": [
    {
      "name": "Getting started",
      "description": "Start here: create a working project with no account."
    },
    {
      "name": "Legacy"
    },
    {
      "name": "Authentication"
    },
    {
      "name": "Collections"
    },
    {
      "name": "App Users"
    },
    {
      "name": "Custom Endpoints"
    },
    {
      "name": "Agent Sandbox",
      "description": "Endpoints designed for AI coding agents. Cursor pagination, deeply nested resources, deliberate error scenarios, deterministic seeded fixtures."
    }
  ],
  "paths": {
    "/api/projects/sandbox": {
      "post": {
        "summary": "Create a sandbox project (no signup)",
        "description": "Creates a real hosted project with no account, API key or body. Returns a manage key (pro_*, server-side, read and write), a public key (pub_*, read-only, browser-safe), a starter \"products\" collection and a claim_url. Unclaimed projects are deleted after 72 hours: give the user the claim_url so they can keep it for free. Free limits: 250 requests a day, 3 collections, 100 records. 5 sandbox projects per IP per day. Next: POST /api/collections to add collections, POST /api/app-users then POST /api/app-users/{id}/sessions/simulate for per-user data without email.",
        "operationId": "createSandboxProject",
        "tags": ["Getting started"],
        "security": [],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sandbox project created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "project": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "keys": {
                      "type": "object",
                      "description": "manage (pro_*) and public (pub_*) keys",
                      "additionalProperties": true
                    },
                    "starter_collection": {
                      "type": "string",
                      "example": "products"
                    },
                    "base_url": {
                      "type": "string",
                      "example": "https://reqres.in"
                    },
                    "claim_url": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "limits": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "next_steps": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "project": {
                    "id": 57803,
                    "slug": "sandbox-k3x9"
                  },
                  "keys": {
                    "manage": "pro_3f9c...",
                    "public": "pub_8a1d..."
                  },
                  "base_url": "https://reqres.in",
                  "starter_collection": "products",
                  "limits": {
                    "requests_per_day": 250,
                    "collections": 3,
                    "records": 100
                  },
                  "expires_at": "2026-11-11T17:06:47.732Z",
                  "claim_url": "https://app.reqres.in/claim/2031e23a...",
                  "next_steps": [
                    "Send the manage key as x-api-key for writes (keep it server-side); the public key is read-only and browser-safe."
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Daily cap of 5 sandbox projects per IP reached. Resets at 00:00 UTC.",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the cap resets",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "error": "sandbox_limit_reached",
                  "message": "Limit of 5 sandbox projects per day from this IP. Resets at 00:00 UTC (in about 7 hours). Meanwhile: reuse a project you already created (its keys work for 72 hours), use the keyless demo API (GET https://reqres.in/api/users), or sign up free at https://app.reqres.in.",
                  "reset_at": "2026-11-09T00:00:00.000Z"
                }
              }
            }
          }
        }
      }
    },
    "/api/users": {
      "get": {
        "summary": "List users (legacy)",
        "description": "Retrieve a paginated list of demo users. Supports page/per_page query params.",
        "operationId": "getLegacyUsers",
        "tags": ["Legacy"],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "Page number for pagination.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "Number of users per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyUserListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      },
      "post": {
        "summary": "Create user (legacy)",
        "description": "Creates a demo user. Returns the request payload plus id/createdAt fields.",
        "operationId": "createLegacyUser",
        "tags": ["Legacy"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LegacyMutationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "User created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyMutationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/users/{id}": {
      "get": {
        "summary": "Get user by id (legacy)",
        "description": "Retrieve a single demo user by id.",
        "operationId": "getLegacyUserById",
        "tags": ["Legacy"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "User id.",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyUserResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      },
      "put": {
        "summary": "Update user (legacy)",
        "description": "Updates a demo user. Returns the request payload plus updatedAt field.",
        "operationId": "updateLegacyUser",
        "tags": ["Legacy"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "User id.",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LegacyMutationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "User updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyMutationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      },
      "patch": {
        "summary": "Patch user (legacy)",
        "description": "Partially updates a demo user. Returns the request payload plus updatedAt field.",
        "operationId": "patchLegacyUser",
        "tags": ["Legacy"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "User id.",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LegacyMutationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "User updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyMutationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      },
      "delete": {
        "summary": "Delete user (legacy)",
        "description": "Deletes a demo user and returns no content.",
        "operationId": "deleteLegacyUser",
        "tags": ["Legacy"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "User id.",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/unknown": {
      "get": {
        "summary": "List resources (legacy)",
        "description": "Retrieve a paginated list of the demo \"unknown\" resource.",
        "operationId": "getLegacyUnknown",
        "tags": ["Legacy"],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "Page number for pagination.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "Number of items per page.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyUnknownListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/unknown/{id}": {
      "get": {
        "summary": "Get resource by id (legacy)",
        "description": "Retrieve a single demo resource by id.",
        "operationId": "getLegacyUnknownById",
        "tags": ["Legacy"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Resource id.",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyUnknownResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/register": {
      "post": {
        "summary": "Register user",
        "description": "Register a demo user account.",
        "operationId": "registerUser",
        "tags": ["Authentication"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful registration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegisterResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/login": {
      "post": {
        "summary": "Login user",
        "description": "Authenticate a demo user and return a token.",
        "operationId": "loginUser",
        "tags": ["Authentication"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful login",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/logout": {
      "post": {
        "summary": "Logout user",
        "description": "Legacy logout endpoint (returns empty object).",
        "operationId": "logoutUser",
        "tags": ["Authentication"],
        "responses": {
          "200": {
            "description": "Logged out",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/collections": {
      "get": {
        "summary": "List collections",
        "description": "List collections for the current project/environment.",
        "operationId": "listCollections",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Collections list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create collection",
        "description": "Create a new collection.",
        "operationId": "createCollection",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Collection created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/collections/{slug}": {
      "get": {
        "summary": "Get collection",
        "description": "Fetch a collection by slug.",
        "operationId": "getCollection",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Collection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update collection",
        "description": "Update a collection by slug.",
        "operationId": "updateCollection",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Collection updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete collection",
        "description": "Delete a collection by slug.",
        "operationId": "deleteCollection",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/collections/{slug}/records": {
      "get": {
        "summary": "List records",
        "description": "List records for a collection with filters. Page with ?page= and ?limit= (max 100). Your fields are under each record's data.",
        "operationId": "listCollectionRecords",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size (max 100).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Case-insensitive search on record data.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "created_before",
            "in": "query",
            "description": "Filter records created before timestamp.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "description": "Filter records created after timestamp.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "data_contains",
            "in": "query",
            "description": "JSON string for containment filter.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "Sort order by created_at.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["asc", "desc"]
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Include soft-deleted records.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Record list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordListResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "6a1f2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b",
                      "collection_id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
                      "project_id": 57803,
                      "app_user_id": null,
                      "created_by": null,
                      "created_at": "2026-11-08T12:00:00.000Z",
                      "updated_at": "2026-11-08T12:00:00.000Z",
                      "deleted_at": null,
                      "data": {
                        "title": "Buy milk",
                        "completed": false
                      }
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "limit": 50,
                    "total": 1,
                    "pages": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create record",
        "description": "Create a new record in a collection.",
        "operationId": "createCollectionRecord",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionRecordCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Record created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/collections/{slug}/records/{recordId}": {
      "get": {
        "summary": "Get record",
        "description": "Fetch a record by id.",
        "operationId": "getCollectionRecord",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update record",
        "description": "Update a record by id. PUT replaces the record's data: fields you leave out are removed. Use PATCH to change some fields and keep the rest.",
        "operationId": "updateCollectionRecord",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionRecordUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Patch record",
        "description": "Shallow-merge the sent fields into the record's data: top-level fields you send are replaced, fields you leave out are kept. Body: {\"data\": {\"completed\": true}}. data must be an object.",
        "operationId": "patchCollectionRecord",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionRecordUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete record",
        "description": "Delete a record by id.",
        "operationId": "deleteCollectionRecord",
        "tags": ["Collections"],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/app-users/login": {
      "post": {
        "summary": "App user login",
        "description": "Create or log in an app user and send a magic link token.",
        "operationId": "appUserLogin",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppUserLoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Login initiated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserLoginResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/app-users/verify": {
      "post": {
        "summary": "Verify app user token",
        "description": "Verify a magic link token and return an app-session token. Needs no API key: the code identifies the project, so it is safe to call from the browser.",
        "operationId": "verifyAppUserToken",
        "tags": ["App Users"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppUserVerifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token verified",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserVerifyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/app-users/me": {
      "get": {
        "summary": "Current app user",
        "description": "Return the current app user based on session token.",
        "operationId": "getAppUserMe",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "App user session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserSessionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/app-users": {
      "get": {
        "summary": "List app users",
        "description": "List app users for the current project.",
        "operationId": "listAppUsers",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Max results (default 50).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "App users list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create app user",
        "description": "Create an app user in the project.",
        "operationId": "createAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppUserCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "App user created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/app-users/{id}": {
      "get": {
        "summary": "Get app user",
        "description": "Fetch an app user by id.",
        "operationId": "getAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "App user id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "App user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update app user",
        "description": "Update an app user by id.",
        "operationId": "updateAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "App user id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppUserUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "App user updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete app user",
        "description": "Delete an app user by id.",
        "operationId": "deleteAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "App user id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "App user deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/app-users/{id}/sessions/simulate": {
      "post": {
        "summary": "Simulate app user session",
        "description": "Owner-only (manage key) helper that mints a 6-hour app-user session token with no email. Use it to test per-user data: create a user with POST /api/app-users, call this, then send Authorization: Bearer <session_token> to /app/collections/{slug}/records. Real end users sign in with POST /api/app-users/login and /verify (emailed code).",
        "operationId": "simulateAppUserSession",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "App user id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session simulated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "data": {
                    "session_token": "9b1f0c...",
                    "expires_at": "2026-11-08T23:00:00.000Z",
                    "env": "prod",
                    "project_id": 57803,
                    "app_user": {
                      "id": "2f6c1e7a-5b0d-4c1a-9f3e-1d2c3b4a5e6f",
                      "email": "alice@example.com",
                      "status": "pending"
                    },
                    "note": "Simulated session minted by project owner. Use as Bearer to call /app/collections."
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/projects/{projectId}/app-users": {
      "get": {
        "summary": "List project app users",
        "description": "List app users for a project using API key auth.",
        "operationId": "listProjectAppUsers",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "projectId",
            "in": "path",
            "description": "Project id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "statuses",
            "in": "query",
            "description": "Filter by status (active, pending) or use \"all\".",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "App users list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/projects/{projectId}/app-users/total": {
      "get": {
        "summary": "App users total",
        "description": "Return total app user count for a project.",
        "operationId": "getProjectAppUserTotal",
        "tags": ["App Users"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-Reqres-Env",
            "in": "header",
            "description": "Environment key (for example: prod or dev).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "projectId",
            "in": "path",
            "description": "Project id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Total count",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserTotalResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/custom/{path}": {
      "get": {
        "summary": "Execute custom endpoint",
        "description": "Execute a custom endpoint with GET.",
        "operationId": "executeCustomEndpointGet",
        "tags": ["Custom Endpoints"],
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "description": "Custom endpoint path (supports nested segments).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Custom response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Execute custom endpoint",
        "description": "Execute a custom endpoint with POST.",
        "operationId": "executeCustomEndpointPost",
        "tags": ["Custom Endpoints"],
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "description": "Custom endpoint path (supports nested segments).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Custom response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Execute custom endpoint",
        "description": "Execute a custom endpoint with PUT.",
        "operationId": "executeCustomEndpointPut",
        "tags": ["Custom Endpoints"],
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "description": "Custom endpoint path (supports nested segments).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Custom response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Execute custom endpoint",
        "description": "Execute a custom endpoint with PATCH.",
        "operationId": "executeCustomEndpointPatch",
        "tags": ["Custom Endpoints"],
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "description": "Custom endpoint path (supports nested segments).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Custom response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Execute custom endpoint",
        "description": "Execute a custom endpoint with DELETE.",
        "operationId": "executeCustomEndpointDelete",
        "tags": ["Custom Endpoints"],
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "description": "Custom endpoint path (supports nested segments).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Custom response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/app/me": {
      "get": {
        "summary": "App user profile",
        "description": "Return app-user profile from a session token.",
        "operationId": "getAppSessionProfile",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "App user profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppUserSessionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/app/collections": {
      "get": {
        "summary": "List collections (app user)",
        "description": "List collections with an app-user session token.",
        "operationId": "listCollectionsAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Collections list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/app/collections/{slug}": {
      "get": {
        "summary": "Get collection (app user)",
        "description": "Fetch collection by slug with an app-user token.",
        "operationId": "getCollectionAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Collection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/app/collections/{slug}/records": {
      "get": {
        "summary": "List records (app user)",
        "description": "List records with an app-user token. Page with ?page= and ?limit= (max 100). Your fields are under each record's data.",
        "operationId": "listRecordsAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Records",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordListResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "6a1f2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b",
                      "collection_id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
                      "project_id": 57803,
                      "app_user_id": null,
                      "created_by": null,
                      "created_at": "2026-11-08T12:00:00.000Z",
                      "updated_at": "2026-11-08T12:00:00.000Z",
                      "deleted_at": null,
                      "data": {
                        "title": "Buy milk",
                        "completed": false
                      }
                    }
                  ],
                  "meta": {
                    "page": 1,
                    "limit": 50,
                    "total": 1,
                    "pages": 1
                  }
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create record (app user)",
        "description": "Create a record with an app-user token.",
        "operationId": "createRecordAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionRecordCreateRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Record created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/app/collections/{slug}/records/{recordId}": {
      "get": {
        "summary": "Get record (app user)",
        "description": "Fetch a record by id with an app-user token.",
        "operationId": "getRecordAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Update record (app user)",
        "description": "Update a record with an app-user token. PUT replaces the record's data: fields you leave out are removed. Use PATCH to change some fields and keep the rest.",
        "operationId": "updateRecordAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionRecordUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Patch record (app user)",
        "description": "Shallow-merge the sent fields into the record's data: top-level fields you send are replaced, fields you leave out are kept. Body: {\"data\": {\"completed\": true}}. data must be an object.",
        "operationId": "patchRecordAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionRecordUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionRecordResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete record (app user)",
        "description": "Delete a record with an app-user token.",
        "operationId": "deleteRecordAppUser",
        "tags": ["App Users"],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "description": "Collection slug.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "recordId",
            "in": "path",
            "description": "Record id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "404": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agent/v1/health": {
      "get": {
        "summary": "Agent Sandbox health probe",
        "description": "Lightweight health check that returns sandbox status, version, uptime, and the caller's current rate-limit status. Not cached (Cache-Control: no-store) so rate-limit numbers are always live. Cheap to poll. Send the optional x-agent-id header to elevate to Agent Developer tier limits.",
        "operationId": "agentHealth",
        "tags": ["Agent Sandbox"],
        "responses": {
          "200": {
            "description": "Healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentHealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agent/v1/users": {
      "get": {
        "summary": "List agent users (cursor pagination)",
        "description": "Paginated user list with realistic edge cases: nullable nested fields, sparse fieldsets, silent param clamping. Use meta.next_cursor for next page; never increment a page number.",
        "operationId": "agentListUsers",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor from previous response. Omit for first page."
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            },
            "description": "Page size (silently clamped at 100)."
          },
          {
            "name": "fields",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated sparse fieldset (e.g. id,email,full_name)."
          },
          {
            "name": "seed",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 42
            },
            "description": "Deterministic fixture seed."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated user list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUserListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agent/v1/users/{id}": {
      "get": {
        "summary": "Get a single agent user with optional expansion",
        "description": "Returns one user. Without ?expand=, nested resources (addresses, activity, organizations) are returned as references. With ?expand=addresses,activity, those resources are inlined.",
        "operationId": "agentGetUser",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^usr_[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$"
            },
            "description": "ULID with usr_ prefix."
          },
          {
            "name": "expand",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated: addresses, activity, organizations."
          }
        ],
        "responses": {
          "200": {
            "description": "User found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentUserDetailResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid ID format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/agent/v1/auth/login": {
      "post": {
        "summary": "Agent auth login (with MFA branch)",
        "description": "Returns a session for normal accounts or an MFA challenge for accounts with email matching '+mfa@'. Use '+wrong@' or '+locked@' suffixes to trigger 401 branches.",
        "operationId": "agentLogin",
        "tags": ["Agent Sandbox"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "password"],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session created or MFA challenge",
            "content": {
              "application/json": {}
            }
          },
          "400": {
            "description": "Missing fields"
          },
          "401": {
            "description": "Invalid credentials or account locked"
          },
          "422": {
            "description": "Validation error"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/agent/v1/auth/mfa/verify": {
      "post": {
        "summary": "Complete an MFA challenge",
        "description": "Second step for '+mfa@' accounts. Submit the challenge_token from the login response with the fixed test code '424242'. Any other 6-digit code returns 401 invalid_mfa_code with attempts_remaining. Deterministic: the same challenge_token always yields the same session token.",
        "operationId": "agentMfaVerify",
        "tags": ["Agent Sandbox"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["challenge_token", "code"],
                "properties": {
                  "challenge_token": {
                    "type": "string",
                    "description": "From the login response (starts with agt_mfa)"
                  },
                  "code": {
                    "type": "string",
                    "example": "424242",
                    "description": "Fixed test code. Anything else is rejected."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Session issued: { data: { session: { token, refresh_token, expires_at, expires_in, token_type, mfa_verified } } }",
            "content": {
              "application/json": {}
            }
          },
          "401": {
            "description": "Wrong code ({ error: 'invalid_mfa_code', attempts_remaining: 2 }) or unknown challenge_token"
          },
          "422": {
            "description": "challenge_token and code are required"
          }
        }
      }
    },
    "/agent/v1/orders": {
      "get": {
        "summary": "List agent orders (relational data)",
        "description": "Orders with relational references (customer, line items, products, addresses). Money is always {amount, currency, formatted}. Some line_items reference deleted products.",
        "operationId": "agentListOrders",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "shipped",
                "delivered",
                "refunded",
                "cancelled"
              ]
            }
          },
          {
            "name": "seed",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 42
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated order list",
            "content": {
              "application/json": {}
            }
          },
          "400": {
            "description": "Invalid status filter"
          }
        }
      }
    },
    "/sim/payments/v1/": {
      "get": {
        "summary": "Payments Sandbox discovery (B1-B3)",
        "description": "Simulated Stripe-shaped payments for agent practice - no real money, not affiliated with any provider. Resources: /customers (deterministic from seed), /payment_intents (+/confirm), /charges/{id}, /refunds, /events (poll feed). Lifecycle: requires_payment_method -> requires_confirmation -> (requires_action for pm_card_3ds_required) -> succeeded | failed; the fixed test token IS the outcome. Idempotency-Key enforced on POSTs (same key + same body replays with X-Idempotent-Replay; different body 409s). Per-caller state, 24h idle TTL. Same auth/rate limits/trajectory capture as /agent/v1.",
        "operationId": "simPaymentsDiscovery",
        "tags": ["Payments Sandbox"],
        "responses": {
          "200": {
            "description": "Catalog: test tokens, lifecycle, idempotency rules",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    },
    "/agent/v1/chains": {
      "get": {
        "summary": "List scenario chains (agent key required)",
        "description": "The 5 built-in presets plus your own definitions. Invoke any chain by sending X-Agent-Chain: <name> on any /agent/v1 endpoint: each call advances one step; 'ok' steps respond normally, scenario steps respond with that scenario. Position is server-side state with a 24h inactivity TTL. Behaviour is a pure function of (definition, call count).",
        "operationId": "agentListChains",
        "tags": ["Agent Sandbox"],
        "responses": {
          "200": {
            "description": "{ data: { presets[], custom[] } }",
            "content": {
              "application/json": {}
            }
          },
          "401": {
            "description": "No agent key"
          }
        }
      },
      "post": {
        "summary": "Create or update a chain definition",
        "description": "Steps reference scenario names (see /agent/v1/scenarios) plus 'ok' for a normal response. loop=true wraps past the end; loop=false holds the final step forever. scope 'per-run' keys position by X-Agent-Run-Id (falls back to per-key without one); 'per-key' shares position across all calls on the key.",
        "operationId": "agentCreateChain",
        "tags": ["Agent Sandbox"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name", "steps"],
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
                  },
                  "steps": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "example": ["ok", "ok", "rate-limited", "timeout", "ok"]
                  },
                  "loop": {
                    "type": "boolean",
                    "default": false
                  },
                  "scope": {
                    "type": "string",
                    "enum": ["per-run", "per-key"],
                    "default": "per-run"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Definition stored",
            "content": {
              "application/json": {}
            }
          },
          "401": {
            "description": "No agent key"
          },
          "422": {
            "description": "Validation failure with field_errors + valid_steps"
          }
        }
      }
    },
    "/agent/v1/chains/{name}": {
      "get": {
        "summary": "One chain definition",
        "operationId": "agentGetChain",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Definition",
            "content": {
              "application/json": {}
            }
          },
          "404": {
            "description": "Unknown chain"
          }
        }
      },
      "delete": {
        "summary": "Delete an own chain definition",
        "operationId": "agentDeleteChain",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "404": {
            "description": "Unknown chain"
          },
          "422": {
            "description": "Presets cannot be deleted"
          }
        }
      }
    },
    "/agent/v1/chains/{name}/state": {
      "delete": {
        "summary": "Reset chain position (A2.3)",
        "description": "Clears the caller's per-key position and, when X-Agent-Run-Id is sent, that run's position. The next call starts from step 0.",
        "operationId": "agentResetChainState",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{ data: { reset, run_id } }"
          },
          "404": {
            "description": "Unknown chain"
          }
        }
      }
    },
    "/agent/v1/trajectories": {
      "get": {
        "summary": "List trajectories (agent key required)",
        "description": "Every call made with an issued agent key is recorded; calls sharing an X-Agent-Run-Id header (or a rolling 30-minute activity window per key) form a trajectory. Newest first, cursor-paginated. Keyless free-tier traffic is never recorded. Live data - outside the byte-determinism guarantee.",
        "operationId": "agentListTrajectories",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Runs with { run_id, started_at, ended_at, calls, error_calls }",
            "content": {
              "application/json": {}
            }
          },
          "401": {
            "description": "No agent key: { error: 'agent_key_required' }"
          }
        }
      }
    },
    "/agent/v1/trajectories/demo": {
      "get": {
        "summary": "Keyless sample trajectory (a real Claude Code benchmark run)",
        "description": "Returns an unedited recorded trajectory: Claude Code surviving the rate-limit-storm chain (200, three 429s with full Retry-After waits, 200), plus a payments sample in meta. No key required. Cached 1h.",
        "operationId": "agentDemoTrajectory",
        "tags": ["Agent Sandbox"],
        "responses": {
          "200": {
            "description": "Sample trajectory",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    },
    "/agent/v1/trajectories/{run_id}": {
      "get": {
        "summary": "Full ordered call list for one trajectory",
        "description": "Each call: seq, ts, method, path, query, seed, world_version, scenario, chain_id, request_body_hash, status, response_body_hash, latency_ms. Capped at 1000 calls (meta.truncated).",
        "operationId": "agentGetTrajectory",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ordered calls",
            "content": {
              "application/json": {}
            }
          },
          "401": {
            "description": "No agent key"
          },
          "404": {
            "description": "Unknown run id"
          }
        }
      }
    },
    "/agent/v1/trajectories/{run_id}/export": {
      "get": {
        "summary": "Export a trajectory as JSONL",
        "description": "application/x-ndjson attachment, one call per line, ordered by seq. Feed to diff tooling or the agent-api-benchmark harness.",
        "operationId": "agentExportTrajectory",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "run_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSONL download"
          },
          "401": {
            "description": "No agent key"
          },
          "404": {
            "description": "Unknown run id"
          }
        }
      }
    },
    "/agent/v1/trajectories/{a}/diff/{b}": {
      "get": {
        "summary": "Diff two trajectories",
        "description": "Aligns both call lists by position and reports the first divergence index plus per-call deltas on path, status, and response body hash. Two runs at the same seed and world version should be identical; a diff shows exactly where an agent's behaviour changed.",
        "operationId": "agentDiffTrajectories",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "a",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "b",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{ identical, divergence_index, compared_calls, deltas[] }",
            "content": {
              "application/json": {}
            }
          },
          "401": {
            "description": "No agent key"
          },
          "404": {
            "description": "One or both trajectories not found"
          }
        }
      }
    },
    "/agent/v1/scenarios": {
      "get": {
        "summary": "List training scenarios",
        "description": "Returns the catalogue of available failure scenarios.",
        "operationId": "agentListScenarios",
        "tags": ["Agent Sandbox"],
        "responses": {
          "200": {
            "description": "Scenario list",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    },
    "/agent/v1/scenarios/{scenario}": {
      "get": {
        "summary": "Trigger a deliberate failure scenario",
        "description": "Returns a controlled failure for testing agent error handling. All responses include header X-Agent-Sandbox-Intentional: <scenario> so error reporters can suppress them. Available scenarios: rate-limited, server-error, bad-gateway, timeout, validation-error, unauthorized, forbidden, not-found, conflict, too-large, slow, partial-content, redirect-loop, malformed-json, empty-response.",
        "operationId": "agentScenario",
        "tags": ["Agent Sandbox"],
        "parameters": [
          {
            "name": "scenario",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Slow / partial-content / empty-response / malformed-json scenarios"
          },
          "206": {
            "description": "Partial content"
          },
          "302": {
            "description": "Redirect loop hop"
          },
          "401": {
            "description": "Unauthorized scenario"
          },
          "403": {
            "description": "Forbidden scenario"
          },
          "404": {
            "description": "Not-found scenario or unknown scenario name"
          },
          "409": {
            "description": "Conflict scenario"
          },
          "413": {
            "description": "Too-large scenario"
          },
          "422": {
            "description": "Validation-error scenario"
          },
          "429": {
            "description": "Rate-limited scenario"
          },
          "500": {
            "description": "Server-error scenario"
          },
          "502": {
            "description": "Bad-gateway scenario"
          },
          "504": {
            "description": "Timeout scenario (returns immediately, see X-Agent-Sandbox-Simulated-Delay header)"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "session_token"
      }
    },
    "schemas": {
      "AgentMoney": {
        "type": "object",
        "required": ["amount", "currency", "formatted"],
        "properties": {
          "amount": {
            "type": "integer",
            "description": "Value in smallest currency unit (cents for USD, pence for GBP)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 code, e.g. USD."
          },
          "formatted": {
            "type": "string",
            "description": "Human-readable display string with currency symbol."
          }
        }
      },
      "AgentPaginationMeta": {
        "type": "object",
        "required": [
          "limit",
          "returned",
          "next_cursor",
          "prev_cursor",
          "has_more",
          "total_estimate"
        ],
        "properties": {
          "limit": {
            "type": "integer"
          },
          "returned": {
            "type": "integer"
          },
          "next_cursor": {
            "type": ["string", "null"],
            "description": "Opaque cursor or null if at end."
          },
          "prev_cursor": {
            "type": ["string", "null"],
            "description": "Always null in v1 (forward-only pagination)."
          },
          "has_more": {
            "type": "boolean"
          },
          "total_estimate": {
            "type": "integer"
          }
        }
      },
      "AgentErrorResponse": {
        "type": "object",
        "required": ["error", "message"],
        "properties": {
          "error": {
            "type": "string",
            "description": "Machine-readable error code."
          },
          "message": {
            "type": "string",
            "description": "Human-readable message."
          },
          "hint": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "AgentHealthResponse": {
        "type": "object",
        "required": ["data"],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "status",
              "version",
              "uptime_seconds",
              "rate_limit_status",
              "deprecations"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": ["healthy", "degraded", "maintenance"]
              },
              "version": {
                "type": "string"
              },
              "uptime_seconds": {
                "type": "integer"
              },
              "rate_limit_status": {
                "type": "object",
                "properties": {
                  "tier": {
                    "type": "string"
                  },
                  "remaining_today": {
                    "type": ["integer", "null"]
                  },
                  "limit_today": {
                    "type": ["integer", "null"]
                  },
                  "reset_at": {
                    "type": ["string", "null"],
                    "format": "date-time"
                  }
                }
              },
              "deprecations": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "AgentUser": {
        "type": "object",
        "required": [
          "id",
          "email",
          "full_name",
          "locale",
          "created_at",
          "updated_at",
          "timezone",
          "profile",
          "preferences",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^usr_[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "full_name": {
            "type": "string"
          },
          "locale": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "timezone": {
            "type": "string"
          },
          "profile": {
            "type": "object",
            "properties": {
              "avatar_url": {
                "type": ["string", "null"]
              },
              "bio": {
                "type": ["string", "null"]
              },
              "company": {
                "type": ["object", "null"],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "department": {
                    "type": "string"
                  },
                  "employee_id": {
                    "type": "string"
                  }
                }
              },
              "social": {
                "type": "object",
                "properties": {
                  "twitter": {
                    "type": ["string", "null"]
                  },
                  "github": {
                    "type": ["string", "null"]
                  },
                  "linkedin": {
                    "type": ["string", "null"]
                  }
                }
              }
            }
          },
          "preferences": {
            "type": "object"
          },
          "status": {
            "type": "string",
            "enum": ["active", "suspended"]
          }
        }
      },
      "AgentUserListResponse": {
        "type": "object",
        "required": ["data", "meta"],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentUser"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/AgentPaginationMeta"
          }
        }
      },
      "AgentUserDetailResponse": {
        "type": "object",
        "required": ["data"],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/AgentUser"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": true,
        "required": ["error"]
      },
      "LegacyUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "avatar": {
            "type": "string"
          }
        },
        "required": ["id", "email", "first_name", "last_name", "avatar"]
      },
      "LegacyUserListResponse": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer"
          },
          "per_page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "total_pages": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LegacyUser"
            }
          },
          "support": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["page", "per_page", "total", "total_pages", "data"],
        "additionalProperties": true
      },
      "LegacyUserResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/LegacyUser"
          },
          "support": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["data"],
        "additionalProperties": true
      },
      "LegacyMutationRequest": {
        "type": "object",
        "additionalProperties": true
      },
      "LegacyMutationResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": true
      },
      "LegacyUnknown": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "year": {
            "type": "integer"
          },
          "color": {
            "type": "string"
          },
          "pantone_value": {
            "type": "string"
          }
        },
        "required": ["id", "name", "year", "color", "pantone_value"]
      },
      "LegacyUnknownListResponse": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer"
          },
          "per_page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "total_pages": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LegacyUnknown"
            }
          },
          "support": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["page", "per_page", "total", "total_pages", "data"],
        "additionalProperties": true
      },
      "LegacyUnknownResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/LegacyUnknown"
          },
          "support": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["data"],
        "additionalProperties": true
      },
      "AuthRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string"
          }
        },
        "required": ["email", "password"]
      },
      "RegisterResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "token": {
            "type": "string"
          }
        },
        "required": ["token"],
        "additionalProperties": true
      },
      "LoginResponse": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          }
        },
        "required": ["token"]
      },
      "Collection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "visibility": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": ["id", "name", "slug"],
        "additionalProperties": true
      },
      "CollectionListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Collection"
            }
          }
        },
        "required": ["data"]
      },
      "CollectionResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Collection"
          }
        },
        "required": ["data"]
      },
      "CollectionCreateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "project_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          },
          "visibility": {
            "type": "string"
          }
        },
        "required": ["name"],
        "additionalProperties": true
      },
      "CollectionUpdateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "visibility": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "CollectionRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "collection_id": {
            "type": "string"
          },
          "project_id": {
            "type": "string"
          },
          "app_user_id": {
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["id", "data"],
        "additionalProperties": true
      },
      "CollectionRecordListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CollectionRecord"
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "page": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "pages": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        },
        "required": ["data"]
      },
      "CollectionRecordResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CollectionRecord"
          }
        },
        "required": ["data"]
      },
      "CollectionRecordCreateRequest": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["data"],
        "additionalProperties": true
      },
      "CollectionRecordUpdateRequest": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["data"],
        "additionalProperties": true
      },
      "AppUser": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "status": {
            "type": "string"
          },
          "last_login_at": {
            "type": "string",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["id", "email"],
        "additionalProperties": true
      },
      "AppUserListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppUser"
            }
          }
        },
        "required": ["data"]
      },
      "AppUserResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/AppUser"
          }
        },
        "required": ["data"]
      },
      "AppUserLoginRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "project_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["email"],
        "additionalProperties": true
      },
      "AppUserLoginResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["data"]
      },
      "AppUserVerifyRequest": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          }
        },
        "required": ["token"]
      },
      "AppUserVerifyResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["data"]
      },
      "AppUserCreateRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["email"],
        "additionalProperties": true
      },
      "AppUserUpdateRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "status": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "AppUserSessionResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": ["data"]
      },
      "AppUserTotalResponse": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          }
        },
        "required": ["total"]
      },
      "Template": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "is_featured": {
            "type": "boolean"
          },
          "config": {
            "type": "object",
            "additionalProperties": true
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "required": ["id", "name", "description"],
        "additionalProperties": true
      },
      "TemplatesResponse": {
        "type": "object",
        "properties": {
          "templates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Template"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "offset": {
                "type": "integer"
              },
              "pages": {
                "type": "integer"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}
