API Documentation

Integrate HashTransit content into your websites and applications using our REST API. Public endpoints for reading published blogs, and private API-key endpoints for organization content distribution.

Base URL

https://api.hashtransit.net/api

All API endpoints are prefixed with https://api.hashtransit.net/api. In development, use http://localhost:5000/api instead.

Authentication

Public Endpoints (v1 API)

The /v1 API endpoints are public and do not require authentication. They return all published blogs across the platform.

Private Endpoints (Organization API)

The /blogs/external endpoints require an API key. Pass it via the X-API-Key header or ?apiKey= query parameter. API keys are generated by organization admins from the My Organizations page.

Public API (v1)

These endpoints return all published blogs on the platform. No authentication required.

GET

/v1/blogs

Get All Published Blogs

Retrieves a paginated list of all published blogs.

Query Parameters

ParameterTypeDefaultDescription
limitnumber10Number of blogs to return
pagenumber1Page number for pagination
organizationIdnumberFilter blogs by organization ID

Example Response

{ "success": true, "count": 15, "totalPages": 3, "currentPage": 1, "blogs": [ { "id": 1, "title": "Introduction to HashTransit", "slug": "introduction-to-hashtransit", "summary": "Learn about the HashTransit platform", "coverImage": "/uploads/blogs/cover.jpg", "publishedAt": "2025-07-06T12:00:00.000Z", "author": { "username": "johndoe", "fullName": "John Doe" }, "section": { "name": "Technology", "slug": "technology" } } ] }
GET

/v1/blogs/:slug

Get Blog by Slug

Retrieves a single published blog by its slug, including full content.

GET

/v1/organizations/:id/blogs

Get Organization Blogs

Retrieves all published blogs for a specific organization.

ParameterTypeDefaultDescription
limitnumber10Number of blogs to return
pagenumber1Page number for pagination

Private API (Organization Content)

These endpoints return published blogs for a specific organization, authenticated via API key.

GET

/blogs/external

Get Organization Blogs by API Key

Retrieves all published blogs for the organization associated with the provided API key. Includes translation group information for multi-language content.

Headers

HeaderTypeRequiredDescription
X-API-KeystringYes*Organization API key

* Alternatively, pass ?apiKey= as a query parameter.

Query Parameters

ParameterTypeDefaultDescription
limitnumber10Number of blogs to return
pagenumber1Page number for pagination
sectionnumberFilter by section ID
localestringFilter by language (en, es)

Example Response

{ "organization": { "id": 1, "name": "HashTransit Inc." }, "blogs": [ { "id": 1, "title": "Introduction to HashTransit", "slug": "introduction-to-hashtransit", "summary": "Learn about the platform", "content": "<p>Full HTML content...</p>", "keywords": "blog, cms, api", "coverImage": "/uploads/blogs/cover.jpg", "publishedAt": "2025-07-06T12:00:00.000Z", "viewCount": 42, "locale": "en", "translations": [ { "locale": "es", "slug": "introduccion-a-hashtransit", "id": 2 } ], "author": { "username": "johndoe", "fullName": "John Doe" }, "section": { "name": "Technology", "slug": "technology" }, "category": { "name": "Web Dev", "slug": "web-dev", "color": "#3b82f6" } } ], "pagination": { "totalItems": 15, "totalPages": 2, "currentPage": 1, "itemsPerPage": 10 } }
GET

/blogs/external/:slug

Get Single Blog by Slug (API Key)

Retrieves a single published blog by slug for the organization associated with the API key. Requires the same X-API-Key header or ?apiKey= query parameter.

Error Responses

All endpoints return a standard error format:

{ "success": false, "message": "Error message description", "error": "Detailed error information" }
Status CodeDescription
200Success
400Bad Request — invalid parameters
401Unauthorized — missing or invalid API key
404Not Found — resource does not exist
500Internal Server Error

Code Example

Fetch organization blogs using JavaScript:

// Fetch blogs from your organization async function fetchBlogs(apiKey, page = 1, limit = 10) { const response = await fetch( 'https://api.hashtransit.net/api/blogs/external?page=' + page + '&limit=' + limit, { headers: { 'X-API-Key': apiKey } } ); const data = await response.json(); return data; } // Usage const apiKey = 'your-organization-api-key'; const result = await fetchBlogs(apiKey); console.log(result.blogs); // Array of blog posts console.log(result.pagination); // Pagination metadata

CORS & Rate Limiting

CORS: The API supports Cross-Origin Resource Sharing for all origins, allowing it to be consumed from any website or web application.

Rate Limiting: No rate limits are currently enforced. Consider caching responses on the client side to reduce server load.

Need an API Key?

Organization admins can generate and manage API keys from the My Organizations page.