This guide explains how to retrieve the remaining API request quota and rate limit information from the TempMail.so API. The steps are described in a way that is applicable to all programming languages, ensuring ease of implementation.
You will need the following to authenticate your API requests:
x-rapidapi-key: Your API key from RapidAPI.Authorizationtoken: A bearer token provided by TempMail.so.
Send an HTTP GET request to the following endpoint:
https://tempmail-so.p.rapidapi.com/domains
Include the following headers in your request:
x-rapidapi-key: Your RapidAPI key.Authorization: A bearer token in the formatBearer <your_auth_token>.Content-Type: Set this toapplication/x-www-form-urlencoded.
After the API responds, look at the response headers to find the following information about your API usage:
X-RateLimit-Requests-Limit: The total number of API requests allowed per day.X-RateLimit-Requests-Remaining: The number of requests remaining for the current day.X-RateLimit-Requests-Reset: The number of seconds until the daily limit resets.
These headers allow you to monitor your API usage and manage it effectively:
- Example: If the header
X-RateLimit-Requests-Limitshows1000andX-RateLimit-Requests-Remainingshows800, it means you have 800 requests left out of a daily limit of 1000.
The process described above is not language-specific. You can use any HTTP client library available in your preferred programming language to:
- Send a
GETrequest to the TempMail.so API. - Include the required headers.
- Extract the rate limit information from the response headers.
For example:
- In JavaScript, use libraries like
axiosorfetch. - In Java, you might use
HttpURLConnectionor libraries likeOkHttp. - In C#, the
HttpClientclass is commonly used.
- Construct the HTTP request with the correct endpoint and headers.
- Send the request.
- Inspect the response headers for
X-RateLimit-Requests-Limit,X-RateLimit-Requests-Remaining, andX-RateLimit-Requests-Reset.
- Invalid API Key: Ensure that the
x-rapidapi-keyis correct and active. - Expired Authorization Token: Verify that the
Authorizationtoken is valid and has not expired. - Missing Headers: If the expected headers are not present in the response, confirm that the endpoint and request headers are correct.
For more details about the TempMail.so API, refer to the official documentation.