Some Rocket.Chat endpoints require user authentication before you can access them. For an overview of how authentication works, refer to the Authentication API guide.
For this example, use the Login with Username and Password endpoint to obtain your userId and generate an authToken.
On the Login with Username and Password endpoint page, enter the same username and password you used in Step 1: Register Yourself as a User. For example:
{
"username": "rogersmith",
"password": "passw0rd"
}Click Try it!
If the request is successful, the response will include your user details, along with the userId and authToken. Make sure to copy these values, they will not persist if you leave the page, and you would need to run the request again.
You must include these values as the X-User-Id and X-Auth-Token headers when calling any endpoint that requires authentication.
Next, let’s look at how to send authenticated requests using these parameters.