REST API
API Reference
Full documentation for the NewsPro REST API. Manage content, media, and users programmatically.
Overview
Authentication
Include your API token in every request as a Bearer token in the Authorization header. Find your token in Dashboard โ Settings โ API. The API must be enabled in your dashboard settings.
POST https://yoursite.newspro.io/functions/api
Content-Type: application/json
Authorization: Bearer YOUR_SECRET_KEY
Request Format
Every request is a JSON POST body with at minimum resource and action.
| Field | Required | Description |
|---|---|---|
resource | Yes | One of: article, category, page, breaking, user, media |
action | Yes | One of: get, add, edit, delete (media has additional actions) |
id | No | Operate on a single record by ID |
fields | No | Array of field names to return. Omit to return all fields |
filters | No | Object of filter conditions (varies per resource) |
limit | No | Number of results (default: 50, max: 100) |
offset | No | Pagination offset (default: 0) |
order_by | No | e.g. "created_at DESC" or "title ASC" |
{"resource":"article","action":"get","filters":{"status":3},"fields":["id","title","slug"],"limit":20,"offset":0,"order_by":"created_at DESC"}
Response Format
All responses are JSON. Successful responses include "status":"success" and a data object. Errors return "status":"error" with a message.
// Success
{"status":"success","data":{...}}
// Error
{"status":"error","message":"Description of the error"}
Embedding Media in Content
The body (articles) and content (pages) fields support inline media via dynamic blocks. Use the media ID returned by media โ upload_from_url.
| Attribute | Values | Description |
|---|---|---|
data-id | number | Numeric media file ID from the media library |
data-type | media | Always media |
data-size | small, medium, large | Display size of the embedded file |
<dynamic-block data-id="MEDIA_ID" data-type="media" data-size="large" contenteditable="false"></dynamic-block>
Copied to clipboard!