Overview
The Media endpoints provide access to upload and manage images, videos, and other media assets used in web stories. This extends the WordPress Attachments API with web stories-specific functionality. Base Path:/wp-json/web-stories/v1/media
List Media
Retrieves a collection of media items.GET /web-stories/v1/media
Query Parameters
Scope:
view, edit, or embedCurrent page number
Maximum number of items (max 100)
Search media by title or filename
Filter by uploader user ID
Filter by parent post ID
Filter by media type:
image, videoFilter by MIME type (e.g.,
image/jpeg, video/mp4)Sort by:
date, title, modified, relevanceSort order:
asc or descInclude embedded resources
Wrap response in envelope for preloading
Response
By default, only media types supported by Web Stories are returned (images and videos). Audio files are excluded.
Get Media Item
Retrieves a single media item by ID.GET /web-stories/v1/media/:id
Path Parameters
Unique identifier for the media item
Response Fields
Unique identifier for the attachment
Upload date in ISO 8601 format
URL-friendly slug
Media title
Uploader user ID
Media caption
Alternative text for accessibility
Type of media:
image, video, fileMIME type (e.g.,
image/jpeg, video/mp4)Media file details
Parent post ID (story this media is attached to)
Direct URL to the media file
Original attachment ID if this is a copy
Upload Media
Uploads a new media file.POST /web-stories/v1/media
Headers
Must include filename:
attachment; filename=image.jpgMIME type of the file being uploaded
Request Body
Raw binary file dataQuery Parameters
Parent story ID to attach media to
Original attachment ID to copy metadata from
Using Multipart Form Data
Alternatively, upload using multipart/form-data:The file to upload
Media title
Alternative text for images
Media caption
Parent story ID
Original attachment ID to copy metadata from
Response
Returns the created media object with HTTP 201 status.When
post parameter is provided with a story ID, the media will be attached to that story. Web Stories allows attaching media to stories even though stories themselves are a custom post type.When
original_id is provided, metadata like title, caption, alt text, and base color will be copied from the original attachment.Update Media
Updates media metadata (not the file itself).PUT /web-stories/v1/media/:id
Path Parameters
Unique identifier for the media item
Request Body
Media title
Alternative text
Media caption
Parent post ID
Response
Returns the updated media object with HTTP 200 status.Delete Media
Deletes a media item.DELETE /web-stories/v1/media/:id
Path Parameters
Unique identifier for the media item
Query Parameters
Whether to bypass trash and force deletion
Response
Supported Media Types
The Web Stories media endpoint supports the following media types:Images
image/jpegimage/pngimage/gif(static and animated)image/webp
Videos
video/mp4video/webm
Note on Audio
While the endpoint inherits audio MIME types from WordPress, audio files are filtered out by default as they’re not currently supported in Web Stories.Media Processing
When images are uploaded:- Dimension Defaults: If width/height cannot be determined, defaults to 150x150 pixels
- Multiple Sizes: WordPress automatically generates multiple sizes (thumbnail, medium, large, etc.)
- Base Color: The dominant color is extracted and stored in post meta
- Optimization: Images may be processed based on WordPress media settings
Common Errors
Status 400: The uploaded file type is not supportedEnsure you’re uploading a supported image or video format
Status 400: The uploaded file exceeds the maximum sizeCheck your WordPress and server upload limits
Status 403: You don’t have permission to edit this media itemRequired capability:
edit_post for the attachmentStatus 403: You don’t have permission to upload filesRequired capability:
upload_files