Référence REST
REST · Bots et OAuth2
Applications bots, commandes, installation sur un serveur, OAuth2 et certification.
Guides d’usage : Bots et OAuth2.
Crée une application bot et renvoie son jeton (affiché une seule fois).
POST https://gateway.alfychat.app/api/bots
Corps JSON
| name | texte · longueur 2–32 | obligatoire |
| description | texte · longueur 0–500 | facultatif |
| prefix | texte · longueur 1–5 | facultatif |
Erreurs
- 401Non authentifié
Succès : 201
curl -X POST "https://gateway.alfychat.app/api/bots" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"…","description":"…","prefix":"…"}'Liste ses bots.
GET https://gateway.alfychat.app/api/bots/me
Erreurs
- 401Non authentifié
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/bots/me" \
-H "Authorization: Bearer $ACCESS_TOKEN"Annuaire public des bots (filtrable par tag).
GET https://gateway.alfychat.app/api/bots/public
Paramètres de requête
| search | texte · longueur 0–100 | facultatif |
| tag | texte · longueur 0–50 | facultatif |
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/bots/public"Authentifie un bot avec son jeton.
POST https://gateway.alfychat.app/api/bots/authenticate
Erreurs
- 401Bot non trouvé
- 401Token de bot invalide
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/bots/authenticate"Détail d'un bot (le jeton n'est visible que pour son propriétaire).
GET https://gateway.alfychat.app/api/bots/{id}
Erreurs
- 401Authentification requise
- 404Bot non trouvé
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/bots/<id>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Modifie un bot (nom, description, préfixe, visibilité, liens, tags).
PATCH https://gateway.alfychat.app/api/bots/{id}
Corps JSON
| name | texte · longueur 2–32 | facultatif |
| description | texte · longueur 0–500 | facultatif |
| prefix | texte · longueur 1–5 | facultatif |
| isPublic | booléen | facultatif |
| tags | tableau | facultatif |
| websiteUrl | texte · longueur 0–500 | facultatif |
| supportServerUrl | texte · longueur 0–500 | facultatif |
| privacyPolicyUrl | texte · longueur 0–500 | facultatif |
Erreurs
- 401Authentification requise
- 404Bot non trouvé ou non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/bots/<id>" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'Supprime un bot.
DELETE https://gateway.alfychat.app/api/bots/{id}
Erreurs
- 401Authentification requise
- 404Bot non trouvé ou non autorisé
Succès : 200
curl -X DELETE "https://gateway.alfychat.app/api/bots/<id>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Régénère le jeton du bot (l'ancien devient invalide).
POST https://gateway.alfychat.app/api/bots/{id}/regenerate-token
Erreurs
- 401Authentification requise
- 404Bot non trouvé ou non autorisé
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/bots/<id>/regenerate-token" \
-H "Authorization: Bearer $ACCESS_TOKEN"Change le statut du bot (online, offline, maintenance).
PATCH https://gateway.alfychat.app/api/bots/{id}/status
Corps JSON
| status | ∈ {online, offline, maintenance} | obligatoire |
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/bots/<id>/status" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"…"}'Commandes déclarées par le bot.
GET https://gateway.alfychat.app/api/bots/{id}/commands
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/bots/<id>/commands"Déclare une commande.
POST https://gateway.alfychat.app/api/bots/{id}/commands
Corps JSON
| name | texte · longueur 1–32 | obligatoire |
| description | texte · longueur 1–200 | obligatoire |
| usage | texte · longueur 0–200 | facultatif |
| cooldown | Min | facultatif |
| permissions | Min | facultatif |
Erreurs
- 401Authentification requise
Succès : 201
curl -X POST "https://gateway.alfychat.app/api/bots/<id>/commands" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"…","description":"…"}'Modifie ou active/désactive une commande.
PATCH https://gateway.alfychat.app/api/bots/{id}/commands/{commandId}
Corps JSON
| name | texte · longueur 1–32 | facultatif |
| description | texte · longueur 0–200 | facultatif |
| usage | texte · longueur 0–200 | facultatif |
| isEnabled | booléen | facultatif |
| cooldown | Min | facultatif |
| permissions | Min | facultatif |
Erreurs
- 404Commande non trouvée
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/bots/<id>/commands/<commandId>" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'Supprime une commande.
DELETE https://gateway.alfychat.app/api/bots/{id}/commands/{commandId}
Erreurs
- 404Commande non trouvée
Succès : 200
curl -X DELETE "https://gateway.alfychat.app/api/bots/<id>/commands/<commandId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Ajoute le bot à un serveur.
POST https://gateway.alfychat.app/api/bots/{id}/servers
Corps JSON
| serverId | UUID | obligatoire |
| permissions | Min | facultatif |
Erreurs
- 400Le bot est déjà sur ce serveur
- 401Authentification requise
- 403Droits d'administration du serveur requis
- 404Bot non trouvé
Succès : 201
curl -X POST "https://gateway.alfychat.app/api/bots/<id>/servers" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"serverId":"…","permissions":"…"}'Retire le bot d'un serveur.
DELETE https://gateway.alfychat.app/api/bots/{id}/servers/{serverId}
Erreurs
- 401Authentification requise
- 403Non autorisé
- 404Bot non trouvé
- 404Bot non trouvé sur ce serveur
Succès : 200
curl -X DELETE "https://gateway.alfychat.app/api/bots/<id>/servers/<serverId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Bots présents dans un serveur.
GET https://gateway.alfychat.app/api/bots/servers/{serverId}
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/bots/servers/<serverId>"Identifiants OAuth2 de l'application (clientId, secret masqué, URIs de redirection).
GET https://gateway.alfychat.app/api/bots/{id}/oauth2
Erreurs
- 404Bot introuvable ou accès refusé
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/bots/<id>/oauth2" \
-H "Authorization: Bearer $ACCESS_TOKEN"Régénère le client secret (affiché une seule fois).
POST https://gateway.alfychat.app/api/bots/{id}/oauth2/regenerate-secret
Erreurs
- 404Bot introuvable ou accès refusé
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/bots/<id>/oauth2/regenerate-secret" \
-H "Authorization: Bearer $ACCESS_TOKEN"Définit les URIs de redirection autorisées (5 maximum).
PATCH https://gateway.alfychat.app/api/bots/{id}/oauth2/redirect-uris
Corps JSON
| redirectUris | tableau | obligatoire |
Erreurs
- 400Bot introuvable, accès refusé, ou URIs invalides (max 5, https:// ou http://localhost)
- 400redirectUris doit être un tableau
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/bots/<id>/oauth2/redirect-uris" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"redirectUris":"…"}'Demande la certification du bot.
POST https://gateway.alfychat.app/api/bots/{id}/certification
Corps JSON
| reason | texte · longueur 10–1000 | obligatoire |
Erreurs
- 400Demande impossible (bot non trouvé, non autorisé, ou déjà en attente)
- 401Authentification requise
Succès : 201
curl -X POST "https://gateway.alfychat.app/api/bots/<id>/certification" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"reason":"…"}'Demandes de certification en attente (équipe).
GET https://gateway.alfychat.app/api/bots/certification/pending
Erreurs
- 403Accès réservé aux administrateurs
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/bots/certification/pending" \
-H "Authorization: Bearer $ACCESS_TOKEN"Accepte ou refuse une demande de certification (équipe).
POST https://gateway.alfychat.app/api/bots/certification/{requestId}/review
Corps JSON
| status | ∈ {approved, rejected} | obligatoire |
| note | texte · longueur 0–500 | facultatif |
Erreurs
- 401Authentification requise
- 403Accès réservé aux administrateurs
- 404Demande de certification non trouvée
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/bots/certification/<requestId>/review" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"…","note":"…"}'Informations publiques d'une application (écran de consentement).
GET https://gateway.alfychat.app/api/oauth2/applications/{clientId}
Erreurs
- 404Application introuvable
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/oauth2/applications/<clientId>"Valide le consentement de l'utilisateur et renvoie le code d'autorisation.
POST https://gateway.alfychat.app/api/oauth2/authorize
Corps JSON
| clientId | UUID | obligatoire |
| redirectUri | — | facultatif |
| scopes | tableau | obligatoire |
| permissions | Min | facultatif |
Erreurs
- 400Autorisation refusée
- 400Autorisation refusée ou redirect_uri invalide
- 400Paramètres manquants
- 400Scope invalide:
- 400redirect_uri requis pour ces scopes
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/oauth2/authorize" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"clientId":"…","redirectUri":"…","scopes":"…","permissions":"…"}'Échange un code d'autorisation (ou un refresh token) contre un jeton d'accès.
POST https://gateway.alfychat.app/api/oauth2/token
Corps JSON
| grant_type | Equals | obligatoire |
| code | texte · longueur ≥ 1 | obligatoire |
| client_id | UUID | obligatoire |
| client_secret | texte · longueur ≥ 1 | obligatoire |
| redirect_uri | — | obligatoire |
Erreurs
- 400invalid_grant
- 400invalid_request
- 400unsupported_grant_type
- 500server_error
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/oauth2/token" \
-H "Content-Type: application/json" \
-d '{"grant_type":"…","code":"…","client_id":"…","client_secret":"…","redirect_uri":"…"}'