Documentation
Every endpoint and parameter on one page. Use Ctrl+F.
https://sampleapi.top/api
Basics
| Base URL | https://sampleapi.top/api |
| Transport | HTTPS |
| Response type | application/json; charset=utf-8 |
| Auth | None, except /auth/bearer (demo token demo-token). |
| CORS | Wildcard origin, all standard methods, preflight cached 24h. |
| Max body | 1,048,576 bytes |
| Rate limit | ~120 requests / 60s per IP. Over → 429 with Retry-After. |
Methods
| Method | Effect | Where |
|---|---|---|
| GET | Read | All endpoints |
| POST | Simulated create (returns generated id) | Resource collections, echo, status |
| PUT | Simulated full replace | Resource items, echo, status |
| PATCH | Simulated partial merge | Resource items, echo, status |
| DELETE | Simulated delete | Resource items, echo, status |
| HEAD | Same as GET, no body | Any GET route |
| CORS preflight (204) | Every endpoint |
Writes never persist. Every user always sees the same baseline data.
Resources
Four resources with relations, filtering, sorting, and pagination.
| Path | Description |
|---|---|
/posts | List, paginate, search, filter by userId. |
/posts/{id} | Single post. |
/posts/{id}/comments | Comments for a post. |
/comments | List, filter by postId / email. |
/comments/{id} | Single comment. |
/users | List of users. |
/users/{id} | Single user. |
/users/{id}/posts | Posts authored by user. |
/users/{id}/todos | Todos belonging to user. |
/todos | List, filter by userId / completed. |
/todos/{id} | Single todo. |
Each path accepts GET, POST (collections) or PUT/PATCH/DELETE (items). Full reference at Advanced → Fake REST.
Query parameters (list endpoints)
| Param | Default | Notes |
|---|---|---|
_page | 1 | 1-based. |
_limit | 30 | Max 100. |
_sort | — | Any field name. |
_order | asc | asc or desc. |
q | — | Substring match across the resource's searchable fields. |
userId, postId, completed, … | — | Exact-match filter where supported. |
Pagination response headers
X-Total-Count | Total items matching the query, before pagination. |
X-Page | Current page. |
X-Limit | Items per page actually used. |
Other endpoints
| Endpoint | Purpose | Reference |
|---|---|---|
/anything/{path} | Mirror request back as JSON | Echo |
/get, /post, /put, /patch, /delete | Method-specific echo | Echo |
/headers, /ip, /user-agent | Single-field echo helpers | Echo |
/status/{code} | Return any HTTP status 100-599 | Status |
/delay/{seconds} | Delay 0–5s before responding | Status |
/auth/bearer | Bearer token test (200/401/403) | Auth |
/uuid, /time | UUIDv4, server time | — |
/hash | md5/sha1/sha256/crc32 of request body | — |
/json-stats | Stats about a JSON body's shape | — |
/validate/post | Validate a post payload (422 on errors) | — |
Errors
All error responses share this shape:
{
"error": true,
"status": 404,
"message": "Post not found."
}| Status | When |
|---|---|
| 400 | Invalid JSON, or a parameter is out of range. |
| 401 | Missing Authorization on /auth/bearer. |
| 403 | Wrong bearer token. |
| 404 | Unknown route or item id. |
| 405 | Method not allowed on that path (sends Allow). |
| 413 | Body exceeded 1,048,576 bytes. |
| 422 | Validation failed (with per-field errors map). |
| 429 | Rate limited. Honor Retry-After. |
| 500 | Unexpected. |
Machine-readable specs
For client generators and import into your HTTP client of choice:
- OpenAPI 3.1 spec
- Postman v2.1 collection (also imports into Insomnia and Bruno)