Authentifizierung
Welches Token wohin gehört. Wie du eins erzeugst, steht unter Anwendungen und Tokens. Wie du es schützt, unter Tokens schützen.
Bot-Tokens
Jede Anwendung hat ein Bot-Token. Sende es bei jeder REST-Anfrage im Header x-bot-token:
curl https://api.zrzur.com/users/@me -H "x-bot-token: YOUR_BOT_TOKEN"Das Gateway nimmt dasselbe Token, entweder in der ersten Nachricht (Authenticate) oder als ?token= in der Adresse. Siehe Gateway.
Welcher Header was tut
| Header | Wer ihn nutzt | Akzeptiert auf |
|---|---|---|
x-bot-token | Bots | Jedem Endpunkt, der in dieser Referenz „Bot-Token“ nennt |
x-session-token | Menschen über die App | Allem, auch Kontoeinstellungen |
| keiner | Alle | Öffentlichen Endpunkten, Interaktionsantworten (Token im Pfad), Webhook-Ausführung (Token im Pfad) |
Werden Bot-Token und Sitzungstoken zusammen gesendet, zählt das Bot-Token. Ein fehlendes, falsches oder zu einem gesperrten Bot gehörendes Token bekommt 401 mit dem Fehlertyp InvalidSession.
Interaktions- und Webhook-Tokens
- Interaktions-Tokens kommen mit jedem
InteractionCreate. Sie gelten 15 Minuten und nur für die Antwort, Änderungen und Folgenachrichten dieser Interaktion. Es braucht keinen Header: Das Token steht im Pfad. - Webhook-Tokens gehören zu einem Webhook und beginnen mit
zrzur_wh_. Wer die Webhook-URL hat, kann in dessen Kanal posten, also behandle sie wie ein Bot-Token. Sie erscheint einmal; eine verlorene lässt sich nur ersetzen.
Bots und ihre Eigentümer
Erstellen, Bearbeiten, Token zurücksetzen und Löschen erledigt der Eigentümer im Entwicklerportal mit seiner eigenen Anmeldung. Ein Bot-Token kann keine Anwendungen verwalten. Löschen lässt sich nicht rückgängig machen, darum bestätigt der Eigentümer es erneut mit Passwort, Authenticator-Code oder Wiederherstellungscode.
DELETE /bots/{bot_id}
Delete Bot. Delete a bot by its id.
Requires a validated MFA ticket (X-MFA-Ticket) created by the bot owner with their password, authenticator code or recovery code.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
GET /bots/{bot_id}
Fetch Bot. Fetch details of a bot you own by its id. A bot may fetch itself (with its own id) to read its settings, such as the privileged intents its owner switched on.
Ratenlimit: bots, 10 / 10 s
PATCH /bots/{bot_id}
Edit Bot. Edit bot details by its id.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
POST /bots/{bot_id}/token/reset
Reset Bot Token. Makes a new token for the bot; the old one stops working at once and the bot is signed out everywhere. The new token is in this response only: Zrzur keeps just a hash and can't show it again.
Requires a validated MFA ticket (X-MFA-Ticket) created by the bot owner with their password, authenticator code or recovery code.
Ratenlimit: bots, 10 / 10 s
GET /bots/{target}/commands
Fetch Public Bot Commands. The global commands a bot registered, for its page in Discover and its profile, and for the command list in a DM with it. Works for public bots, for the owner, and for anyone who has a DM with the bot. Commands limited to one server are never listed here. A public bot's list is cached for a minute; registering or changing a command through the API shows at once.
Ratenlimit: bots, 10 / 10 s
DELETE /bots/{target}/interactions/endpoint
Remove Interactions Endpoint. Interactions go back to the gateway.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
PUT /bots/{target}/interactions/endpoint
Set Interactions Endpoint. Interactions go to this HTTPS address from now on, instead of the gateway. Make a signing secret first. The address gets two requests before it is saved: one with a wrong signature, which it must refuse, and a signed Ping, which it must answer with {"type":"Pong"}, in either order.
Requires a validated MFA ticket (X-MFA-Ticket) created by the bot owner: this address receives what people enter into the bot.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
POST /bots/{target}/interactions/secret
New Interactions Signing Secret. Makes the secret your server uses to check X-Zrzur-Signature; the previous one stops working at once. It is in this response only.
Requires a validated MFA ticket (X-MFA-Ticket) created by the bot owner.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
GET /bots/{target}/invite
Fetch Public Bot. Fetch details of a public (or owned) bot by its id: its profile, the permissions it asks for, whether it is verified, how many servers it is in and, if its owner chose to show it, who made it.
Ratenlimit: bots, 10 / 10 s
POST /bots/{target}/invite
Invite Bot. Invite a bot to a server or group by its id.`
Für Bots nicht verfügbar.
Berechtigungen: Channel:InviteOthers · Ratenlimit: bots, 10 / 10 s
GET /bots/{target}/verification
Bot verification state. Whether the bot is verified and the latest request. Owner only.
Ratenlimit: bots, 10 / 10 s
POST /bots/{target}/verification
Apply for verification. Ask Zrzur to verify your bot, and to approve the privileged intents it needs past 100 servers. Links to its privacy policy and terms are required, https only, and also go on the bot. One open request at a time; after a denial you can apply again a week later.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
GET /bots/@me
Fetch Owned Bots. Fetch all of the bots that you have control over.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
POST /bots/create
Create Bot. Create a new bot.
Für Bots nicht verfügbar.
Ratenlimit: bots, 10 / 10 s
OAuth2
Die Anmeldung von Menschen auf deiner Website und Installationslinks stehen auf der Seite OAuth2.