# Chat API Documentation ## Authenticate user ``` POST /api/login ``` ### Parameters | Name | Description | |---|---| | email | required, must be valid email | | password | required, min 3 | free account: email: asd@gmail.com | password: asdasdasd premium account: email: asdasdasd@gmail.com | password: asdasdasd ### Response ``` { 'token': 'authorization-token' } ``` Pass the token in the Authorization header as a Bearer token in every request --- ## Set user online status ``` POST /api/users/{user}/set-status/{status} ``` ### Parameters ``` {user} - user id {status} - ['online', 'offline'] ``` ### Response ``` { 'status': 'success' } ``` --- ## Get chat lists ``` GET /api/chats ``` ### Response ``` { 'status': 'success', 'data': [ ... ] } ``` --- ## Chat toggle pin ``` POST /api/chats/{chat}/toggle-pin ``` ### Parameters ``` {chat} - chat id ``` ### Response ``` { 'status': 'success' } ``` --- ## Chat toggle archive ``` POST /api/chats/{chat}/toggle-archive ``` ### Parameters ``` {chat} - chat id ``` ### Response ``` { 'status': 'success' } ``` --- ## Search certain messages in a chat ``` GET /api/chats/{chat}/search-messages ``` ### Parameters | Name | Description | |---|---| | q | string to search | ### Response ``` { 'status': 'success', 'data': [ ... ] } ``` --- ## Get messages in a chat ``` GET /api/chats/{chat}/messages ``` ### Parameters | Name | Description | |---|---| | page | each page will return 20 messages | ### Response ``` { 'status': 'success', 'data': [ ... ] } ``` --- ## Toggle star for a message ``` POST /api/chats/{chat}/messages/{message}/starred/{participant} ``` ### Parameters ``` {chat} - chat id {message} - message id {participant} - participant id ``` ### Response ``` { 'status': 'success', 'data': [ ... ] } ``` --- ## Send a message ``` POST /api/chats/{chat}/messages ``` ### Parameters | Name | Description | |---|---| | message | string, required | | reply | (OPTIONAL) message id to refer as reply | ### Response ``` { 'status': 'success' } ``` --- ## Send a media message ``` POST /api/chats/{chat}/media-messages ``` ### Parameters | Name | Description | |---|---| | message | string, required | | media | media url or object | | reply | (OPTIONAL) message id to refer as reply | ### Response ``` { 'status': 'success' } ``` ---
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up