REST API
API Reference
Full documentation for the NewsPro REST API. Manage content, media, and users programmatically.
Media
Available Fields
| Field | Type | Description |
|---|---|---|
id | int | Media file ID |
file_name | string | File name |
file_path | string | Full path or CDN URL to the file |
file_type | string | MIME type (e.g. image/jpeg, video/mp4, audio/mpeg) |
file_size | string | Human-readable file size (e.g. 245 KB) |
resolution | string | Image resolution (e.g. 1920x1080) |
title | string | Display title in media library |
credit | string | Photo/video credit or source attribution |
description | string | Internal notes or alt text |
cache_versions | json | Cached size variants (304px, 500px, 800px WebP) |
created_at | datetime | Upload date |
Get Media
{"resource":"media","action":"get","filters":{"file_type":"image/jpeg","search":"banner","date_from":"2025-01-01"},"fields":["id","file_name","file_path","file_type","file_size","title","created_at"],"limit":20,"order_by":"id DESC"}
Upload from URL
Downloads a file from a public URL and imports it into the media library. Returns the new media id to use in articles/pages. Supports images (JPG, PNG, WebP, GIF), video, and audio.
// Request
{"resource":"media","action":"upload_from_url","file_url":"https://example.com/image.jpg"}
// Response
{"status":"success","files":[[{"id":"48","file_path":"...","file_type":"image/jpeg"}]]}
Update Metadata
{"resource":"media","action":"update_metadata","file_id":123,"title":"Photo title","credit":"Photographer Name / Agency","description":"Photo description or alt text"}
Delete Media
Deletes the file and all its cached size variants.
{"resource":"media","action":"delete","file_id":123}
Regenerate Cache
Regenerates all image cache sizes (304px, 500px, 800px WebP) for every file in the library.
{"resource":"media","action":"create_all_cache"}
Copied to clipboard!