Skip to content

API reference

5 min read

Every endpoint Basehim core registers, with the scope an API key needs to call it. The REST API lives under /api/v1; the OAuth and MCP endpoints are at the root of your domain. For how authentication, responses and errors work, read the REST API guide first.

Apps add their own endpoints. Your site's admin lists everything installed under API → Reference, including app routes and AJAX actions.

Conventions

  • Base URL: https://your-site.com/api/v1
  • Single items are read by slug and changed by id: GET /posts/{slug}, PATCH /posts/{id}.
  • Lists take page and per_page (up to 100). They return {"data": [...], "meta": {"page", "per_page", "total", "last_page"}}.
  • Scope is what an API key needs. A JWT carries its user's role instead of scopes. Every write also needs the matching capability on the account, such as edit_posts or manage_users.

Public: no authentication

MethodPathPurpose
GET/postsPublished posts. q, author_id, page, per_page
GET/posts/{slug}One published post, with terms and seo
GET/pagesPublished pages
GET/pages/{slug}One published page
GET/search?q=Search published posts
GET/taxonomiesTaxonomies (category, tag…)
GET/taxonomies/{taxonomy}/termsTerms of one taxonomy
GET/menus/{slug}A menu with its items
GET/widget-areasWidget areas
GET/widget-areas/{area}One area with its widgets
GET/settings/publicPublic settings: title, tagline, formats, timezone, reading
GET/timeSite timezone, offset, formats and the current time
GET/time/convert?value=…&to=localConvert a time between UTC and the site timezone (to=local or to=utc)
GET/timezonesEvery timezone with its current offset
GET/posts/{slug}/commentsApproved comments on a post
POST/posts/{slug}/commentsSubmit a comment: content, author_name, author_email, author_url, parent_id
GET/schedule/run?token=Run due scheduled tasks (for cron; the token comes from GET /schedule)

Authentication

MethodPathScopePurpose
POST/auth/loginnonelogin (username or email), password, optional otp. Returns access_token, refresh_token, expires_in
POST/auth/refreshnonerefresh_token → a new token pair
POST/auth/logoutnonerefresh_token → revoke it
POST/auth/registernoneusername, email, password; only when registration is open
GET/menoneThe authenticated user
PATCH/meusers:writeUpdate your own profile (a new email or password needs current_password)
GET, POST, DELETE/me/avatarusers:read / users:writeYour profile photo (POST is a file upload)

Posts and pages

MethodPathScopePurpose
POST/postsposts:writeCreate a post
PUT, PATCH/posts/{id}posts:writeUpdate a post (only the fields sent)
DELETE/posts/{id}posts:writeMove a post to the trash
POST/pagesposts:writeCreate a page
PUT/pages/{id}posts:writeUpdate a page
DELETE/pages/{id}posts:writeMove a page to the trash

Body fields: title, content, content_format (html, markdown or blocks), excerpt, status (draft, pending or published), slug, comment_status, featured_media_id and term_ids. Responses may include a warnings array when HTML was filtered.

Media

MethodPathScopePurpose
GET/mediamedia:readThe library, paginated
POST/mediamedia:writeUpload: multipart file, plus title, alt_text and caption
PATCH/media/{id}media:writeUpdate title, alt_text, caption, description
DELETE/media/{id}media:writeDelete the file and its sizes

Taxonomies and terms

MethodPathScopePurpose
POST/taxonomies/{taxonomy}/termstaxonomies:writeCreate a term: name, slug, description, parent_id
PUT/terms/{id}taxonomies:writeUpdate a term
DELETE/terms/{id}taxonomies:writeDelete a term

Comments

MethodPathScopePurpose
GET/commentscomments:readEvery comment, newest first; filter with status, search, post_id
GET/comments/countscomments:readCounts by status
GET/comments/{id}comments:readOne comment
PATCH/comments/{id}/statuscomments:writestatus: approved, pending, spam or trash
DELETE/comments/{id}comments:writeDelete permanently
MethodPathScopePurpose
GET/menusmenus:readAll menus
POST/menusmenus:writeCreate a menu
PUT/menus/{id}menus:writeRename or relocate a menu
DELETE/menus/{id}menus:writeDelete a menu
GET/menus/{id}/itemsmenus:readItems of a menu
POST/menus/{id}/itemsmenus:writeAdd an item: title, url, parent_id, target
PUT/menu-items/{id}menus:writeUpdate an item
DELETE/menu-items/{id}menus:writeRemove an item

The public GET /menus/{slug} reads by slug; these manage menus by id.

Users

MethodPathScopePurpose
GET/usersusers:readUsers (administrators only)
GET/users/{id}users:readOne user: the full record for yourself and user managers, the public profile for others
POST/usersusers:writeCreate a user
PUT/users/{id}users:writeUpdate a user
DELETE/users/{id}users:writeDelete a user
GET, POST, DELETE/users/{id}/avatarusers:read / users:writeA user's profile photo

Settings, apps, cache and scheduling

MethodPathScopePurpose
GET/settingssettings:readAll settings by group (credentials come back as [redacted])
PUT/settingssettings:writeUpdate settings: {"group": {"key": "value"}}
GET/appssettings:readInstalled apps
GET/apps/{slug}settings:readOne app
POST/cache/flushsettings:writeClear the cache
GET/schedulesettings:readScheduled tasks, last sweep and meta.cron_url (needs manage_settings)
POST/schedule/{app}/{key}/runsettings:writeRun one task now

Activating, deactivating and uninstalling apps stay in the admin on purpose.

OAuth 2.1 (root level)

MethodPathPurpose
GET/.well-known/oauth-protected-resourceResource metadata (RFC 9728)
GET/.well-known/oauth-protected-resource/mcpThe same, at the path clients derive from the MCP URL
GET/.well-known/oauth-authorization-serverServer metadata (RFC 8414), including the scopes this site offers
GET/.well-known/openid-configurationThe same metadata at the OIDC discovery path
POST/oauth/registerDynamic client registration (RFC 7591)
GET, POST/oauth/authorizeSign-in and consent screen
POST/oauth/tokenExchange a code, or refresh

Grants: authorization_code with PKCE (S256) and refresh_token. Access tokens last 8 hours and refresh tokens 30 days.

MCP (root level)

MethodPathPurpose
GET/mcpDiscovery: transport, auth methods, metadata URL
POST/mcpJSON-RPC 2.0: initialize, tools/list, tools/call, resources/list, resources/read

Authenticate with an OAuth token or an API key. The tools and their scopes are listed in MCP and AI agents.

AJAX gateway

POST /ajax is for this site's own pages, signed in with the browser session. It isn't part of the token API. See AJAX actions.

Discovery files

PathContents
/sitemap.xmlEvery published post and page, categories, tags, authors
/feedRSS feed of recent posts
/robots.txtCrawler rules, including AI crawler choices
/llms.txt, /llms-full.txtThe site summarised for language models
/.well-known/ard.json, /.well-known/ai-catalog.jsonAgent resource catalog

See AI discovery.

Keep building

More guides, or jump straight into the API reference.

Discussion

Leave a comment