Documentation

API reference

Endpoints a network offers so StarChat can use the features it lists in its discovery file. Every feature is optional: a network leaves out the endpoints of features it does not list, and the client hides them.

All paths are relative to apiBaseUrl from the discovery file. Requests and answers are JSON unless noted. The client sends Accept: application/json and no cookies, so the API has to answer cross-origin requests (Access-Control-Allow-Origin: * or the calling origin, Authorization as allowed header).

Times are ISO 8601. Channel names start with # and are compared in lower case.

Errors with 422 carry Laravel style messages ({ "message": "…", "errors": { "field": ["…"] } }), the client shows the first one. A request with a missing or expired token is answered with 401.

The same as OpenAPI 3.1.0: openapi.yaml. The features and where the API address comes from are described in Discovery file.

login

Only with bearer or api-login in auth. The API accepts the token as Authorization: Bearer <token>. With bearer the IRC server also accepts it with SASL IRCV3BEARER. With Ergo this is a JWT signed with a key from accounts.jwt-auth, the account name in sub. With api-login the token is only for the API and the client logs in on IRC with SASL PLAIN, so any string the API recognizes works.

A page that embeds the chat can also hand over a token itself (mountChat({ bearer })), then this endpoint is not called. Guests have no token, so features that need one stay hidden for them.

POSTlogin

Token for an account. No token.

With bearer in auth the client then logs in on IRC with IRCV3BEARER instead of PLAIN. With api-login it keeps PLAIN on IRC and uses the token only for the API. Without either, this endpoint is not used.

Body:

FieldTypeRequiredMeaning
usernamestringyes
passwordstringyes
{
  "username": "alice",
  "password": "secret"
}
StatusMeaning
200Logged in.
401Wrong name or password.

Answer 200:

FieldTypeRequiredMeaning
tokenstringyes
nicknamestringNick to use on IRC. Without it the client keeps the one typed in.
{
  "token": "eyJhbGciOiJIUzI1NiJ9…",
  "nickname": "alice"
}

profiles

Profile cards with avatar, status and member date. Avatar and status are also published as IRCv3 metadata (avatar, status), so other clients see them without the API.

GETchat/profiles/{account}

Profile of an IRC account. Needs a token.

The account comes from WHOIS (330).

Parameters:

FieldTypeRequiredMeaning
{account}stringyes
StatusMeaning
200The profile.
401No token, or the token is invalid or expired.
404The account has no profile.

Answer 200:

FieldTypeRequiredMeaning
namestringyesAccount name.
avatar_urlURL or nullShown only if it is on the same origin as apiBaseUrl.
statusstring or nullStatus text, one line.
member_sinceISO 8601 date or null
charactersarray of objectFor example roleplay characters.
characters[].namestringyes
characters[].racestring or null
characters[].character_classstring or null
characters[].urlURL or null
mutual_communitiesarray of objectGroups the viewer and this account both belong to.
mutual_communities[].namestringyes
mutual_communities[].slugstring
{
  "name": "alice",
  "avatar_url": "https://example.org/avatars/alice.png",
  "status": "On the bridge",
  "member_since": "2024-03-01T00:00:00Z"
}

GETchat/profile

Own profile. Needs a token.

Also loaded after every connect to publish avatar and status as metadata.

StatusMeaning
200The own profile, with the fields only the owner sees.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
namestringyesAccount name.
avatar_urlURL or nullShown only if it is on the same origin as apiBaseUrl.
statusstring or nullStatus text, one line.
member_sinceISO 8601 date or null
charactersarray of objectFor example roleplay characters.
characters[].namestringyes
characters[].racestring or null
characters[].character_classstring or null
characters[].urlURL or null
mutual_communitiesarray of objectGroups the viewer and this account both belong to.
mutual_communities[].namestringyes
mutual_communities[].slugstring
settings_urlURLFurther account settings on the network's website.
delete_account_urlURL

PUTchat/profile/status

Set or clear the status. Needs a token.

Body:

FieldTypeRequiredMeaning
statusstring or nullyesOne line. null clears it. Max. 128 characters.
{
  "status": "On the bridge"
}
StatusMeaning
200The stored status.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

Answer 200:

FieldTypeRequiredMeaning
statusstring or nullyes

POSTchat/profile/avatar

Upload an avatar. Needs a token.

Body:

Sent as (multipart/form-data).

FieldTypeRequiredMeaning
avatarfileyesJPEG, PNG or GIF, max. 2 MB.
StatusMeaning
200The new avatar.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

Answer 200:

FieldTypeRequiredMeaning
avatar_urlURLyes

DELETEchat/profile/avatar

Remove the avatar. Needs a token.

StatusMeaning
200Removed.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
avatar_urlnullyes

friends

Friend list and requests. Requests go to account names. Presence comes from IRC (MONITOR, JOIN, QUIT, AWAY), not from the API. The client shows its own texts after an action.

GETfriends

Friends and requests. Needs a token.

Polled every 10 seconds while the client is connected.

StatusMeaning
200All lists, each possibly empty.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
friendsarray of objectyes
friends[].friendship_idstring or integeryes
friends[].userobjectyes
friends[].user.displaystringyesNick of the other side on IRC. Entries without it are ignored.
friends[].user.namestringAccount name.
friends[].statusaccepted, pending, blocked
friends[].directionincoming, outgoing
friends[].requested_atISO 8601 date
incoming_requestsarray of objectyesFields as in friends[].
outgoing_requestsarray of objectyesFields as in friends[].
blockedarray of objectyesFields as in friends[].
{
  "friends": [
    {
      "friendship_id": 7,
      "user": {
        "display": "bob",
        "name": "bob"
      },
      "status": "accepted"
    }
  ],
  "incoming_requests": [],
  "outgoing_requests": [],
  "blocked": []
}

POSTfriends/request

Send a friend request. Needs a token.

A request to someone who already asked us accepts theirs.

Body:

FieldTypeRequiredMeaning
nickstringyes
{
  "nick": "bob"
}
StatusMeaning
200Sent or accepted.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

Answer 200:

FieldTypeRequiredMeaning
auto_acceptedbooleantrue when an incoming request of the other side was accepted instead.

POSTfriends/{friendship_id}/accept

Accept an incoming request. Needs a token.

Parameters:

FieldTypeRequiredMeaning
{friendship_id}stringyesfriendship_id of an entry in GET friends.
StatusMeaning
200Accepted.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

POSTfriends/{friendship_id}/decline

Decline an incoming request. Needs a token.

Parameters:

FieldTypeRequiredMeaning
{friendship_id}stringyesfriendship_id of an entry in GET friends.
StatusMeaning
200Declined.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

POSTfriends/{friendship_id}/block

Block the other side. Needs a token.

Parameters:

FieldTypeRequiredMeaning
{friendship_id}stringyesfriendship_id of an entry in GET friends.
StatusMeaning
200Blocked.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

DELETEfriends/{friendship_id}

End a friendship or withdraw a request. Needs a token.

Parameters:

FieldTypeRequiredMeaning
{friendship_id}stringyesfriendship_id of an entry in GET friends.
StatusMeaning
200Removed.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

uploads

Images and files in messages. Uploads happen when the message is sent, the message then carries the link. Links ending in an image or video extension are shown inline, for every user and client.

GETchat/media-upload

Own uploads. Needs a token.

StatusMeaning
200Newest first.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
uploadsarray of objectyes
uploads[].idstring or integeryes
uploads[].urlURLyesPublic link to the file.
uploads[].mime_typestringyesImages and videos get a preview.
uploads[].original_namestring
uploads[].captionstring or null

POSTchat/media-upload

Upload a file. Needs a token.

Body:

Sent as (multipart/form-data).

FieldTypeRequiredMeaning
mediafileyes
captionstringText of the message the file is sent with.
StatusMeaning
200Uploaded. The client sends url with the message.
401No token, or the token is invalid or expired.
413The file is too large.
422Invalid fields. The client shows the first message.

Answer 200:

FieldTypeRequiredMeaning
idstring or integeryes
urlURLyes
{
  "id": 12,
  "url": "https://example.org/u/abc.png"
}

DELETEchat/media-upload/{id}

Delete an own upload. Needs a token.

Parameters:

FieldTypeRequiredMeaning
{id}stringyes
StatusMeaning
200Deleted.
401No token, or the token is invalid or expired.
404No such upload of this account.

gifs

GIF search in the message input. The token is sent if there is one. A network that wants to limit guests answers them with 401.

GETgifs/search

Search or trending GIFs. Token optional, sent if there is one.

Parameters:

FieldTypeRequiredMeaning
?qstringSearch words. Without it the network returns trending GIFs.
?limitinteger
?pagestring or integerThe next value of the previous answer.
StatusMeaning
200One page of results.
401The network does not serve guests.

Answer 200:

FieldTypeRequiredMeaning
resultsarray of objectyes
results[].idstringyes
results[].titlestring
results[].urlURLyesSent as the message.
results[].previewURLyesShown in the picker.
nextstring or integer or nullyesnull on the last page.
providerobjectShown as "Powered by" under the results, as most GIF services require.
provider.namestringyes
provider.urlURL
{
  "results": [
    {
      "id": "abc",
      "title": "Cat",
      "url": "https://media.example.org/abc.gif",
      "preview": "https://media.example.org/abc.webp"
    }
  ],
  "next": 2,
  "provider": {
    "name": "GIF service",
    "url": "https://gifs.example.org"
  }
}

reports

Reporting users and messages to the moderators of the network. Guests may report too, the token is sent if there is one. links.reportPolicy in the discovery file is linked in the report dialog.

POSTchat/reports

Report a user or a message. Token optional, sent if there is one.

Body:

FieldTypeRequiredMeaning
reported_nickstringyes
reported_accountstring or nullAccount from WHOIS, if the profile card was open.
reporter_nickstringyesOwn nick, Guest if unknown.
channelstring or nullChannel the report was sent from, null in DMs.
message_textstring or nullThe reported message. Max. 2000 characters.
message_sent_atISO 8601 date or null
reasonchild_safety, sexual_content, harassment, hate_speech, spam, otheryes
detailsstring or nullNote of the reporter. Max. 2000 characters.
{
  "reported_nick": "troll",
  "reported_account": null,
  "reporter_nick": "alice",
  "channel": "#bridge",
  "message_text": "Buy cheap stuff",
  "message_sent_at": "2026-11-20T18:02:11Z",
  "reason": "spam",
  "details": null
}
StatusMeaning
201Received. The client shows its own text.
422Invalid fields. The client shows the first message.
429Too many reports, the client asks to wait.

explore

A directory tab in the channel list: groups of channels the network lists, joined together. The channel list of the IRC server (LIST) is shown on every network without this feature.

GETexplore

Directory of channel groups. Token optional, sent if there is one.

StatusMeaning
200Groups in the order to show. Channel names without # and groups without channels are dropped.

Answer 200:

FieldTypeRequiredMeaning
communitiesarray of objectyes
communities[].idstring or integer
communities[].namestringyes
communities[].descriptionstring
communities[].channel_namesarray of stringyes

chatState

Open conversations, read positions and synced settings of an account, so another device (or the next session) continues where the last one stopped.

GETchat-state

Saved state of the account. Needs a token.

StatusMeaning
200An account without a saved state gets empty lists and "settings": null.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
open_dmsarray of stringNicks with an open DM.
joined_channelsarray of stringChannels to join on the next connect, without the default channel.
active_channelstring or nullShown after the next connect.
sidebar_modechannels, friends, uploads
last_readmap of ISO 8601 dateRead position per channel or DM. Newer local values win.
unread_countsmap of integer
settingsnull or objectyesnull: the account never synced, the client uploads its own values.
settings.highlight_wordsarray of stringMax. 20 entries.
settings.ignored_usersarray of stringMax. 100 entries.
settings.channel_notificationsmap of mentions, mute
settings.quit_messagestringOne line. Missing means the client's default. Max. 200 characters.
settings.nick_colorsmap of integerHue per nick.
settings.left_lobbiesarray of stringChannels the user left on purpose, they are not joined by default any more.
settings.autojoin_channelsarray of stringJoined on every connect. Max. 50 entries.

POSTchat-state

Save the state. Needs a token.

Sent at most every 5 seconds, after changes.

Body:

FieldTypeRequiredMeaning
open_dmsarray of stringNicks with an open DM.
joined_channelsarray of stringChannels to join on the next connect, without the default channel.
active_channelstring or nullShown after the next connect.
sidebar_modechannels, friends, uploads
last_readmap of ISO 8601 dateRead position per channel or DM. Newer local values win.
unread_countsmap of integer
settings_patchobjectThe settings changed on this device, keys as in settings of GET chat-state. null as value removes a key. The network merges it into the stored document, so changes from another device are kept.
StatusMeaning
200Saved.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

alwaysOn

Keeps the nick in its channels while no client is connected, for example Ergo's always-on. After the first registration the client asks once per account whether to turn it on.

GETchat/always-on

Current setting. Needs a token.

StatusMeaning
200The setting.
401No token, or the token is invalid or expired.
503The IRC server cannot be reached, the client shows the switch disabled.

Answer 200:

FieldTypeRequiredMeaning
enabledbooleanyes
askbooleanyesShow the question (not answered yet).
{
  "enabled": false,
  "ask": true
}

PUTchat/always-on

Turn it on or off. Needs a token.

Body:

FieldTypeRequiredMeaning
enabledbooleanyes
StatusMeaning
200The new setting, ask is now false.
401No token, or the token is invalid or expired.
503The IRC server cannot be reached, the client shows the switch disabled.

Answer 200:

FieldTypeRequiredMeaning
enabledbooleanyes
askbooleanyesShow the question (not answered yet).
{
  "enabled": true,
  "ask": false
}

POSTchat/always-on/dismiss

Stop asking. Needs a token.

"No, thanks" in the question.

StatusMeaning
200The network will not ask again.
401No token, or the token is invalid or expired.

events

Upcoming events for the calendar button in the channel sidebar. The button only shows when the list has an event that has not started yet, and is marked when one starts within 24 hours. The client loads the list after every registration and every 15 minutes.

GETchat/events

Upcoming events. Needs a token.

The network expands recurring events into single dates and decides how far ahead the list goes. Entries without a valid starts_at are dropped.

Parameters:

FieldTypeRequiredMeaning
?communitystring or integerOnly events of this community (feature communities, sent while a community is shown). community_name is then left out in the list.
StatusMeaning
200Sorted by start.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
eventsarray of objectyes
events[].event_idstring or integeryesRecurring events appear once per date with the same id.
events[].titlestringyes
events[].starts_atISO 8601 dateyesShown in the local time zone.
events[].recurrencenone, weekly, biweekly, monthlyShown as a hint.
events[].channelstring or nullChannel of the event, opened or joined from the list.
events[].community_namestringGroup the event belongs to, shown next to it.
{
  "events": [
    {
      "event_id": 4,
      "title": "Bridge meeting",
      "starts_at": "2026-11-20T19:00:00Z",
      "recurrence": "weekly",
      "channel": "#bridge",
      "community_name": "Starfleet"
    }
  ]
}

communities

Groups of channels the user belongs to, each with an icon in the rail. Creating communities, members and roles are left to the network's website. With links.communityInvite the client offers "Copy invite link".

GETmy-communities

Communities of the user. Needs a token.

Loaded after every registration.

StatusMeaning
200Empty for users without communities.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
[].idstring or integeryes
[].namestringyesShown in the rail (first letter) and as the group heading.
[].slugstringFills {community} in links.communityInvite. Pattern ^[A-Za-z0-9_-]+$.
[].lobby_channelstring or nullOpened first. Must be one of channels, otherwise the first channel is used.
[].channelsarray of stringyesIn the order the community wants them.
[
  {
    "id": 1,
    "name": "Starfleet",
    "slug": "starfleet",
    "lobby_channel": "#bridge",
    "channels": [
      "#bridge",
      "#engineering"
    ]
  }
]

push

Only used by app builds (shell: 'mobile'): the app cannot receive Web Push itself, so the network relays it to Firebase Cloud Messaging. Browsers register directly with the IRC server (draft/webpush) and do not call these endpoints.

The client hands the endpoint to the IRC server with WEBPUSH REGISTER <endpoint> p256dh=…;auth=…, using the keys the app created. The IRC server sends encrypted pushes to the endpoint, the network forwards them unchanged to FCM and the app decrypts them. How app and chat talk to each other is described in Features.

POSTchat/push-devices

Register an app install. Needs a token.

A token belongs to one install: registering it again moves it to the current account.

Body:

FieldTypeRequiredMeaning
fcm_tokenstringyes
StatusMeaning
200Known install.
201New install.
401No token, or the token is invalid or expired.
422Invalid fields. The client shows the first message.

Answer 200:

FieldTypeRequiredMeaning
endpointURLyesWeb Push endpoint the client registers with the IRC server.
{
  "endpoint": "https://example.org/api/push/3f9c…"
}

Answer 201:

FieldTypeRequiredMeaning
endpointURLyesWeb Push endpoint the client registers with the IRC server.
{
  "endpoint": "https://example.org/api/push/3f9c…"
}

DELETEchat/push-devices

Remove an app install. Needs a token.

Sent on logout.

Body:

FieldTypeRequiredMeaning
fcm_tokenstringyes
StatusMeaning
204Removed.
401No token, or the token is invalid or expired.

voice

Voice chat per channel through a LiveKit server of the network. Who is in a voice chat is published as IRC metadata voice (value: the channel), so the nick list shows a speaker icon. Leaving the channel on IRC also leaves its voice chat.

POSTchat/voice/token

Token for the voice room of a channel. Needs a token.

The network checks that the nick belongs to the account of the token and is in the channel, for example with a WHOIS through the IRC server's API.

Body:

FieldTypeRequiredMeaning
channelstringyes
nickstringyesOwn IRC nick.
{
  "channel": "#bridge",
  "nick": "alice"
}
StatusMeaning
200Token for the room.
401No token, or the token is invalid or expired.
403The client shows its own text for each reason: not_allowed (voice is not enabled for this account, for example while testing), wrong_account (the nick belongs to another account), not_in_channel.
404Voice is not set up on this network.
503The nick could not be checked right now (reason whois_failed).

Answer 200:

FieldTypeRequiredMeaning
urlURLyesLiveKit server (wss://).
tokenstringyesLiveKit access token for the room. The participant identity should be the account name, the participant name the nick.
is_moderatorbooleanChannel operator, room admin in LiveKit.
{
  "url": "wss://voice.example.org",
  "token": "eyJhbGciOiJIUzI1NiJ9…",
  "is_moderator": false
}

GETchat/voice/filters

Microphone filters. Needs a token.

Optional noise filters the client can load. The client ships the AudioWorklet of each filter it knows, the network hosts the WebAssembly files with Access-Control-Allow-Origin: * (the desktop app loads them from file://). Unknown ids are ignored, so a new build of a filter gets a new id (rnnoise-v2) and older clients keep loading theirs. rnnoise-v1 pairs with the files of @sapphi-red/web-noise-suppressor 0.4.1. An empty list or an error leaves the browser's own noise suppression.

StatusMeaning
200Offered filters, possibly none.
401No token, or the token is invalid or expired.
404Voice is not set up on this network.

Answer 200:

FieldTypeRequiredMeaning
filtersarray of objectyes
filters[].idstringyes
filters[].wasmURLyes
filters[].wasm_simdURLBuild for CPUs with WebAssembly SIMD, used when available.

calls

Voice calls between two friends from the DM window. Needs the features voice and friends. Ringing runs over IRC (see IRCv3 support), the API only hands out the room and rings app builds.

POSTchat/voice/call-token

Token for a call with a friend. Needs a token.

Both sides have to get the same room, for example dm: plus both account names in lower case and sorted (dm:alice:bob).

Body:

FieldTypeRequiredMeaning
peerstringyesAccount of the other side.
nickstringyesOwn IRC nick, shown to the other side.
{
  "peer": "bob",
  "nick": "alice"
}
StatusMeaning
200Token for the call room.
401No token, or the token is invalid or expired.
403Not friends (reason not_friends) or voice not allowed (not_allowed).
404Voice is not set up on this network.
422Invalid fields. The client shows the first message.

Answer 200:

FieldTypeRequiredMeaning
urlURLyesLiveKit server (wss://).
tokenstringyesLiveKit access token for the room. The participant identity should be the account name, the participant name the nick.
is_moderatorbooleanChannel operator, room admin in LiveKit.

POSTchat/voice/call-ring

Ring the app builds of a friend. Needs a token.

Optional next to the ringing over IRC, so an app in the background rings too, for example through FCM. cancel takes the notification back. The caller treats pushed > 0 like a ringing answer. How the app opens the call is described in Features.

Body:

FieldTypeRequiredMeaning
peerstringyesAccount of the other side.
call_idstringyesPattern ^[A-Za-z0-9]{1,32}$.
nickstringyesOwn IRC nick, shown in the notification.
actioninvite, cancelyes
StatusMeaning
200Number of installs reached, 0 without a push service.
401No token, or the token is invalid or expired.
403Not friends.
404Voice is not set up on this network.
422Invalid fields. The client shows the first message.

Answer 200:

FieldTypeRequiredMeaning
pushedintegeryes
{
  "pushed": 1
}

spotify

Used by the desktop app. The network keeps the Spotify link of the account (OAuth with its own Spotify app) and asks Spotify for the user.

GETspotify/auth-url

Link to connect Spotify. Needs a token.

StatusMeaning
200A one-time link the app opens in the browser.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
urlURLyes

GETspotify/status

Whether Spotify is linked. Needs a token.

StatusMeaning
200The link state.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
connectedbooleanyes

GETspotify/current-track

Track playing now. Needs a token.

StatusMeaning
200The track, or null when nothing plays.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
titlestringyes
artiststringyes
{
  "title": "Clair de Lune",
  "artist": "Claude Debussy"
}

DELETEspotify/disconnect

Unlink Spotify. Needs a token.

StatusMeaning
200Unlinked.
401No token, or the token is invalid or expired.

Answer 200:

FieldTypeRequiredMeaning
okbooleanyes

Edit this page on GitHub