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.

FieldRequiredDescription
resourceYesOne of: article, category, page, breaking, user, media
actionYesOne of: get, add, edit, delete (media has additional actions)
idNoOperate on a single record by ID
fieldsNoArray of field names to return. Omit to return all fields
filtersNoObject of filter conditions (varies per resource)
limitNoNumber of results (default: 50, max: 100)
offsetNoPagination offset (default: 0)
order_byNoe.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.

AttributeValuesDescription
data-idnumberNumeric media file ID from the media library
data-typemediaAlways media
data-sizesmall, medium, largeDisplay size of the embedded file
<dynamic-block data-id="MEDIA_ID" data-type="media" data-size="large" contenteditable="false"></dynamic-block>
Copied to clipboard!