API Overview
Base URL
Section titled “Base URL”https://api.phantomjson.app/v1Versioning
Section titled “Versioning”All API endpoints use URI versioning:
/v1/users/v1/posts/v1/productsResponse Format
Section titled “Response Format”All responses use a consistent envelope format.
Collection Response
Section titled “Collection Response”{ "data": [...], "meta": { "total": 100, "page": 1, "limit": 20, "totalPages": 5 }}Single Resource Response
Section titled “Single Resource Response”{ "data": { "id": 1, "firstName": "John", "lastName": "Doe" }}Error Response
Section titled “Error Response”{ "statusCode": 404, "error": "Not Found", "message": "Resource not found", "path": "/v1/users/999", "timestamp": "2026-01-15T10:30:00.000Z"}HTTP Methods
Section titled “HTTP Methods”| Method | Description |
|---|---|
GET |
Retrieve resources |
POST |
Create resources |
PUT |
Update resources |
PATCH |
Partially update resources |
DELETE |
Delete resources |
Query Parameters
Section titled “Query Parameters”Most endpoints support the following query parameters:
| Parameter | Description | Example |
|---|---|---|
page |
Page number (default: 1) | ?page=2 |
limit |
Items per page (default: 20, max: 100) | ?limit=10 |
sort |
Sort by field(s) | ?sort=firstName:asc |
q |
Search query | ?q=john |
fields |
Select specific fields | ?fields=id,firstName |
See Pagination, Filtering, Sorting, Search, and Field Selection for details.
Content Types
Section titled “Content Types”All requests and responses use JSON:
Content-Type: application/jsonRate Limiting
Section titled “Rate Limiting”PhantomJSON enforces rate limiting:
- 100 requests per minute per IP address
- Rate limit headers are included in responses:
X-RateLimit-Limit: 100X-RateLimit-Remaining: 95X-RateLimit-Reset: 60When rate limited, you’ll receive a 429 Too Many Requests response.
Postman Collection
Section titled “Postman Collection”A complete Postman collection is available for all API endpoints.
Import
Section titled “Import”- Download the collection file from the GitHub repository
- Open Postman
- Select Import → File → choose the JSON file
- The collection appears in your workspace with all endpoints organized by domain
Configure
Section titled “Configure”The collection uses variables so you can switch environments:
| Variable | Default | Description |
|---|---|---|
baseUrl |
https://api.phantomjson.app |
API host |
apiVersion |
v1 |
API version prefix |
To run against a local instance, change baseUrl to http://localhost:5000.
What’s included
Section titled “What’s included”- 87 requests across 6 domains (Users, Posts, E-commerce, Social, Organizations, Travel)
- Test scripts that validate status codes and response structure
- Query parameter examples (pagination, search, filtering, sorting)
- Nested relationship endpoints (e.g.
/users/:id/posts,/products/:id/reviews)
