Перейти к содержимому

HTTP API

Use the HTTP API to read and change resources.

  • Every path starts with /v1 under the base URL in /.well-known/squad.
  • Third-party clients use endpoints.api_public.
  • Every instance serves its OpenAPI 3.1 document at /v1/openapi.json.
  • Limits such as attachment counts differ between instances, and each instance returns its own in instance discovery.
  • Field tables use the field notation for optional and nullable fields.
PageWhat it documents
ErrorsError responses, status codes and every error code
Deployment availabilityRoutes served only while premium or billing is on
Authentication resourceRegistration, login, MFA, WebAuthn, SSO, recovery, sessions
GatewayGateway endpoint discovery and the session start budget
InstanceInstance discovery, geolocation, limit keys, the OpenAPI document
ExperimentsExperiment assignments and how to poll for them
OAuth2Authorisation, consent, tokens, introspection, revocation
ApplicationsApplications, bot accounts, client secrets, bot tokens
ConnectionsExternal account connections
UsersThe user object and shared user enumerations
Current userYour account, profile, lifecycle and policy acceptance
User settingsAccount, notification and privacy settings, guild folders
User settings ProtobufStructured client preference messages
Email and password changesThe ticketed credential change flows
Multi-factor authenticationTOTP, backup codes, WebAuthn credentials, sudo verification
RelationshipsFriends, friend requests, blocks
User notesPrivate notes on users
Private channelsDirect message and group direct message channels
Push notificationsRegistering a device for push delivery
User content collectionsRecent mentions, saved messages, message deletion
Gift inventoryPremium gift codes you created
Data exportsRequesting and downloading a copy of your data
Read statesRead acknowledgements and mention counts
MemesSaved media and GIF URL resolution
GIFsGIF search, featured and trending listings, share registration
ThemesShareable custom CSS themes
ChannelsChannels, recipients, permission overwrites, slowmode
ThreadsStarting, archiving and searching threads
Thread membersJoining and leaving threads, notification settings
ForumsForum and media channels, tags, posts
CallsCall eligibility, regions, ringing, termination
Peer-to-peer voiceConnection outcome reports for peer-to-peer calls
StreamsStream keys, regions, previews
Entrance soundsThe entrance sound collection and playback
MessagesMessages, attachments, embeds, history, pins, reactions, typing
GuildsGuild objects and lifecycle
Guild channelsListing, creating and positioning guild channels
Guild membersMembers, profiles, voice moderation, roles
Guild member searchMember search filters and sorting
Guild moderationBans and temporary bans
Guild emojisGuild emoji management
Guild stickersGuild sticker management
ExpressionsEmoji and sticker metadata
Guild audit logsAudit entries, filters and the audit reason
Roles and permissionsPermission flags and roles
DiscoveryPublic guild listings and listing applications
InvitesInvite lookup, creation, acceptance, deletion
WebhooksWebhook management, execution and provider callbacks
SearchGlobal message search
UnfurlExternal URL metadata
BillingStripe checkout, gift purchase, the Stripe webhook
PremiumPricing, entitlement state, subscription self-service
GiftsGift code lookup and redemption
ReportsSafety reports and Digital Services Act notices
  • Send JSON bodies with Content-Type: application/json.
  • Responses are UTF-8 JSON unless an operation says otherwise.
  • Every GET route also responds to HEAD.
  • Unknown paths, including a known path with a trailing slash, return 404 NOT_FOUND.
  • An overloaded instance returns 503 SERVICE_UNAVAILABLE with Retry-After: 1.

Create message, Modify message, Execute webhook and Start thread take multipart/form-data with these fields when you attach files.

FieldTypeDescription
payload_json?stringThe JSON request payload of the operation
files[n]?fileThe attachment file at index n
  • The index n must be below the instance’s max_attachments_per_message limit.
  • It matches the id of an entry in the attachments array of payload_json.
  • Indexes don’t need to start at zero or be consecutive.
  • A malformed multipart body returns 400 INVALID_FORM_BODY with the validation code FAILED_TO_PARSE_MULTIPART_FORM_DATA.

To upload files before sending, use attachment uploads. The OAuth2 token operations take application/x-www-form-urlencoded or multipart/form-data bodies.

Before validation, Squad changes these values.

  • Empty strings and empty nested objects become null.
  • An empty body counts as {}.

Create message, Modify message, Execute webhook and Start thread skip this step. Malformed JSON returns 400 INVALID_FORM_BODY with the path body and the code INVALID_FORMAT.

Each operation says which credentials it accepts. An OAuth2 bearer token works only on routes marked OAuth2, and other routes return 403 ACCESS_DENIED.

FieldTypeDescription
Authorization?stringThe credential for an authenticated request
Content-Type?stringThe body media type and, for multipart bodies, the boundary
Accept-Language?stringThe locale for an error message, used when the account has none set
X-Audit-Log-Reason?stringA reason for the audit log entry (up to 512 characters)
X-Fluxer-Sudo-Mode-JWT?stringThe sudo token from Multi-factor authentication
X-Captcha-Token?stringThe solved ALTCHA challenge
X-Request-ID?stringAn identifier you choose, echoed in the response
FieldTypeDescription
X-Fluxer-Version?stringThe build version of the instance
X-Request-ID?stringThe request identifier, generated when you send none
X-Fluxer-Sudo-Mode-JWT?stringThe sudo mode token, sent when an operation completes a sudo proof
Cache-Control?stringno-cache unless the operation sets its own value or the body is media
Retry-After?stringWhole seconds to wait after a 429 or 503

A 429, and any response to a bot or webhook token, can have the X-RateLimit-* headers.

Every route has its own bucket, and most routes also count against a global bucket. A denial returns 429 RATE_LIMITED.

A self-hosted instance serves some routes only while its premium mode or billing is on, and returns 404 NOT_FOUND for the others.

Only the instance’s web app and marketing origins are allowed. A request from one of them gets Access-Control-Allow-Origin set to that origin and Vary: Origin. The API doesn’t use cookies. Send your token in Authorization.

Browser scripts can see only the X-Fluxer-Version and ETag response headers. Cross-origin requests can send these headers.

FieldTypeDescription
codestringThe stable API error code
messagestringA description in the request locale
errors?array[validation error object]The request fields that failed validation

Some codes add more top-level fields. Ignore fields you don’t recognise.

A 400 INVALID_FORM_BODY response has one validation error object in errors for each field that failed, with its validation code.

FieldTypeDescription
pathstringThe failed field as a dotted path like embeds.0.title, root for the whole object or body for malformed JSON
code?stringThe validation error code
messagestringA description of the failure
{
"code": "INVALID_FORM_BODY",
"message": "Invalid form body.",
"errors": [
{"path": "name", "code": "INVALID_FORMAT", "message": "The provided value is in an invalid format."}
]
}