HTTP API: community portal
Part of the HTTP API reference. For building portals, see the Community portal guides.
Endpoints
Section titled “Endpoints”| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/v1/portal/servers |
none | {"items": [PortalServer]}: the servers with a portal. |
| GET | /api/v1/portal/{server} |
none | PortalServer (404 when the server has no portal). |
| GET | /api/v1/portal/{server}/logo |
none | The portal.theme.logo image (below). |
| GET | /api/v1/portal/{server}/banner |
none | The portal.banner image, same rules as the logo. |
| GET | /api/v1/portal/{server}/me |
member | {"user": User, "member": {"nick", "joinedAt", "roles": [{"key", "id", "name", "color"}]}, "role": "member" | "moderator" | "admin"} |
| GET | /api/v1/portal/{server}/analytics?period=7d|30d|90d |
per spec.analytics.portal |
Server-wide activity (default 30d). |
| ANY | /api/v1/portal/{server}/plugins/{bot}/{instance}/{path…} |
per route | Plugin routes. |
All portal endpoints answer 503 before the first revision. /portal/{server}/me answers
401 when anonymous and 403 when the caller is not a member. Member roles have key: ""
when they are not declared in YAML.
Activity
Section titled “Activity”GET /api/v1/portal/{server}/analytics shares the server’s activity with its community, when
the server opts in with spec.analytics.portal:
members (signed-in members of the server: 401 anonymous, 403 not a member) or public
(anyone). With off (the default) or without analytics, it answers 404.
{ "server": "ma-commu", "period": "30d", "from": "2026-10-27T00:00:00Z", "to": "2026-11-26T00:00:00Z", "since": "2026-08-01T14:00:00Z", "kpis": [{ "metric": "messages.sent", "value": 3121, "previous": 2870, "spark": [[1763424000, 98]] }], "topChannels": [{ "id": "112233445566778899", "name": "général", "value": 1840 }], "topBotCommands": [{ "bot": "Cicord", "command": "/rank", "value": 212 }], "heatmap": [[0, 0, 3], [1, 0, 0]]}kpis, in this order:members.total(human members, last value),members.joined,members.active(average per day),messages.sent,voice.seconds,reactions.added,bots.commandsandmembers.active.bots(average per day), each compared with the previous period (previousisnullwhen it is not covered), with onesparkpoint per day. The periods are whole UTC days ending today, as in the admin summary.topChannels: the 5 channels with the most messages among those@everyonecan see; private channels are never named nor counted there (themessages.sentKPI is server-wide).topBotCommands: the 8 most used commands of every bot of the server.heatmap[weekday][hour]: messages per weekday (0= Monday) and UTC hour.
@cicord/client: client.portal.analytics(server, period); @cicord/react:
usePortalAnalytics(period, server?).
PortalServer
Section titled “PortalServer”“Servers with a portal” are servers that declare spec.portal or run a plugin with routes.
{ "key": "ma-commu", "name": "Ma Commu", "iconUrl": "", "theme": { "primary": "#5865f2", "accent": "#eb459e", "logo": "/api/v1/portal/ma-commu/logo?v=3f2a9c1", "mode": "dark" }, "title": "Bienvenue sur Ma Commu", "tagline": "La commu francophone des soirées jeux…", "description": "Ici, on joue **ensemble**…", "banner": "/api/v1/portal/ma-commu/banner?v=3f2a9c1", "links": [ { "label": "Site web", "url": "https://ma-commu.example", "icon": "website" } ], "pages": { "onboarding": true, "profile": true, "leaderboard": true, "tickets": true }, "locale": "fr", "plugins": [ { "bot": "moderator", "instance": "onboarding", "plugin": "onboarding", "routes": ["GET /steps", "POST /complete"] } ] }themealways has its four fields (""= unset).theme.logois the logo endpoint (with?v=<revision id>, so caches follow new commits) or an absolute URL;modeislight,dark,systemor"".- The no-code fields of
spec.portal(Server → portal) are always present:title(default: the server name),tagline,description(Markdown subset source, rendered by the portal, never HTML),banner(liketheme.logo),links([{label, url, icon}];urlis http(s) by schema,icondefaults to"link"),pages({onboarding, profile, leaderboard, tickets}, unset =true) andlocale("en","fr"or""). pluginslists the instances on that server that declare routes.
Logo and banner
Section titled “Logo and banner”When portal.theme.logo (or portal.banner) is a repository file, the endpoint serves it.
The path is relative to the server YAML; the file must stay inside the repository, be reached
without symbolic links, be at most 10 MiB and be a png, jpg, gif, webp, avif or svg. A URL logo
redirects (302). Unset or invalid: 404.
Headers: Cache-Control: public, max-age=300,
Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox (a repository
SVG never runs script) and Cross-Origin-Resource-Policy: cross-origin (embedding sites may
display it).
Plugin routes
Section titled “Plugin routes”Routes declared with definePlugin({routes}) (see Plugin API) are
served under /api/v1/portal/{server}/plugins/{bot}/{instance}/{path…}. The JSON body and
response are passed through; an unknown route answers 404.
- Access (required on every route; a missing or unknown value fails at load time):
public(anyone; the viewer is still filled in when logged in),member,moderatororadmin, with the roles of the server (portal endpoints count the full role of link sessions and session tokens on their server). Anonymous:401; insufficient role:403. The runtime bearer token passes every check (no viewer). - Request: the handler receives
request.viewer = {user, member}(the member is fetched from Discord; after a route with an unsafe method the viewer’s cached member is dropped, so the next/portal/{server}/meshows roles the plugin just changed), the query parameters (first value of each) and the JSON body (at most 1 MiB; non-JSON:400; an empty body is no body). - Response: the handler’s status (default
200) and its JSON body asapplication/json; charset=utf-8withCache-Control: no-store, plus its headers exceptSet-Cookie,Content-Type,Content-Length,Transfer-Encoding,Connection,Location,Content-Security-Policy,Strict-Transport-SecurityandAccess-Control-*. No body:204(or the handler’s status when it is not 200). A thrown error answers500 internal(“the plugin route failed”).
Static UIs
Section titled “Static UIs”/adminredirects (301) to/admin/./admin/*serves the admin console and/*the portal, both with an SPA fallback toindex.html(Cache-Control: no-cache).- Hashed files under
assets/areCache-Control: public, max-age=31536000, immutable; other files areno-cache(revalidated withLast-Modified). A missing file with an extension (other than.html) is a plain404. Content types come from the file extension. - Custom portal: when
cicord.yamlspec.portal.pathof the active revision points to a directory of that revision containingindex.html(a committed build, see Custom portal), it is served at/instead of the embedded default portal, with the same rules and anX-Cicord-Portal: repositoryheader. The directory is resolved on every request, so a new revision swaps the files without a restart; when it is missing (not built yet) the default portal is served. Files are opened through anos.Rootconfined to that directory:..and symbolic links leading outside it are refused, and a portal path reached through a symbolic link is ignored (cicord validatereports it). /api/*,/auth/*,/hooks/*,/admin/*,/healthzand/readyzare never shadowed by the portal: unknown paths there are JSON404 not_found.- Methods other than
GETandHEADon a static UI answer405 invalid. A UI that was not built into the binary answers404.