Media
Overview
Section titled “Overview”The Media resource provides fake media attachment data for social posts, including images, videos, and other file types.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/media | List all media |
| GET | /v1/media/:id | Get a specific media item |
Media Object
Section titled “Media Object”{ "id": 1, "socialPostId": 1, "url": "https://example.com/images/photo.jpg", "type": "image", "width": 1920, "height": 1080, "fileSize": 245760, "createdAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
socialPostId |
number |
ID of the parent post |
url |
string |
Media file URL |
type |
string |
Media type (image, video, file) |
width |
number |
Width in pixels (for images/videos) |
height |
number |
Height in pixels (for images/videos) |
fileSize |
number |
File size in bytes |
createdAt |
string |
ISO 8601 timestamp |
List Media
Section titled “List Media”curl https://api.phantomjson.app/v1/mediaQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
fields |
string |
— | Fields to return |
socialPostId |
number |
— | Filter by post ID |
type |
string |
— | Filter by media type |
Response
Section titled “Response”{ "data": [ { "id": 1, "socialPostId": 1, "url": "https://example.com/images/photo.jpg", "type": "image", "width": 1920, "height": 1080, "fileSize": 245760 } ], "meta": { "total": 100, "page": 1, "limit": 20, "totalPages": 5 }}Get Media by ID
Section titled “Get Media by ID”curl https://api.phantomjson.app/v1/media/1Response
Section titled “Response”{ "data": { "id": 1, "socialPostId": 1, "url": "https://example.com/images/photo.jpg", "type": "image", "width": 1920, "height": 1080, "fileSize": 245760, "createdAt": "2026-01-15T10:30:00.000Z" }}Examples
Section titled “Examples”Filter by Post
Section titled “Filter by Post”curl "https://api.phantomjson.app/v1/media?socialPostId=1"Filter by Type
Section titled “Filter by Type”curl "https://api.phantomjson.app/v1/media?type=image"Sort by Creation Date
Section titled “Sort by Creation Date”# Newest firstcurl "https://api.phantomjson.app/v1/media?sort=createdAt:desc"
# Oldest firstcurl "https://api.phantomjson.app/v1/media?sort=createdAt:asc"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/media?fields=id,url,type,width,height"Combined Query
Section titled “Combined Query”# Images on post 1curl "https://api.phantomjson.app/v1/media?socialPostId=1&type=image&sort=createdAt:desc"Media Types
Section titled “Media Types”Available media types:
image— JPEG, PNG, GIF, WebP imagesvideo— MP4, WebM videosfile— Other file attachments
Relations
Section titled “Relations”- Social Post — Each media item belongs to a social post (
socialPostId)
