NEXBLOG API
Public REST API for fetching blog content. All endpoints require a valid API key for authentication and return only published content. The API resolves the correct blog automatically based on the provided key.
Authentication
All requests to the Nexblog Public API must include the X-API-KEY header. You can generate and manage your API keys in the Dashboard > Settings > API Keys section.
`` X-API-KEY: your_uuid_api_key_herehttp
`
Endpoints will return 401 Unauthorized if the key is missing, invalid, or inactive.
Base URL
`
https://blog.nexwinds.com/api/public
`
Structure
The API follows a path-based internationalization structure:
https://blog.nexwinds.com/api/public/:locale/...
Supported Locales: en, pt, es, fr
Response Headers
All successful GET requests include caching headers to optimize performance via CDNs and browser caching:
- Posts: Cache-Control: public, s-maxage=60, stale-while-revalidate=30
- Metadata (Categories/Tags/Authors): Cache-Control: public, s-maxage=3600, stale-while-revalidate=600
---
Posts
GET /:locale/posts
List published posts (Summary view) with pagination.
Headers
| Header | Required | Description |
| --------- | -------- | -------------------------- |
| X-API-KEY | Yes | Your blog's public API key |
Query Parameters
| Parameter | Type | Required | Default | Description |
| ---------- | ------ | -------- | ------- | ----------------------- |
| page | number | No | 1 | Page number |
| limit | number | No | 10 | Items per page (max 20) |
| categoryId | number | No | - | Filter by category ID |
| tagId | number | No | - | Filter by tag ID |
Response Format
`json
{
"success": true,
"data": {
"posts": [
{
"id": 1,
"title": "Post Title",
"slug": "post-slug",
"seoDescription": "...",
"excerpt": "...",
"featuredImage": "https://cdn.example.com/image.jpg",
"isFeatured": false,
"publishedAt": "2024-03-20",
"updatedAt": "2024-03-21",
"authorId": 1,
"categoryId": 1
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 45,
"totalPages": 5
}
}
}
`
---
GET /:locale/posts/:slug
Get a single post detail (Rich view).
Headers
| Header | Required | Description |
| --------- | -------- | -------------------------- |
| X-API-KEY | Yes | Your blog's public API key |
Response Fields (Rich Object)
| Field | Description |
| -------------- | ----------------------------- |
| id | Post ID |
| title | Post title |
| slug | URL-friendly identifier |
| content | Full HTML content (sanitized) |
| seoDescription | SEO meta description |
| excerpt | Short summary |
| featuredImage | Absolute URL or null |
| isFeatured | Featured flag |
| publishedAt | ISO 8601 date |
| updatedAt | ISO 8601 date |
| author | { id, name } |
| category | { id, name } |
| tags | Array of { id, name } |
---
GET /:locale/posts/featured
Get featured posts (Summary view) with pagination.
Query Parameters
| Parameter | Type | Required | Default | Description |
| --------- | ------ | -------- | ------- | ------------------ |
| page | number | No | 1 | Page number |
| limit | number | No | 5 | Max items (max 20) |
---
GET /:locale/posts/latest
Get latest posts (Summary view) with pagination.
Query Parameters
| Parameter | Type | Required | Default | Description |
| --------- | ------ | -------- | ------- | ------------------ |
| page | number | No | 1 | Page number |
| limit | number | No | 5 | Max items (max 20) |
---
Categories & Tags
GET /:locale/categories
List all categories for the blog.
GET /:locale/tags
List all tags for the blog.
Response Format (Categories/Tags)
`json
{
"success": true,
"data": {
"categories": [{ "id": 1, "name": "Tech", "description": "..." }],
"pagination": { "page": 1, "limit": 10, "total": 5, "totalPages": 1 }
}
}
`
---
Examples
List English Posts
`bash
curl -H "X-API-KEY: your_key" "https://blog.nexwinds.com/api/public/en/posts"
`
Get Post Detail
`bash
curl -H "X-API-KEY: your_key" "https://blog.nexwinds.com/api/public/pt/posts/meu-post-incrivel"
``
Implementation Prompt
# NEXBLOG INTEGRATION PROMPT
Use this prompt to generate a high-performance, SEO-optimized blog frontend using the Nexblog Public API.
## Core Requirements
- **Framework**: Next.js 15+ (App Router), TypeScript, Tailwind CSS.
- **Architecture**: SSG (Static Site Generation) with ISR (Incremental Static Regeneration).
- **Caching**: Use `export const revalidate = 600` (10 minutes) for all blog pages.
- **Data Fetching**:
- Perform all API calls in **Server Components**.
- **NEVER** expose the `X-API-KEY` to the client. Use environment variables (e.g., `NEXBLOG_API_KEY`).
- Use the RESTful path structure defined in `api.md`.
## Implementation Tasks
1. **Sitemap (`app/sitemap.ts`)**:
- Generate a sitemap by fetching the 50-100 most recent posts via `/api/public/:locale/posts?limit=100`.
- Access the list via `data.posts`.
2. **Blog Listing (`/blog`)**:
- Fetch post summaries from `/api/public/:locale/posts`.
- Expected response shape: `{ data: { posts: [...], pagination: { ... } } }`.
- Implement `generateMetadata` with a `CollectionPage` schema.
- Include JSON-LD `ItemList` for the post list.
3. **Post Detail (`/blog/[slug]`)**:
- Use `generateStaticParams` to pre-render the 20 most recent posts.
- Fetch rich post data from `/api/public/:locale/posts/:slug`.
- Expected response shape: `{ data: { id, title, content, ... } }`.
- Implement `generateMetadata` with `BlogPosting` schema and OpenGraph tags.
- Include JSON-LD `BlogPosting` structured data.
## Security Requirements
- **Server-Only Fetching**: All requests to `{baseUrl}/api/public/*` must include the `X-API-KEY` header and be executed on the server.
- **Environment Variables**:
- `NEXBLOG_API_KEY`: Your secret API key.
- `NEXT_PUBLIC_NEXBLOG_URL`: The base URL of your Nexblog instance.
## Performance Observation
- The API provides a **Summary View** for listings and a **Rich View** for details. Ensure you only fetch the detail data when on the individual post page to keep the listing payload small and fast.
- The API includes `Cache-Control` headers. Next.js will respect these headers when using `fetch`, but explicit `revalidate` constants are recommended for ISR consistency.