Overview#
HashTransit is a multi-tenant publishing platform. Authors and organizations write posts once; HashTransit delivers them to hashtransit.net (public posts) and to your sites through this API (public and private posts). The API is read-only, except for POST /v1/blogs, PUT /v1/blogs/:id and the view counter POST /v1/blogs/:slug/view, which let organization keys — and user keys whose owner has an author-family role — create and update unpublished posts and record reader views. It returns JSON and every request is authenticated with an API key.
Base URL & versioning#
- All endpoints below are relative to this base, e.g.
GET https://api.hashtransit.net/api/v1/blogs. Always use HTTPS. - The current version is v1 (
/api/v1/*). New fields and optional parameters may be added without a version bump — ignore fields you don't know. - Breaking changes are announced in the changelog. The 2026-09-26 release made API keys mandatory on v1 — see the migration guide.
Public vs private content#
Every post lives in a section, and each section is either public or private. A post is only returned when it is published and its publish date has passed — drafts, pending, rejected and archived posts are never returned.
| Public post | Private post | |
|---|---|---|
| Section | public section | private section |
| On hashtransit.net, sitemap, RSS, llms.txt | yes | never |
| Readable via the API | by any valid key | only by keys of the post's organization (org key, or a user key of an active member) |
url | link to the post on hashtransit.net | null |
Use private sections for content that should appear only on your own site, and public sections for content you are happy to share with the HashTransit audience too.
Getting an API key#
There are two kinds of keys. Both can read content; organization keys and user keys whose owner has an author-family role can also create posts via POST /v1/blogs.
User keys#
- Register or log in.
- Open Profile → API Keys.
- Create a key with a name (1–60 characters, e.g.
acme-website-prod) and an optional expiry (1–365 days). - Copy it immediately. The key starts with
htu_and is shown only once — HashTransit stores only a hash. If you lose it, revoke it and create a new one.
You can have up to 5 active keys. The list shows each key's name, prefix, creation date, last-used date and expiry. Revoking a key stops it immediately. Keys also stop working when they expire or the account is deactivated.
Organization keys#
- Log in with an account that is an admin of the organization.
- Open My Organizations and select the organization.
- In the API Key section click Generate (or Regenerate). The key starts with
ht_.
Each organization has one key. Regenerating replaces it and the old key stops working immediately. Organization keys do not expire; keys of inactive organizations cannot authenticate.
Which key should I use?#
| User key (htu_) | Organization key (ht_) | |
|---|---|---|
| Created by | any active registered user | organization admin |
| How many | up to 5 active per user | 1 per organization |
| Create posts | yes, if the owner has an author-family role (posts as themselves) | yes — always, in its own organization |
| Public posts (all authors/orgs) | yes | no — only its own org's posts |
| Private posts | of organizations where the owner is an active member | all published posts of that organization |
| Shown after creation | once only | in My Organizations |
| Expiry | optional, 1–365 days | none |
| Revocation | revoke individually | regenerate |
- Organization site showing only its own content → organization key.
- Aggregator or widget showing public HashTransit content, or experimenting → user key.
- Org member who wants public content plus their org's private posts → user key.
Authentication#
Send your key in the X-API-Key header on every request:
- On
/api/v1/*the header is the only accepted transport. A key in the query string (?apiKey=) is rejected with401 api_key_in_query_not_allowed— query strings leak into logs, proxies, analytics andRefererheaders. Authorization: Beareris reserved for hashtransit.net session tokens and is not accepted as an API key.- No key →
401 missing_api_key. Unknown, revoked or expired key →401 invalid_api_key. A key in the query string (?apiKey=or?api_key=) is rejected even if a valid header is also sent. Authentication runs before routing, so an unknown/v1path returns 401 without a key. - Repeated failed key attempts from one IP (60 per minute) are throttled with
429. - The legacy
/api/blogs/externalendpoints still accept?apiKey=but respond withDeprecation: trueand aWarningheader.
Call GET /v1/me to check which key you are using and what it can see.
Security best practices#
Your API key is a secret
- Keep keys server-side: call the API from your backend, a serverless function, or at build time.
- Use environment variables (e.g.
HASHTRANSIT_API_KEY) or a secret manager; keep.envfiles out of version control. - One key per integration and environment so a leak can be revoked without breaking everything else. Set an expiry on keys used for experiments.
- Rotate periodically and revoke immediately if a key may have leaked. Watch the last-used date on the API Keys page.
- Only send keys over HTTPS.
Proxy pattern#
If a browser or mobile app needs HashTransit content, have it call your server, which adds the key and caches the response. Expose only the parameters your front end needs.
Endpoints#
All v1 endpoints require the X-API-Key header and return JSON with "success": true on success. Reads are GET; the write routes are POST /v1/blogs and PUT /v1/blogs/:id (organization keys, and user keys whose owner has an author-family role), plus POST /v1/blogs/:slug/view to count reader views from your site. API reads do not increment a post's viewCount.
| Endpoint | Purpose |
|---|---|
GET /v1/blogs | Latest posts in your key's scope, with filters |
GET /v1/blogs/:slug | One post by slug |
POST /v1/blogs/:slug/view | Count one reader view on your site (adds to the same viewCount) |
POST /v1/blogs | Create a post (draft or pending approval) — org keys in their org, author-role user keys as themselves |
PUT /v1/blogs/:id | Update an unpublished post (draft or pending approval) |
GET /v1/me | Describe the calling key |
GET /v1/sections | Sections with at least one post you can read |
GET /v1/categories | Active categories |
GET /v1/organizations/:id/blogs | Posts of one organization |
List blogs#
Returns the posts your key can read, newest first by default. Every item is a Blog object.
Query parameters (all optional)
| Param | Type | Default | Description |
|---|---|---|---|
page | integer ≥ 1 | 1 | Page number |
limit | integer 1–100 | 10 | Items per page; values above 100 are clamped to 100 |
section | section slug | — | Only posts in this section |
category | category slug | — | Only posts in this category |
locale | en | es | — | Only posts in this language |
author | username | — | Only posts by this author |
organization | integer | — | Only this organization's posts. Org key: its own organization only. User key: all posts of organizations you belong to, or only the public posts of any other active organization. Unknown/inactive organization → 403 out_of_scope |
q | string, 2–100 chars | — | Search title, summary and keywords (not full content) |
from | ISO-8601 date or date-time | — | Inclusive lower bound on publishedAt; a date means 00:00 UTC |
to | ISO-8601 date or date-time | — | Inclusive upper bound on publishedAt; a date covers the whole UTC day |
sort | latest | oldest | popular | latest | popular = most viewed first. Ties are broken by id (deterministic paging) |
includeContent | true | false | true | false omits content for lightweight lists |
Example request
Example response — 200 OK
filters echoes the filters that were applied.
Errors
400 invalid_parameter, 403 out_of_scope (with organization), 401 (missing/invalid key), 429 rate_limited.
Get blog#
Returns one post, always including content.
| Path param | Description |
|---|---|
slug | The post's slug, e.g. five-ways-edge-caching-cuts-latency |
Example request
Example response — 200 OK
Errors
404 not_found — the post does not exist, is not published yet, or is outside your key's scope (the API does not reveal whether a private post exists). 401 (missing/invalid key), 429 rate_limited.
View tracking#
Counts one reader view and returns the new total. Call it from your server when a person actually opens the article — views recorded here increment the same viewCount that hashtransit.net displays, so syndicated posts rank correctly in sort=popular and "Most Read".
Why an explicit endpoint?
GET /v1/blogs, GET /v1/blogs/:slug) never increment the counter, so crawlers, caches and previews cannot inflate it. Only posts inside the key's scope and already published are counted (organization keys also count their private-section posts). Never expose the API key in browser code — call this from your backend.Example request
Example response — 200 OK
Errors
400 invalid_parameter (bad slug), 404 not_found (outside scope / not published), 401 (missing/invalid key), 429 rate_limited.
Create blog#
Both key types can create — attribution differs
ht_…) can always create: organizationId is forced to the key's organization, and the optional authorId attributes the post to an active member of it. User keys (htu_…) can create only when their owner has an author-family role (admin, author-org, author, author-premium, author-staff, author-staff-og — otherwise 403 author_role_required) and always post as themselves; author-org owners must also send an organizationId (403 organization_required). Every post is created as draft or pending_approval (default) — posts are never published through the API; publishing always goes through HashTransit's approval flow.Creates a post. With an organization key the post is created in the key's own organization (organizationId is derived from the key); with a user key the author is the key owner and organizationId is optional. This lets organizations and authors publish into HashTransit from an external CMS, scheduler, or script using only an API key — no JWT login required.
Request fields
Send multipart/form-data (so a cover image file can be attached) or application/json (no file).
| Field | Required | Type | Notes |
|---|---|---|---|
title | yes | string | Sanitized as plain text, max 255 chars |
content | yes | string (HTML) | Sanitized with the same allowlist as the site editor |
sectionId | yes | integer | Must reference an active section; otherwise 422 section_inactive |
organizationId | no (user keys) | integer | User keys only: an organization the key owner actively belongs to (else 403 out_of_scope); omit for a site-wide post. Organization keys cannot set it — it is forced to the key's organization. |
status | no | draft | pending_approval | Defaults to pending_approval. Anything else (e.g. published) → 422 status_not_allowed — publishing always goes through HashTransit's approval flow. |
summary | no | string | Plain text |
keywords | no | string | Comma-separated, max 500 chars |
categoryId | no | integer | Must reference an existing category |
locale | no | en | es | Defaults to en |
publishToSite | no | boolean | Default true. false = org-only delivery — never appears on hashtransit.net, the sitemap, RSS or llms.txt |
customSlug | no | string | Slugified; must produce a valid slug |
authorId | no | integer | Organization key: if provided, must be an active member of the organization; if omitted, the post has no user author (the organization is the publisher of record). User key: the author is always the key owner — a different authorId → 422 author_mismatch. |
coAuthors | no | array (max 5) | [{ "userId": 12 }, { "name": "Jane Doe" }]. In multipart requests send it as a JSON string. See Co-authors. |
coverImage | no | file | Multipart file upload — uploaded to our CDN (S3 or local /uploads/blogs) and auto-optimized server-side (resized to ≤2000px, EXIF orientation applied, recompressed ~q80, EXIF/GPS metadata stripped; JPEG/PNG/GIF/WebP, max 5 MB). Ignored for JSON requests. |
Example request
Example response — 201 Created
Write responses use the Blog object shape plus status, createdAt and the flat id fields (organizationId, sectionId, authorId). The nested author, section, category, organization and url are null until the post is published — read the full object with GET /v1/blogs/:slug afterwards.
The created post appears in the pending-approval queue in the dashboard (unless created as a draft). Once approved, it is published and becomes readable through the GET endpoints (and on hashtransit.net if the section is public).
Errors
| HTTP | code | Cause |
|---|---|---|
| 403 | out_of_scope | User key: organizationId is not an organization the key owner actively belongs to |
| 403 | author_role_required | User key whose owner has no author-family role (admin, author, author-premium, author-staff, author-staff-og) |
| 400 | invalid_parameter | Missing/invalid title, content, sectionId; invalid locale, categoryId, customSlug; authorId is not an active member of the org |
| 403 | organization_required | User key with the author-org role and no organizationId |
| 422 | section_not_found | sectionId does not reference an existing section |
| 422 | section_inactive | sectionId references an inactive section |
| 422 | category_not_found | categoryId does not reference an existing category |
| 400 | invalid_parameter | Invalid coAuthors (message starts with Invalid parameter "coAuthors"), or a cover image rejected by the upload filter (wrong type or over 5 MB) |
| 422 | invalid_parameter | The cover image is not a decodable image |
| 422 | status_not_allowed | status is not draft or pending_approval — publishing always goes through the approval flow |
| 422 | author_mismatch | User key: authorId does not match the key owner |
| 401 | missing_api_key | No X-API-Key header |
| 401 | invalid_api_key | Invalid, revoked or expired key |
| 429 | rate_limited | More than 30 posts per hour or 120 requests/minute on this key — see Rate limits |
Update blog#
Updates an unpublished post. An organization key can update any post whose primary organization is its own; a user key can update only posts it authored itself. Editing is allowed only while the post is draft or pending_approval — published, rejected or archived posts return 422 post_not_editable.
| Path param | Description |
|---|---|
id | Numeric post id, as returned by POST /v1/blogs |
Request fields
Send only the fields you want to change — title, content, sectionId, summary, keywords, categoryId (empty string or null clears it), locale, publishToSite, customSlug, coAuthors and coverImage — as multipart/form-data (so a cover image file can be attached) or application/json (no file). status, organizationId, authorId, publishedAt and translationGroupId are not editable via the API and are silently ignored. The slug regenerates from the title when the title changes, unless customSlug is provided.
Example request
Example response — 200 OK
Errors
| HTTP | code | Cause |
|---|---|---|
| 404 | blog_not_found | No post with this id |
| 403 | out_of_scope | The post is outside your key's scope — an org key can only update posts of its own organization, a user key only posts it authored |
| 422 | post_not_editable | The post is not in draft or pending_approval status |
| 401 | missing_api_key | No X-API-Key header |
| 401 | invalid_api_key | Invalid, revoked or expired key |
| 422 | section_not_found | Also section_inactive and category_not_found for an unusable sectionId / categoryId |
| 400 | invalid_parameter | Invalid field, including invalid coAuthors |
| 429 | rate_limited | More than 120 requests/minute on this key (updates are not covered by the 30-posts/hour create limit) |
Co-authors#
A post can credit up to 5 co-authors besides its primary author (shown as "By A, B & C" on hashtransit.net). Send coAuthors on POST /v1/blogs and PUT /v1/blogs/:id:
| Entry | Meaning |
|---|---|
{ "userId": 12 } | An existing, active HashTransit user. Their display name is resolved on our side (full name, else username); a name sent alongside is ignored. Registered co-authors link to their author page. |
{ "name": "Jane Doe" } | Free text: HTML, control and invisible/bidi characters are stripped, whitespace collapsed; 2–100 characters and at least one letter or digit (the raw value may not exceed 1000 characters). Shown as plain text (no link, no avatar). |
- At most 5 entries after duplicates (same
userId, or same name ignoring case) are collapsed. - The post's own author cannot also be a co-author. Unknown or deactivated
userId→400. - Co-authors are credits only: no edit rights, and (for now) no notification or consent step.
POST: omit for none.PUT: field present → replace the whole list ([],nullor""clears it); field absent → unchanged.multipart/form-datacarries the array as a JSON string; JSON bodies send a real array.
Invalid input returns 400 invalid_parameter with a message starting Invalid parameter "coAuthors" (for example A post can have at most 5 co-authors or The post author cannot also be listed as a co-author). Branch on the code, not the text.
Reading co-authors
Every Blog object has coAuthors — always an array, in display order. username and avatar are null for free-text co-authors and for accounts deactivated or deleted after the post was written (the credit stays as plain text). A registered co-author's name follows the user's current name while the account is active. The API never exposes a co-author's user id or e-mail.
Me#
Describes the calling key: its type (user or organization), its owner, the organizations whose private posts it can read, whether it can create posts (canWrite), and its rate limit. Useful as a health check at deploy time.
Example response (user key, illustrative)
For an organization key, type is "organization", owner is { id, name } of the organization, and the key sees only its own organization's posts. canWrite is always true for organization keys; for user keys it is true when the owner has an author-family role (admin, author-org, author, author-premium, author-staff, author-staff-og), and owner is { username, role }.
Errors
401 (missing/invalid key), 429 rate_limited.
Sections#
Lists the sections that contain at least one post your key can read — handy for navigation. Use the slug as the section filter.
Example response (illustrative)
Errors
401 (missing/invalid key), 429 rate_limited.
Categories#
Lists all active categories (platform-wide). nameEs is the Spanish label and color a hex colour for badges. Use the slug as the category filter.
Example response (illustrative)
Errors
401 (missing/invalid key), 429 rate_limited.
Organization blogs#
Equivalent to /v1/blogs?organization=:id: same query parameters, same response shape.
Errors
403 out_of_scope if the organization is not in your key's scope (an org key can only request its own organization), 400 invalid_parameter if id is not an integer, 401 (missing/invalid key), 429 rate_limited.
Filters#
Filters on /v1/blogs and /v1/organizations/:id/blogs combine with AND. They only narrow your key's scope, never widen it.
- Invalid values are rejected with
400 invalid_parameter(e.g.locale=fr,sort=random,page=0,q=a). Nothing is silently ignored — exceptlimit, which is clamped to 100. sectionandcategoryare slugs (from/v1/sectionsand/v1/categories);authoris a username;organizationis an integer id.qsearches title, summary and keywords (not the body), 2–100 characters. URL-encode it.from/toare ISO-8601 dates or date-times forming an inclusive range onpublishedAt.includeContent=falsedropscontentfrom every item — much smaller responses for lists and widgets.
Recipes#
| Goal | Request |
|---|---|
| Latest 5 posts (lightweight) | GET /v1/blogs?limit=5&includeContent=false |
| Spanish posts in one section | GET /v1/blogs?section=technology&locale=es |
| Monthly archive (March 2026) | GET /v1/blogs?from=2026-03-01T00:00:00Z&to=2026-03-31T23:59:59Z&sort=oldest&limit=100 |
| Search | GET /v1/blogs?q=edge%20caching&limit=10 |
| Most popular posts | GET /v1/blogs?sort=popular&limit=5&includeContent=false |
| An author in a category | GET /v1/blogs?author=janedoe&category=web-development |
Recommended: list page + detail page
GET /v1/blogs?limit=20&includeContent=false (title, summary, cover, date) and article pages from GET /v1/blogs/:slug. List responses stay small and the two page types can be cached independently.Pagination & sorting#
- Request pages with
page(1-based) andlimit(1–100, default 10). There are more pages whilecurrentPage < totalPages. - Pagination is offset-based: posts published while you paginate shift items between pages. For full syncs, sort by
oldestand/or usefrom/towindows.
| sort | Order |
|---|---|
latest | newest publishedAt first (default) |
oldest | oldest publishedAt first |
popular | highest viewCount first |
The Blog object#
Every endpoint that returns posts — including the legacy /api/blogs/external — uses the same shape.
| Field | Type | Description |
|---|---|---|
id | integer | Post id |
title | string | Title |
slug | string | URL-safe identifier |
summary | string | null | Short summary — a good meta description |
content | string (HTML) | Sanitized HTML. Omitted when includeContent=false |
keywords | string | null | Comma-separated keywords |
coverImage | string | null | Cover image URL |
locale | "en" | "es" | Language of the post |
publishedAt | ISO-8601 | Publication date-time (UTC) |
updatedAt | ISO-8601 | Last modification date-time (UTC) |
viewCount | integer | Views on hashtransit.net (API reads are not counted) |
url | string | null | Canonical URL on hashtransit.net only for public posts; null for private posts |
translations | array | Other-language versions inside your key's scope: { locale, slug, id } |
author | object | { username, fullName, avatar } |
section | object | { name, slug } |
category | object | null | { id, name, nameEs, slug, color } |
organization | object | null | { id, name } |
coAuthors | array | Credited co-authors in display order: { name, username, avatar } (null username/avatar for free-text names). Always present. See Co-authors. |
Never included: author e-mail, id or role; co-author ids or e-mails; moderation data; organization API keys or tracking configuration; internal foreign-key ids. publishToSite is write-only (create/update): read responses do not echo it — an org-only post simply has url: null.
Errors#
Errors use one envelope with a machine-readable code. Branch on error.code, not on message.
| HTTP | code | Meaning | What to do |
|---|---|---|---|
| 400 | invalid_parameter | A query, path or body parameter is invalid (incl. coAuthors, rejected cover image) | Fix the request; message names the parameter |
| 401 | missing_api_key | No X-API-Key header | Send the header |
| 401 | invalid_api_key | Unknown, revoked or expired key, or deactivated owner | Check or replace the key |
| 401 | api_key_in_query_not_allowed | Key sent as ?apiKey= on v1 | Move it to the header |
| 403 | out_of_scope | Organization / write target not in your key's scope | Use a key with access |
| 403 | author_role_required | User-key write, but the owner has no author-family role | Grant the author role |
| 403 | organization_required | author-org user key created a post without organizationId | Send an organization the owner belongs to |
| 404 | not_found | Post does not exist or is not visible to your key (blog_not_found on updates) | Treat as gone |
| 422 | status_not_allowed | Write tried a status other than draft / pending_approval | Use the approval flow |
| 422 | post_not_editable | PUT on a published or archived post | Edit on hashtransit.net |
| 422 | section_not_found | Also section_inactive, category_not_found, author_mismatch — invalid write payload | Fix the field named in message |
| 413 / 422 | invalid_parameter | JSON body over 1 MB (413) or an undecodable cover image (422) | Send a smaller body / a real image |
| 429 | rate_limited | Too many requests (120/min per key, 30 posts/hour, 30 views/min per post, 60 failed keys/min per IP) | Wait Retry-After and retry |
| 500 | internal_error | Unexpected server error (no internals exposed) | Retry later with backoff |
Rate limits#
| Scope | Limit |
|---|---|
Requests with an API key (/api/v1/*, /api/blogs/external*) — reads and writes | 120 requests / minute per key |
POST /v1/blogs | additionally 30 posts / hour per key |
POST /v1/blogs/:slug/view | additionally 30 views / minute per key per post |
| Failed key attempts (401) from one IP | 60 / minute (no rate-limit headers) |
Limits are counted per API key, in fixed windows. PUT /v1/blogs/:id only counts against the general 120 requests/minute. Responses carry standard (IETF draft-6) headers:
| Header | Meaning |
|---|---|
RateLimit-Policy | Limit and window of the limiter that produced the headers, e.g. 120;w=60 |
RateLimit-Limit | Requests allowed in the current window |
RateLimit-Remaining | Requests left in the current window |
RateLimit-Reset | Seconds until the window resets |
Retry-After | Only on 429 — seconds to wait before retrying |
When a route has two limits (create, view) the RateLimit-* headers describe the more specific one — check RateLimit-Policy. The failed-key limiter sends no rate-limit headers and no Retry-After; wait a minute. Exceeding a limit returns 429 with rate_limited (the message names the limit); 429 responses are never cached:
Wait Retry-After (else RateLimit-Reset) seconds, retry with exponential backoff and jitter, and — above all — cache and use conditional requests.
Caching#
- Cache on your server: lists for 5–15 minutes, articles for 15–60 minutes.
- Next.js:
fetch(url, { next: { revalidate: 600 } })orexport const revalidate = 600(ISR). - Other stacks: an in-memory or Redis cache keyed by URL, or a CDN in front of your proxy.
- Static sites: fetch at build time and rebuild on a schedule.
- Serve stale content if the API is temporarily unavailable rather than showing an error page.
- Use
includeContent=falsefor list pages — much smaller responses.
HTTP caching headers
| Endpoints | Cache-Control | Vary |
|---|---|---|
GET /v1/* and GET /blogs/external* (API-key reads), status 200 | private, max-age=30, stale-while-revalidate=60 | X-API-Key |
| Writes (POST / PUT), view tracking, and every non-200 response (errors, 429) | no-store | — |
Never put a shared cache in front of /api/v1 unkeyed
private means CDNs and proxies must not store these responses: they depend on your key and may contain private-section posts. If you add a CDN or reverse proxy, include X-API-Key in the cache key or bypass the cache whenever that header is present.Conditional requests (ETag)#
Every GET 200 response carries a weak ETag. Send it back as If-None-Match and an unchanged response is answered with 304 Not Modified and an empty body. It still counts towards your rate limit, but saves bandwidth and parsing.
- The ETag is a hash of the response body, so it changes when anything in the response changes (including a listed post's
viewCount). It is weak (W/"…") because responses may be gzip-compressed — send it back unchanged. - Use the full URL (query string included) as the cache key, and keep one cache per API key.
- Site endpoints used by hashtransit.net itself (not part of the v1 contract) follow the same rules; anonymous public lists are
public, max-age=60, s-maxage=300, and any request carrying anAuthorizationorX-API-Keyheader isno-store.GET /api/blogs/publishedalso acceptsincludeContent=false.
Rendering content#
content is HTML that HashTransit sanitizes when posts are saved. Treat third-party HTML defensively anyway and sanitize again on your side — DOMPurify (isomorphic-dompurify on the server) for JavaScript, HTML Purifier for PHP, nh3 or bleach for Python. Always escape plain-text fields such as title and summary.
Images: coverImage and author.avatar are absolute URLs or null. Provide a fallback, reserve space to avoid layout shift, and use the title as alt when you have nothing better. With next/image, add the image host to images.remotePatterns. Post bodies may also contain inline <img> tags (https:// or site-relative src only; attributes src, alt, title, width, height, loading) — prefix site-relative paths with the HashTransit host and constrain them with max-width: 100%. Before 2026-09-26 the legacy endpoint could return relative paths; if you stored any, prefix them with https://www.hashtransit.net.
Translations: translations lists sibling posts (en ↔ es) your key can read. Fetch them with GET /v1/blogs/:slug and link language versions with hreflang:
Bilingual content: filtering by language#
If your site serves readers in both English and Spanish (e.g., a language toggle in the header), use the locale filter to fetch only the posts in the user's language. This is the recommended pattern — no client-side deduplication is needed.
Server-side pattern (language toggle): detect the user's language from the URL path, cookie, or Accept-Language header, pass it to the API, and re-fetch when the user toggles:
What about posts with only one language?
translationGroupId = null or a group with no sibling. The locale filter handles this correctly: ?locale=en → the post appears; ?locale=es → the post does not appear (it's not Spanish). This is correct — a Spanish visitor should not see an English article. To reach both audiences, authors must publish in both languages and link them with the same translationGroupId. Posts that exist in only one language are invisible to the other language's audience.Do I need “one per translation group” deduplication? No — not if you use the locale filter. The filter already returns one language per post, so there's nothing to deduplicate. The translations array on each post tells you a sibling exists (so you can link to it with hreflang), but you don't need to fetch or display it in the same list.
SEO for syndicated content#
When the same article is on hashtransit.net and your site, search engines see duplicate content and pick one URL to rank. Decide deliberately which one that is.
Public posts (url is not null)
Private posts (url is null)
- Use
summaryas the meta description,titleas the page title,coverImageasog:image. - Set the page language from
localeand addhreflanglinks for translations. - Add
BlogPostingstructured data, withmainEntityOfPageequal to your canonical URL:
Code examples#
All examples read the key from the HASHTRANSIT_API_KEY environment variable and run on the server. The JavaScript example needs Node 18+ (built-in fetch); Python needs requests.
Next.js (App Router)#
A server-rendered list and article page with ISR (10 minutes). The key never reaches the browser, and the article page sets its canonical from url.
Legacy external API#
GET /api/blogs/external and GET /api/blogs/external/:slug predate v1. They keep working, accept organization and user keys, and return the shared Blog object, but are frozen — new integrations should use v1.
| Param | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
limit | integer 1–100 | 10 | Items per page (clamped to 100) |
section | integer or slug | — | Section id or slug |
locale | en | es | — | Language filter (other values → 400) |
Prefer the X-API-Key header. ?apiKey= still works here but is deprecated (responses carry Deprecation: true and a Warning header). The same rate limit applies.
Migration guide#
From anonymous /api/v1 (before 2026-09-26)#
- An API key is required on every
/api/v1/*request, in theX-API-Keyheader. Anonymous calls get401 missing_api_key. - Pagination moved into a
paginationobject: top-levelcount,totalPages,currentPage→pagination.totalItems,pagination.totalPages,pagination.currentPage,pagination.itemsPerPage. - Blog objects use the shared shape. Removed:
author.id,section.id,organization.logo,createdAt. Added:keywords,locale,url,translations,category,organization,updatedAt. organizationId→organization(or/v1/organizations/:id/blogs).- Invalid parameters return
400 invalid_parameterinstead of being ignored. - Errors use
{ success: false, error: { code, message } }. - Private-section posts are only returned to keys of their organization.
- API reads no longer increment
viewCount.
From /api/blogs/external?apiKey=#
- Move the key from the query string to the
X-API-Keyheader. - Consider switching to
/api/v1/blogs:blogsandpaginationhave the same shape; the top-levelorganizationis replaced by each post's ownorganization; you gain slug filters, search, date ranges, sorting andincludeContent. - Keep your key server-side.
Changelog#
2026-11-11#
No change to the v1 contract — existing clients need no code change.
- Scheduled posts: a post scheduled on hashtransit.net is
publishedwith a futurepublishedAt, so it is invisible to every v1 read (list, detail, organization blogs, view tracking) until that time and then appears automatically. v1 writes still never publish or schedule:status,publishedAtandscheduledAtare not accepted via API keys and are ignored. - Changed:
PUT /v1/blogs/:idnow also refreshes the HashTransit front-end cache for the edited post (no response change).
2026-11-06#
All changes are additive — ignore fields you don't know and existing clients keep working.
- New: co-authors —
coAuthorsonPOST /v1/blogsandPUT /v1/blogs/:id(array of{ userId }or{ name }, max 5;PUT: present = replace all, absent = unchanged). Every Blog object now hascoAuthors(never user ids or e-mails). - New: write rate limits —
POST /v1/blogsis limited to 30 posts per hour per key;POST /v1/blogs/:slug/viewto 30 per minute per key per post (on top of 120 requests/minute).429responses carryRetry-After. - New: HTTP caching — weak
ETagandIf-None-Match→304on everyGET; API-key reads areprivate, max-age=30, stale-while-revalidate=60withVary: X-API-Key; writes and errors areno-store. - Changed: post bodies may contain inline
<img>(https / site-relative only); uploaded images get their EXIF orientation applied before metadata is stripped. - Docs fixes: write responses, the
/v1/meshape and error codes are documented exactly;author-orgis an author-family role (403 organization_requiredwithout an organization);publishToSiteis write-only;section_not_foundis422;PUTignoresstatusandauthorId.
2026-10-29#
- Docs: Bilingual content — filtering by language with
localefor sites with a language toggle.
2026-10-25#
- New:
POST /v1/blogs/:slug/view— count one reader view from your site; GET reads never increment the counter.
2026-10-01#
- New:
POST /v1/blogsaccepts user keys whose owner has an author-family role (they post as themselves; optionalorganizationIdmust be an organization they actively belong to), plus an optionalstatusfield (draft|pending_approval, defaultpending_approval— publishing still always goes through HashTransit's approval flow). - New:
PUT /v1/blogs/:id— update an unpublished post (draft orpending_approval). Org keys update their organization's posts; user keys update their own posts. - New:
GET /v1/mereturnscanWriteand, for user keys, the owner'srole. - Changed:
sectionIdonPOST /v1/blogsmust reference an active section (422 section_inactiveotherwise).
2026-09-27#
- New:
POST /v1/blogs— an organization API key can create a post in its own organization. Posts are alwayspending_approval(an org admin/staff must approve).organizationIdis derived from the key. OptionalauthorIdmust be an active org member. Cover image is uploaded to our CDN via multipart. - Schema:
Blog.authorIdis now nullable (posts created via an org key without anauthorIdhave no user author; the organization is the publisher of record).
2026-09-26#
- Breaking:
/api/v1/*requires an API key in theX-API-Keyheader; query-string keys are rejected. - Breaking: v1 list responses use a
paginationobject and the shared Blog object. - Breaking: errors use
{ success: false, error: { code, message } }. - New: personal user API keys (
htu_) under Profile → API Keys. - New:
GET /v1/me,GET /v1/sections,GET /v1/categories. - New: filters
section,category,locale,author,organization,q,from,to,sort,includeContent. - New: rate limiting (120 requests/minute per key) with
RateLimit-*headers. - Changed: private-section posts are only returned to keys of their organization and no longer appear on hashtransit.net, its sitemap or RSS.
- Changed: post HTML is sanitized on save; API reads no longer increment
viewCount. - Deprecated:
?apiKey=on/api/blogs/external*.
Need an API key?
