Authorization
The HoopAI Platform supports the Authorization Code Grant flow with v2 APIs. Follow the step-by-step procedure below to use and understand the OAuth 2.0 flow.1. Register an OAuth app
- Go to the Marketplace
- Sign up for a developer account.
- Go to “My Apps,” and click on “Create App.”
- Fill up the required details in the form, then your app will be created.
- Click on the app, and it will take you to settings where you can configure the scopes, generate the keys, etc.
2. Add the app to your desired location
- Make the location/agency Admin go to the app’s Authorization Page URL.
- They select the location they want to connect.
- They are redirected to the redirect URL with the Authorization Code.
- Use the Authorization Code to get the Access token via the Get Access Token API under OAuth 2.0.
- Use the Access Token to call any API.
3. Get the app’s Authorization Page URL
To generate the Authorization Page URL for an app, replace theclient_id, redirect_uri, and scope in the template below. Then, redirect the location/agency admin trying to install your app to the URL.
Standard Auth URL flow:
For users who are not logged in at the time of giving consent, the developer has the option to initiate login in a new tab or the same tab. To initiate login in the same tab, append
&loginWindowOpenMode=self to the authorization URL. If this query parameter is not passed, login in a new tab is the default.code query parameter:
OAuth FAQs
How long are the access tokens valid?
Access tokens are valid for one day. After that, you can use the refresh token to get a new access token, which will also be valid for another day.How long are the refresh tokens valid?
Refresh tokens are valid for a year unless they are used. If they are used, the new refresh token is valid for a year as well.How should we handle token expiry?
You should:- Make a request to any API using the
accessToken. - If you get a response saying the token is expired, refresh the token using the refresh API and save the new access token and refresh token in your database.
- Make the request again with the new
accessToken.
What are the current rate limits for API 2.0?
The HoopAI Platform has implemented rate limits on public V2 APIs using OAuth to ensure optimal performance and stability:- Burst limit: A maximum of 100 API requests per 10 seconds for each Marketplace app per resource (Location or Company).
- Daily limit: 200,000 API requests per day for each Marketplace app per resource (Location or Company).
| Header | Description |
|---|---|
X-RateLimit-Limit-Daily | Your daily limit |
X-RateLimit-Daily-Remaining | Remaining requests for the day |
X-RateLimit-Interval-Milliseconds | Time interval for burst requests |
X-RateLimit-Max | Maximum request limit in the specified time interval |
X-RateLimit-Remaining | Remaining requests in the current time interval |
- Sub-account A: 200,000 API requests per day and 100 API requests per 10 seconds.
- Sub-account B: 200,000 API requests per day and 100 API requests per 10 seconds.
.png?fit=max&auto=format&n=EQK5eX9kTD8NzWwA&q=85&s=878008bf159fcc4964d0c0d508b6e400)