Skip to content

Complete API reference

B Basehim 5 min read

Every endpoint Basehim exposes, verified against a running install. The REST API lives under /api/v1; the OAuth and MCP endpoints sit at the root of your domain, outside it.

For an introduction to what the API is for, read The API first. This page is the exhaustive list.

Conventions

  • Base URLhttps://your-site.com/api/v1
  • Success responses are wrapped in a data envelope: {"data": …}
  • Errors follow RFC 7807 problem details: {"type", "title", "status", "detail"}
  • Single items are fetched by slug; updates and deletes address them by id. This catches people out — GET /posts/hello-world but DELETE /posts/12.
  • List endpoints accept page, per_page, status, q and author_id.

Authentication

Three ways in, for three different callers:

  • API keyAuthorization: Bearer basehim_…. Generated in the admin. Best for scripts and server-to-server work.
  • JWTPOST /api/v1/auth/login returns a token; refresh it at /auth/refresh. Best for apps acting on behalf of a signed-in person.
  • OAuth 2.1 — used by AI agents connecting over MCP. Supports dynamic client registration, so there is no client id or secret to configure by hand.

Reading published content needs no authentication at all. Anything that writes, or reads drafts, does.

Public endpoints — no authentication

MethodPathPurpose
GET/postsList published posts
GET/posts/{slug}A single post
GET/pagesList published pages
GET/pages/{slug}A single page
GET/search?q=Full-text search across posts and pages
GET/taxonomiesList taxonomies
GET/taxonomies/{taxonomy}/termsTerms within a taxonomy
GET/menus/{slug}A menu and its items
GET/widget-areasList widget areas
GET/widget-areas/{area}One area with its widgets
GET/settings/publicPublicly readable settings
GET/posts/{slug}/commentsComments on a post
POST/posts/{slug}/commentsSubmit a comment

Authentication endpoints

MethodPathPurpose
POST/auth/loginExchange credentials for a token
POST/auth/refreshRenew an expiring token
POST/auth/logoutInvalidate the current token
POST/auth/registerCreate an account, where registration is open
GET/meThe authenticated user
PATCH/meUpdate your own profile

Content

MethodPathPurpose
POST/postsCreate a post
PUT / PATCH/posts/{id}Update a post
DELETE/posts/{id}Trash a post
POST/pagesCreate a page
PUT/pages/{id}Update a page
DELETE/pages/{id}Trash a page

Media

MethodPathPurpose
GET/mediaBrowse the media library
POST/mediaUpload a file
PATCH/media/{id}Update alt text, caption and title
DELETE/media/{id}Delete a file

Taxonomies and terms

MethodPathPurpose
POST/taxonomies/{taxonomy}/termsCreate a category or tag
PUT/terms/{id}Update a term
DELETE/terms/{id}Delete a term

Comments

MethodPathPurpose
GET/commentsAll comments, newest first
GET/comments/countsCounts by status, for dashboards
GET/comments/{id}A single comment
PATCH/comments/{id}/statusApprove, unapprove, spam or trash
DELETE/comments/{id}Delete a comment

Menus

MethodPathPurpose
GET/menusList menus
POST/menusCreate a menu
PUT/menus/{id}Update a menu
DELETE/menus/{id}Delete a menu
GET/menus/{id}/itemsItems in a menu
POST/menus/{id}/itemsAdd an item
PUT/menu-items/{id}Update an item
DELETE/menu-items/{id}Remove an item

Note the split: /menus/{slug} reads a menu publicly by slug, while these manage menus by id.

Users

MethodPathPurpose
GET/usersList users
GET/users/{id}A single user
POST/usersCreate a user
PUT/users/{id}Update a user
DELETE/users/{id}Delete a user

Settings, apps, cache and scheduling

MethodPathPurpose
GET/settingsAll settings
PUT/settingsUpdate settings
GET/appsInstalled apps
GET/apps/{slug}One app's details
POST/cache/flushClear the cache
GET/scheduleList scheduled tasks
POST/schedule/{app}/{key}/runRun one task now
GET/schedule/runCron entry point

App lifecycle actions — activate, deactivate, uninstall — deliberately stay in the admin area rather than the API. /schedule/run sits outside the authenticated group on purpose: a crontab sends no cookies and holds no token, so it is guarded by an unguessable token instead.

Desktop agent API

MethodPathPurpose
POST/agents/registerFirst contact; mints the agent's token
POST/agents/{uuid}/heartbeatCheck in and collect commands
POST/agents/{uuid}/commands/{id}/ackAcknowledge a command

These authenticate with a per-agent bearer token validated against the {uuid} in the path, not a user session. /circuits/agents/* is an alias kept for existing desktop builds.

OAuth 2.1 — root level, not under /api/v1

MethodPathPurpose
GET/.well-known/oauth-protected-resourceResource metadata (RFC 9728)
GET/.well-known/oauth-protected-resource/mcpPath-suffixed variant clients derive from the MCP URL
GET/.well-known/oauth-authorization-serverServer metadata (RFC 8414)
GET/.well-known/openid-configurationSame metadata, OIDC discovery path
POST/oauth/registerDynamic client registration
GET / POST/oauth/authorizeConsent screen and approval
POST/oauth/tokenExchange a code, or refresh

Grants supported: authorization_code and refresh_token, with PKCE (S256).

MCP — root level

MethodPathPurpose
GET/mcpDiscovery: transport, auth methods, metadata URL
POST/mcpJSON-RPC 2.0 endpoint

Accepts either OAuth or a bearer API key. Add the /mcp URL as a custom connector in an AI assistant and it registers itself — there is no client id or secret to configure.

Scopes

Tokens carry scopes, and a token issued for one thing cannot do another. The current set:

posts:read · posts:write · taxonomies:read · taxonomies:write · media:read · comments:read · comments:write · settings:read · users:read

Installed apps can contribute their own scopes, so the list on your site may be longer than this one. Whatever your site advertises is authoritative — fetch /.well-known/oauth-authorization-server to see it.

A note on tokens

A token is a password. Keep it out of client-side code, out of public repositories and out of screenshots. Issue the narrowest scope that does the job, and a separate token per integration so one can be revoked without disturbing the others. If one leaks, revoke it in the admin — it stops working immediately.

Keep building

More guides, or jump straight into the API reference.

Discussion

Leave a comment