{"openapi":"3.0.3","info":{"title":"API Learning Sandbox","description":"## Welcome to the API Learning Sandbox 🧪\n\nA hands-on API testing platform for learning **REST**, **GraphQL**, **SOAP**, and **Authentication**.\n\n### Quick Start\n1. **No login required** — a session is auto-created on your first request\n2. Your session ID is returned in the `x-session-id` response header\n3. All data you create is **private to your session** and **auto-expires** in 30 minutes\n4. Use the REST, GraphQL, or SOAP endpoints — they all share the same data store\n\n### Authentication Methods\n| Method | How to use |\n|--------|-----------|\n| **API Key** | Add header `x-api-key: demo-key-sandbox-2026` |\n| **JWT** | POST `/auth/token` → use `Authorization: Bearer <token>` |\n| **OAuth2** | POST `/auth/oauth` with client credentials |\n\n### Simulation Features\nAdd these query params to any REST endpoint:\n- `?delay=2000` — add 2 second artificial delay\n- `?error=500` — force a 500 error response\n- `?random_fail=true` — 30% random failure chance\n\n### Rate Limiting\n100 requests/minute per IP. Headers: `X-RateLimit-Remaining`\n\n### Entities Available\n- `users` — name, email, role, age\n- `products` — name, price, description, stock, category\n- `orders` — user_id, product_id, quantity, status, notes\n","version":"1.0.0","contact":{"name":"TotalShiftLeft","url":"https://demo.totalshiftleft.ai"},"license":{"name":"MIT"}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Demo keys: `demo-key-sandbox-2026` or `admin-key-sandbox-2026`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Obtain via POST /auth/token"},"SessionHeader":{"type":"apiKey","in":"header","name":"x-session-id","description":"Session ID (auto-created on first request, returned in response headers)"}},"schemas":{"User":{"type":"object","description":"A sandbox user record.","properties":{"id":{"type":"string","format":"uuid","description":"Unique record ID"},"name":{"type":"string","description":"Full name"},"email":{"type":"string","format":"email","description":"Email address"},"role":{"type":"string","enum":["user","admin","moderator"],"description":"User role"},"age":{"type":"integer","nullable":true,"description":"Age in years"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Product":{"type":"object","description":"A catalogue product.","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","description":"Product name"},"price":{"type":"number","description":"Unit price"},"description":{"type":"string","description":"Product description"},"stock":{"type":"integer","description":"Units available"},"category":{"type":"string","description":"Product category"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Order":{"type":"object","description":"An order linking a user to a product.","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid","nullable":true},"product_id":{"type":"string","format":"uuid","nullable":true},"quantity":{"type":"integer","description":"Quantity ordered"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string","description":"Optional notes"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user":{"type":"object","nullable":true,"description":"Populated when ?expand=user"},"product":{"type":"object","nullable":true,"description":"Populated when ?expand=product"}}},"UserInput":{"type":"object","required":["name","email"],"description":"Payload for creating or fully replacing a user.","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Full name"},"email":{"type":"string","format":"email","maxLength":255,"description":"Email address (unique per session)"},"role":{"type":"string","enum":["user","admin","moderator"],"default":"user","description":"User role"},"age":{"type":"integer","minimum":0,"maximum":150,"description":"Age in years"}},"additionalProperties":false},"ProductInput":{"type":"object","required":["name","price"],"description":"Payload for creating or fully replacing a product.","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Product name"},"price":{"type":"number","exclusiveMinimum":0,"description":"Unit price (must be > 0)"},"description":{"type":"string","maxLength":500,"default":"","description":"Product description"},"stock":{"type":"integer","minimum":0,"default":0,"description":"Units available in stock"},"category":{"type":"string","maxLength":50,"default":"general","description":"Product category"}},"additionalProperties":false},"OrderInput":{"type":"object","description":"Payload for creating a new order.","properties":{"user_id":{"type":"string","format":"uuid","description":"ID of the user placing the order"},"product_id":{"type":"string","format":"uuid","description":"ID of the product being ordered"},"quantity":{"type":"integer","minimum":1,"default":1,"description":"Quantity ordered"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"],"default":"pending","description":"Initial order status"},"notes":{"type":"string","maxLength":500,"default":"","description":"Optional order notes"}},"additionalProperties":false},"UserPatch":{"type":"object","description":"Partial update payload for a user — include only fields to change.","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":255},"role":{"type":"string","enum":["user","admin","moderator"]},"age":{"type":"integer","minimum":0,"maximum":150}},"additionalProperties":false},"ProductPatch":{"type":"object","description":"Partial update payload for a product — include only fields to change.","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"price":{"type":"number","exclusiveMinimum":0},"description":{"type":"string","maxLength":500},"stock":{"type":"integer","minimum":0},"category":{"type":"string","maxLength":50}},"additionalProperties":false},"OrderPatch":{"type":"object","description":"Partial update payload for an order — include only fields to change.","properties":{"quantity":{"type":"integer","minimum":1},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string","maxLength":500}},"additionalProperties":false},"Pagination":{"type":"object","description":"Pagination metadata returned with list responses.","properties":{"total":{"type":"integer","description":"Total matching records"},"page":{"type":"integer","description":"Current page number"},"limit":{"type":"integer","description":"Results per page"},"pages":{"type":"integer","description":"Total page count"},"hasNext":{"type":"boolean","description":"Whether a next page exists"},"hasPrev":{"type":"boolean","description":"Whether a previous page exists"}}},"Error":{"type":"object","description":"Standard error response envelope.","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST","description":"Machine-readable error code"},"message":{"type":"string","description":"Human-readable explanation"},"details":{"type":"array","description":"Field-level validation errors (present on 400 responses)","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}},"paths":{"/api/v1/users":{"post":{"summary":"Create a new user","tags":["Users"],"description":"Creates a new record in the sandbox. Data is session-scoped and auto-expires in 30 minutes.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","email"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Full name"},"email":{"type":"string","format":"email","maxLength":255,"description":"Email address (unique per session)"},"role":{"type":"string","enum":["user","admin","moderator"],"default":"user","description":"User role"},"age":{"type":"integer","minimum":0,"maximum":150,"description":"Age in years"}},"additionalProperties":false}}},"required":true},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["user","admin","moderator"]},"age":{"type":"integer","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"get":{"summary":"List users","tags":["Users"],"description":"Returns a paginated list. Supports `?page`, `?limit`, `?sort`, `?order`, and any field as a filter (e.g. `?status=pending`). Also supports `?delay`, `?error`, `?random_fail` for simulation.","parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false,"description":"Page number (1-based)"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"in":"query","name":"limit","required":false,"description":"Results per page (max 100)"},{"schema":{"type":"string","default":"created_at"},"in":"query","name":"sort","required":false,"description":"Field to sort by (e.g. name, created_at)"},{"schema":{"type":"string","enum":["asc","desc","ASC","DESC"],"default":"desc"},"in":"query","name":"order","required":false,"description":"Sort direction"},{"schema":{"type":"integer","minimum":0,"maximum":10000},"in":"query","name":"delay","required":false,"description":"Simulation: artificial delay in ms"},{"schema":{"type":"integer"},"in":"query","name":"error","required":false,"description":"Simulation: force this HTTP status code as an error"},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"random_fail","required":false,"description":"Simulation: 30% random failure rate"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["user","admin","moderator"]},"age":{"type":"integer","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}},"pagination":{"type":"object","properties":{"total":{"type":"integer","description":"Total matching records"},"page":{"type":"integer"},"limit":{"type":"integer"},"pages":{"type":"integer","description":"Total page count"},"hasNext":{"type":"boolean"},"hasPrev":{"type":"boolean"}}}}}}}}}}},"/api/v1/users/{id}":{"get":{"summary":"Get a single user by ID","tags":["Users"],"description":"Fetch one record by UUID.","parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["user","admin","moderator"]},"age":{"type":"integer","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"put":{"summary":"Replace a user (full update)","tags":["Users"],"description":"Full replacement — all required fields must be supplied. Missing optional fields revert to defaults.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","email"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Full name"},"email":{"type":"string","format":"email","maxLength":255,"description":"Email address (unique per session)"},"role":{"type":"string","enum":["user","admin","moderator"],"default":"user","description":"User role"},"age":{"type":"integer","minimum":0,"maximum":150,"description":"Age in years"}},"additionalProperties":false}}},"required":true},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["user","admin","moderator"]},"age":{"type":"integer","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"patch":{"summary":"Partially update a user (PATCH)","tags":["Users"],"description":"Send only the fields you want to change. Omitted fields are left as-is.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":255},"role":{"type":"string","enum":["user","admin","moderator"]},"age":{"type":"integer","minimum":0,"maximum":150}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["user","admin","moderator"]},"age":{"type":"integer","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"delete":{"summary":"Delete a user by ID","tags":["Users"],"description":"Permanently removes the record from the session. Returns 204 No Content on success.","parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"204":{"description":"Deleted successfully"},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}},"/api/v1/orders":{"post":{"summary":"Create a new order","tags":["Orders"],"description":"Creates a new record in the sandbox. Data is session-scoped and auto-expires in 30 minutes.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid","description":"ID of the user placing the order"},"product_id":{"type":"string","format":"uuid","description":"ID of the product being ordered"},"quantity":{"type":"integer","minimum":1,"default":1,"description":"Quantity ordered"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"],"default":"pending","description":"Order status"},"notes":{"type":"string","maxLength":500,"default":"","description":"Optional order notes"}},"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid","nullable":true},"product_id":{"type":"string","format":"uuid","nullable":true},"quantity":{"type":"integer"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user":{"type":"object","nullable":true,"description":"Populated when ?expand=user"},"product":{"type":"object","nullable":true,"description":"Populated when ?expand=product"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"get":{"summary":"List orders","tags":["Orders"],"description":"Returns a paginated list. Supports `?page`, `?limit`, `?sort`, `?order`, and any field as a filter (e.g. `?status=pending`). Also supports `?delay`, `?error`, `?random_fail` for simulation.","parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false,"description":"Page number (1-based)"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"in":"query","name":"limit","required":false,"description":"Results per page (max 100)"},{"schema":{"type":"string","default":"created_at"},"in":"query","name":"sort","required":false,"description":"Field to sort by (e.g. name, created_at)"},{"schema":{"type":"string","enum":["asc","desc","ASC","DESC"],"default":"desc"},"in":"query","name":"order","required":false,"description":"Sort direction"},{"schema":{"type":"integer","minimum":0,"maximum":10000},"in":"query","name":"delay","required":false,"description":"Simulation: artificial delay in ms"},{"schema":{"type":"integer"},"in":"query","name":"error","required":false,"description":"Simulation: force this HTTP status code as an error"},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"random_fail","required":false,"description":"Simulation: 30% random failure rate"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid","nullable":true},"product_id":{"type":"string","format":"uuid","nullable":true},"quantity":{"type":"integer"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user":{"type":"object","nullable":true,"description":"Populated when ?expand=user"},"product":{"type":"object","nullable":true,"description":"Populated when ?expand=product"}}}},"pagination":{"type":"object","properties":{"total":{"type":"integer","description":"Total matching records"},"page":{"type":"integer"},"limit":{"type":"integer"},"pages":{"type":"integer","description":"Total page count"},"hasNext":{"type":"boolean"},"hasPrev":{"type":"boolean"}}}}}}}}}}},"/api/v1/orders/{id}":{"get":{"summary":"Get a single order by ID","tags":["Orders"],"description":"Fetch one record by UUID. Add `?expand=user,product` to inline the linked user and product objects.","parameters":[{"schema":{"type":"string","example":"user,product"},"in":"query","name":"expand","required":false,"description":"Comma-separated relations to inline: user, product"},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid","nullable":true},"product_id":{"type":"string","format":"uuid","nullable":true},"quantity":{"type":"integer"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user":{"type":"object","nullable":true,"description":"Populated when ?expand=user"},"product":{"type":"object","nullable":true,"description":"Populated when ?expand=product"}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"put":{"summary":"Replace a order (full update)","tags":["Orders"],"description":"Full replacement — all required fields must be supplied. Missing optional fields revert to defaults.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","format":"uuid","description":"ID of the user placing the order"},"product_id":{"type":"string","format":"uuid","description":"ID of the product being ordered"},"quantity":{"type":"integer","minimum":1,"default":1,"description":"Quantity ordered"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"],"default":"pending","description":"Order status"},"notes":{"type":"string","maxLength":500,"default":"","description":"Optional order notes"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid","nullable":true},"product_id":{"type":"string","format":"uuid","nullable":true},"quantity":{"type":"integer"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user":{"type":"object","nullable":true,"description":"Populated when ?expand=user"},"product":{"type":"object","nullable":true,"description":"Populated when ?expand=product"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"patch":{"summary":"Partially update a order (PATCH)","tags":["Orders"],"description":"Send only the fields you want to change. Omitted fields are left as-is.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer","minimum":1},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string","maxLength":500}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid","nullable":true},"product_id":{"type":"string","format":"uuid","nullable":true},"quantity":{"type":"integer"},"status":{"type":"string","enum":["pending","processing","completed","cancelled"]},"notes":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user":{"type":"object","nullable":true,"description":"Populated when ?expand=user"},"product":{"type":"object","nullable":true,"description":"Populated when ?expand=product"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"delete":{"summary":"Delete a order by ID","tags":["Orders"],"description":"Permanently removes the record from the session. Returns 204 No Content on success.","parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"204":{"description":"Deleted successfully"},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}},"/api/v1/products":{"post":{"summary":"Create a new product","tags":["Products"],"description":"Creates a new record in the sandbox. Data is session-scoped and auto-expires in 30 minutes.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","price"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Product name"},"price":{"type":"number","exclusiveMinimum":0,"description":"Unit price (must be > 0)"},"description":{"type":"string","maxLength":500,"default":"","description":"Product description"},"stock":{"type":"integer","minimum":0,"default":0,"description":"Units available in stock"},"category":{"type":"string","maxLength":50,"default":"general","description":"Product category"}},"additionalProperties":false}}},"required":true},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"price":{"type":"number"},"description":{"type":"string"},"stock":{"type":"integer"},"category":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"get":{"summary":"List products","tags":["Products"],"description":"Returns a paginated list. Supports `?page`, `?limit`, `?sort`, `?order`, and any field as a filter (e.g. `?status=pending`). Also supports `?delay`, `?error`, `?random_fail` for simulation.","parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false,"description":"Page number (1-based)"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"in":"query","name":"limit","required":false,"description":"Results per page (max 100)"},{"schema":{"type":"string","default":"created_at"},"in":"query","name":"sort","required":false,"description":"Field to sort by (e.g. name, created_at)"},{"schema":{"type":"string","enum":["asc","desc","ASC","DESC"],"default":"desc"},"in":"query","name":"order","required":false,"description":"Sort direction"},{"schema":{"type":"integer","minimum":0,"maximum":10000},"in":"query","name":"delay","required":false,"description":"Simulation: artificial delay in ms"},{"schema":{"type":"integer"},"in":"query","name":"error","required":false,"description":"Simulation: force this HTTP status code as an error"},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"random_fail","required":false,"description":"Simulation: 30% random failure rate"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"price":{"type":"number"},"description":{"type":"string"},"stock":{"type":"integer"},"category":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}},"pagination":{"type":"object","properties":{"total":{"type":"integer","description":"Total matching records"},"page":{"type":"integer"},"limit":{"type":"integer"},"pages":{"type":"integer","description":"Total page count"},"hasNext":{"type":"boolean"},"hasPrev":{"type":"boolean"}}}}}}}}}}},"/api/v1/products/{id}":{"get":{"summary":"Get a single product by ID","tags":["Products"],"description":"Fetch one record by UUID.","parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"price":{"type":"number"},"description":{"type":"string"},"stock":{"type":"integer"},"category":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"put":{"summary":"Replace a product (full update)","tags":["Products"],"description":"Full replacement — all required fields must be supplied. Missing optional fields revert to defaults.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","price"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"Product name"},"price":{"type":"number","exclusiveMinimum":0,"description":"Unit price (must be > 0)"},"description":{"type":"string","maxLength":500,"default":"","description":"Product description"},"stock":{"type":"integer","minimum":0,"default":0,"description":"Units available in stock"},"category":{"type":"string","maxLength":50,"default":"general","description":"Product category"}},"additionalProperties":false}}},"required":true},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"price":{"type":"number"},"description":{"type":"string"},"stock":{"type":"integer"},"category":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"patch":{"summary":"Partially update a product (PATCH)","tags":["Products"],"description":"Send only the fields you want to change. Omitted fields are left as-is.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"price":{"type":"number","exclusiveMinimum":0},"description":{"type":"string","maxLength":500},"stock":{"type":"integer","minimum":0},"category":{"type":"string","maxLength":50}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"price":{"type":"number"},"description":{"type":"string"},"stock":{"type":"integer"},"category":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Validation failed","content":{"application/json":{"schema":{"description":"Validation failed","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}},"delete":{"summary":"Delete a product by ID","tags":["Products"],"description":"Permanently removes the record from the session. Returns 204 No Content on success.","parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true,"description":"Record UUID"}],"responses":{"204":{"description":"Deleted successfully"},"404":{"description":"Record not found","content":{"application/json":{"schema":{"description":"Record not found","type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"BAD_REQUEST"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}}},"servers":[{"url":"https://demo.totalshiftleft.ai","description":"API Learning Sandbox"}],"tags":[{"name":"Users","description":"User management — create, read, update, delete"},{"name":"Products","description":"Product catalogue — create, read, update, delete"},{"name":"Orders","description":"Order management — create, read, update, delete; supports ?expand=user,product"}],"externalDocs":{"url":"https://demo.totalshiftleft.ai/docs","description":"Full API Learning Guide"}}