Learn to generate an access token to be used for various API requests
🧰 What You Will Need
A Membership.io account
What can I use this for?
Our API requires an access token for secure communication. This guide explains how to start authentication so you can use our API. You'll learn to generate an access token, include it in API requests, and understand potential issues and other security measures.
Step 1 - Generate an authentication token
Use the Authenticate option on the left, then choose Authenticate user and generate bearer token.
Under BODY PARAMS, enter your email and password for authentication.
Select your preferred language on the right side and click the Try It! button. We've used Shell in this example.
NOTE: You will receive a 405 error response after clicking "Try It!" This is because of the rebranding to Membership.io, which means you temporarily won't be able to generate a token using the previous method. Instead, please follow these alternative steps to generate your access token.
First, copy the code as shown in the image below:
Then, paste the code into the text editor of your choice. Edit the URL field and change "app.searchie.io" to "app.membership.io". Copy this code that you've modified.
This action will create an access token you can copy and use for future requests.
To generate the access token, open your terminal, paste the code, and run it.
Step 2 - Use the access token
After obtaining the token, include it in the header of your API requests. You can find the Header field under "CREDENTIALS."
For the response, you could get any of the following response codes:
- Success (200): The user profile data is returned.
- Failure (401): Indicates an invalid or expired token. Please ensure you are using a valid token.
Manage your token
Token expiry and regeneration
Tokens are automatically revoked when you generate a new one. This ensures the previous token is invalidated. Simply repeat the token generation process to refresh your credentials.
Security considerations
Here’s what you need to know about security measures:
- IP restrictions or ranges: No specific IP ranges are required for API calls. You can use the provided endpoints without additional configurations.
- Rate limits: We did not specify rate limits for the authentication endpoint, but it's best to get in touch with us at help@membership.io to confirm if you plan to make high-frequency API requests.
Best practices
- Always keep your access token secure and avoid exposing it in shared environments.
- Use HTTPS for all API communications to protect sensitive information during transmission.
Troubleshoot potential issues
Incorrect token usage
A "401 Unauthorized" error code typically indicates an issue with your token. When you see this, double-check if:
- The token is included in the CREDENTIALS header.
- The token has been replaced.
Unexpected errors
If you encounter issues not covered here, reach out to our support team at help@membership.io for assistance.