Skip to main content

Introduction

The Posts API provides comprehensive endpoints for managing blog posts in the Blog Marketing Platform. This includes CRUD operations, statistics tracking, engagement metrics, and advanced content management features.

Base Endpoint

/api/posts

Authentication

All Posts API endpoints require authentication. Include the user’s authentication token in the request headers:
Authorization: Bearer YOUR_ACCESS_TOKEN

Post Object Structure

id
number
required
Unique identifier for the post
title
string
required
Post title
slug
string
required
URL-friendly version of the title
content
string
Full post content in HTML or Markdown
excerpt
string
Short summary of the post
status
string
required
Post status: draft, published, pending, or rejected
authorId
number
required
ID of the post author
author
object
Author details object
estadoId
number
Backend state ID (maps to status)
URL to the post’s featured image
publishedAt
string
ISO 8601 timestamp of publication
createdAt
string
required
ISO 8601 timestamp of creation
updatedAt
string
required
ISO 8601 timestamp of last update
readTime
number
Estimated reading time in minutes
views
number
Total view count
likes
number
Total like count
comments
number
Total comment count
shares
number
Total share count
Whether the post is featured
allowComments
boolean
Whether comments are enabled
isPinned
boolean
Whether the post is pinned to the top
categories
array
Array of category objects
keywords
array
Array of keyword objects
tags
array
Array of tag strings
seo
object
SEO metadata

Status Values

Posts can have one of four status values:
StatusEstado IDDescription
draft1Post is being edited and not visible to public
pending2Post is awaiting review/approval
published3Post is live and visible to public
rejected4Post was rejected during review

Common Patterns

Creating a Post

When creating a post, only title and content are required. The system will:
  • Auto-generate a slug from the title if not provided
  • Set status to draft by default
  • Auto-calculate reading time based on word count
  • Set the current user as the author

Updating Posts

Partial updates are supported - only include fields you want to change. The updatedAt timestamp is automatically updated.

Status Transitions

Typical workflow:
  1. Create as draft
  2. Edit and refine content
  3. Change to pending for review
  4. Reviewer changes to published or rejected

Slug Generation

Slugs are automatically generated using postsService.ts:211-221:
  • Converted to lowercase
  • Accents removed
  • Special characters removed
  • Spaces replaced with hyphens
  • Limited to 255 characters

Error Handling

All endpoints return standard HTTP status codes:
  • 200 - Success
  • 201 - Created successfully
  • 400 - Bad request (invalid data)
  • 401 - Unauthorized (missing/invalid token)
  • 404 - Post not found
  • 500 - Server error
Error responses include a message:
{
  "error": "Post not found",
  "statusCode": 404
}

Rate Limiting

API requests are rate limited to prevent abuse. Current limits:
  • 100 requests per minute per user
  • 1000 requests per hour per user

Pagination

List endpoints support pagination via query parameters:
limit
number
default:"20"
Number of results to return (max 100)
offset
number
default:"0"
Number of results to skip
page
number
default:"1"
Page number (alternative to offset)

Next Steps

CRUD Operations

Learn about creating, reading, updating, and deleting posts

Statistics

Track post performance and analytics

Interactions

Manage likes, views, and keywords

Categories

Organize posts with categories

Build docs developers (and LLMs) love