Référence REST
REST · Utilisateurs
Profils, statut, préférences, badges, favoris, conversations épinglées et clés de chiffrement.
Un utilisateur ne peut modifier que son propre profil : les routes PATCH /api/users/{userId}… répondent 403 pour un autre identifiant. Les routes de clés sont expliquées dans Chiffrement.
Profils et préférences
Notes de version publiques de la plateforme.
GET https://gateway.alfychat.app/api/users/changelogs
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/changelogs"Résout un lien court (alfy.chat/…) vers sa destination.
GET https://gateway.alfychat.app/api/users/links/{slug}
Erreurs
- 404Lien introuvable
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/links/<slug>"Profil complet du compte connecté (e-mail, rôle, préférences de base).
GET https://gateway.alfychat.app/api/users/me
Erreurs
- 401Non authentifié
- 404Utilisateur non trouvé
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/me" \
-H "Authorization: Bearer $ACCESS_TOKEN"Met à jour son propre profil (nom affiché, bio, avatar, bannière, centres d'intérêt…).
PATCH https://gateway.alfychat.app/api/users/me
curl -X PATCH "https://gateway.alfychat.app/api/users/me" \
-H "Authorization: Bearer $ACCESS_TOKEN"Recherche des utilisateurs par nom ou nom d'utilisateur.
GET https://gateway.alfychat.app/api/users/search
Paramètres de requête
| q | texte · longueur 1–64 | obligatoire |
| limit | MinMax | facultatif |
Erreurs
- 400Requête de recherche requise
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/search" \
-H "Authorization: Bearer $ACCESS_TOKEN"Récupère plusieurs profils publics en une requête (paramètre `ids`).
GET https://gateway.alfychat.app/api/users/batch
Paramètres de requête
| ids | texte · longueur 0–4000 | obligatoire |
Erreurs
- 400IDs requis
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/batch" \
-H "Authorization: Bearer $ACCESS_TOKEN"Indique si un nom d'utilisateur est disponible.
GET https://gateway.alfychat.app/api/users/check-username/{username}
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/check-username/<username>"Clé publique d'identité d'un utilisateur (chiffrement de bout en bout).
GET https://gateway.alfychat.app/api/users/{userId}/public-key
Erreurs
- 404Clé publique introuvable
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/<userId>/public-key" \
-H "Authorization: Bearer $ACCESS_TOKEN"Profil public d'un utilisateur ; plus de détails si l'appelant est authentifié.
GET https://gateway.alfychat.app/api/users/{userId}
Erreurs
- 404Utilisateur non trouvé
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/<userId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Met à jour le profil d'un utilisateur (uniquement le sien).
PATCH https://gateway.alfychat.app/api/users/{userId}
Erreurs
- 403Non autorisé
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Change le statut de présence (online, idle, dnd, invisible) et le statut personnalisé.
PATCH https://gateway.alfychat.app/api/users/{userId}/status
Corps JSON
| status | ∈ {online, idle, dnd, invisible, offline} | obligatoire |
| customStatus | nullable · texte · longueur 0–100 | facultatif |
| text | nullable · texte · longueur 0–100 | facultatif |
| emoji | nullable · texte · longueur 0–10 | facultatif |
Erreurs
- 403Non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>/status" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"…","customStatus":"…","text":"…","emoji":"…"}'Définit le texte et l'émoji du statut personnalisé.
PATCH https://gateway.alfychat.app/api/users/{userId}/custom-status
Corps JSON
| customStatus | nullable · texte · longueur 0–100 | facultatif |
Erreurs
- 403Non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>/custom-status" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"customStatus":"…"}'Enregistre la dernière activité (appelé par le gateway à la déconnexion).
PATCH https://gateway.alfychat.app/api/users/{userId}/last-seen
Erreurs
- 403Non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>/last-seen" \
-H "Authorization: Bearer $ACCESS_TOKEN"Préférences du compte (thème, langue, confidentialité, notifications).
GET https://gateway.alfychat.app/api/users/{userId}/preferences
Erreurs
- 403Non autorisé
- 404Préférences non trouvées
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/<userId>/preferences" \
-H "Authorization: Bearer $ACCESS_TOKEN"Modifie les préférences du compte.
PATCH https://gateway.alfychat.app/api/users/{userId}/preferences
Erreurs
- 403Non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>/preferences" \
-H "Authorization: Bearer $ACCESS_TOKEN"Change le mot de passe (révoque les autres sessions).
POST https://gateway.alfychat.app/api/users/{userId}/change-password
Corps JSON
| currentPassword | texte · longueur 1–128 | obligatoire |
| newPassword | texte · longueur 8–128 | obligatoire |
| encryptedPrivateKey | — | facultatif |
| keySalt | — | facultatif |
Erreurs
- 403Non autorisé
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/users/<userId>/change-password" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"currentPassword":"…","newPassword":"…","encryptedPrivateKey":"…","keySalt":"…"}'Change le nom d'utilisateur (mot de passe requis).
POST https://gateway.alfychat.app/api/users/{userId}/change-username
Corps JSON
| newUsername | texte · longueur 3–32 · format imposé | obligatoire |
| password | texte · longueur ≥ 1 | obligatoire |
Erreurs
- 403Non autorisé
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/users/<userId>/change-username" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"newUsername":"…","password":"…"}'Badges affichés sur le profil d'un utilisateur.
GET https://gateway.alfychat.app/api/users/{userId}/badges
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/<userId>/badges"Ajoute un badge à un utilisateur.
POST https://gateway.alfychat.app/api/users/{userId}/badges
Corps JSON
| badgeType | texte | obligatoire |
Erreurs
- 403Accès réservé aux administrateurs
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/users/<userId>/badges" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"badgeType":"…"}'Retire un badge d'un utilisateur.
DELETE https://gateway.alfychat.app/api/users/{userId}/badges/{badgeId}
Erreurs
- 403Accès réservé aux administrateurs
Succès : 200
curl -X DELETE "https://gateway.alfychat.app/api/users/<userId>/badges/<badgeId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Affiche ou masque les badges du profil.
PATCH https://gateway.alfychat.app/api/users/{userId}/badges/visibility
Corps JSON
| show | booléen | obligatoire |
Erreurs
- 403Non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>/badges/visibility" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"show":"…"}'Publie le morceau en cours d'écoute (présence musicale).
PATCH https://gateway.alfychat.app/api/users/{userId}/music-presence
Erreurs
- 400coverUrl invalide
- 403Non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>/music-presence" \
-H "Authorization: Bearer $ACCESS_TOKEN"Personnalise la carte de profil (couleur, mise en page).
PATCH https://gateway.alfychat.app/api/users/{userId}/profile-card
Corps JSON
| profileCardUrl | nullable · texte | facultatif |
Erreurs
- 400URL invalide
- 403Non autorisé
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/<userId>/profile-card" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"profileCardUrl":"…"}'Favoris, activité masquée, conversations épinglées
Liste de ses favoris.
GET https://gateway.alfychat.app/api/users/me/favorites
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/me/favorites" \
-H "Authorization: Bearer $ACCESS_TOKEN"Ajoute un favori.
POST https://gateway.alfychat.app/api/users/me/favorites
Corps JSON
| type | ∈ {emoji, sticker, gif} | obligatoire |
| value | texte · longueur 1–500 | obligatoire |
Succès : 201
curl -X POST "https://gateway.alfychat.app/api/users/me/favorites" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"type":"…","value":"…"}'Retire un favori.
DELETE https://gateway.alfychat.app/api/users/me/favorites/{id}
Succès : 200
curl -X DELETE "https://gateway.alfychat.app/api/users/me/favorites/<id>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Réordonne les favoris.
PATCH https://gateway.alfychat.app/api/users/me/favorites/reorder
Corps JSON
| orderedIds | tableau | obligatoire |
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/me/favorites/reorder" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"orderedIds":"…"}'Utilisateurs à qui l'on masque son activité.
GET https://gateway.alfychat.app/api/users/me/hidden-from
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/me/hidden-from" \
-H "Authorization: Bearer $ACCESS_TOKEN"Masque son activité à un utilisateur.
POST https://gateway.alfychat.app/api/users/me/hide-activity/{targetUserId}
Erreurs
- 400Identifiant invalide
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/users/me/hide-activity/<targetUserId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Réaffiche son activité à un utilisateur.
DELETE https://gateway.alfychat.app/api/users/me/hide-activity/{targetUserId}
Succès : 200
curl -X DELETE "https://gateway.alfychat.app/api/users/me/hide-activity/<targetUserId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Conversations épinglées.
GET https://gateway.alfychat.app/api/users/me/pinned-conversations
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/me/pinned-conversations" \
-H "Authorization: Bearer $ACCESS_TOKEN"Épingle une conversation.
POST https://gateway.alfychat.app/api/users/me/pinned-conversations/{conversationId}
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/users/me/pinned-conversations/<conversationId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Désépingle une conversation.
DELETE https://gateway.alfychat.app/api/users/me/pinned-conversations/{conversationId}
Succès : 200
curl -X DELETE "https://gateway.alfychat.app/api/users/me/pinned-conversations/<conversationId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"Clés de chiffrement
État des clés de chiffrement publiées (identité, prékeys restantes).
GET https://gateway.alfychat.app/api/users/keys/status
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/keys/status" \
-H "Authorization: Bearer $ACCESS_TOKEN"Publie le jeu de clés publiques (identité, prékey signée, prékeys à usage unique).
PUT https://gateway.alfychat.app/api/users/keys
Corps JSON
| registrationId | Min | obligatoire |
| identityKey | texte · NotEmpty | obligatoire |
| signedPrekey.keyId | Min | obligatoire |
| signedPrekey.publicKey | texte · NotEmpty | obligatoire |
| signedPrekey.signature | texte · NotEmpty | obligatoire |
| prekeys | tableau | facultatif |
| ecdhKey | — | facultatif |
Erreurs
- 400Bundle Signal incomplet
Succès : 200
curl -X PUT "https://gateway.alfychat.app/api/users/keys" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"registrationId":"…","identityKey":"…","signedPrekey":"…"}'Ajoute des prékeys à usage unique.
POST https://gateway.alfychat.app/api/users/keys/prekeys
Corps JSON
| prekeys | tableau | obligatoire |
Erreurs
- 400prekeys requis (tableau non vide)
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/users/keys/prekeys" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"prekeys":"…"}'Récupère les clés ECDH de plusieurs utilisateurs (messages de groupe).
POST https://gateway.alfychat.app/api/users/keys/ecdh/batch
Corps JSON
| userIds | tableau | obligatoire |
Succès : 200
curl -X POST "https://gateway.alfychat.app/api/users/keys/ecdh/batch" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"userIds":"…"}'Met à jour sa clé ECDH publique.
PATCH https://gateway.alfychat.app/api/users/keys/ecdh
Corps JSON
| ecdhKey | texte · NotEmpty | obligatoire |
Erreurs
- 400Aucun bundle Signal existant
- 400ecdhKey requis (string base64)
Succès : 200
curl -X PATCH "https://gateway.alfychat.app/api/users/keys/ecdh" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"ecdhKey":"…"}'Dépose son coffre de clés privées chiffré (jamais lisible par le serveur).
PUT https://gateway.alfychat.app/api/users/keys/private-bundle
Corps JSON
| encryptedBundle | texte · NotEmpty | obligatoire |
Erreurs
- 400Aucun bundle Signal public trouvé. Publiez d'abord vos clés publiques.
- 400encryptedBundle requis (string)
Succès : 200
curl -X PUT "https://gateway.alfychat.app/api/users/keys/private-bundle" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"encryptedBundle":"…"}'Récupère son coffre de clés privées chiffré.
GET https://gateway.alfychat.app/api/users/keys/private-bundle
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/keys/private-bundle" \
-H "Authorization: Bearer $ACCESS_TOKEN"Récupère le jeu de clés d'un utilisateur (consomme une prékey à usage unique).
GET https://gateway.alfychat.app/api/users/keys/{userId}
Erreurs
- 404Aucun bundle Signal pour cet utilisateur
Succès : 200
curl -X GET "https://gateway.alfychat.app/api/users/keys/<userId>" \
-H "Authorization: Bearer $ACCESS_TOKEN"