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.
