You can call the Integry API to get or set tasks limits per user. Go to Workspace Settings > Security to find your API key.
Get the task status of a user
GET https://app.integry.io/partners/api/insights/users/<id>/tasks/?app_key=APP_KEY_OF_ACCOUNT
Headers
api-key: <partner api key>
Response
{
"user_id":"test@example.com", // your user ID
"current_limit":10000,
"limit_period":"30", // in days
"tasks_consumed":5000,
"tasks_remaining":5000,
"limit_reset_after":10 // in days
}
-
-
- App_key: This is your app's key and can be found in the SDK embed
- API-key: This is your API secret and can be found in your account
- id: This is the user's email id whose current tasks you are fetching
-
Get the task status of all users
GET https://app.integry.io/partners/api/insights/users/tasks/?app_key=APP_KEY_OF_ACCOUNT
Headers
api-key: <partner api key>
Response
[
{
"user_id":"yasir@integry.io",
"current_limit":10000,
"limit_period":"30",
"tasks_consumed":5000,
"tasks_remaining":5000,
"tasks_consumed_percent":50,
"tasks_remaining_percent":50,
"limit_reset_after":10
}
]
-
-
- App_key: This is your app's key and can be found in the SDK embed
- API-key: This is your API secret and can be found in your account
-
Subscribe to events for various levels for task consumption
We will notify you when that level is breached.
POST https://app.integry.io/partners/api/insights/subscriptions/
Headers
api-key: <partner api key>
Body:
{
"events":[
"user_tasks_limit_80",
"user_tasks_limit_100"
],
"callback_url":"https://example.com/callback"
}
Response
{
"subscription_id":"123-1234-1234-1234"
}
Here is a sample payload of what we will send to your webhook URL when a user reaches a limit.
Headers:
subscription-id: <a valid subscription id> // it can be used to validate request
Payload:
{
"user_id":"yasir@integry.io",
"current_limit":10000,
"limit_period":"30",
"tasks_consumed":5000,
"tasks_remaining":5000,
"tasks_consumed_percent":50,
"tasks_remaining_percent":50,
"limit_reset_after":10
}
Delete the subscription:
DELETE https://app.integry.io/partners/api/insights/subscriptions/<subscription_id>/
Headers:
api-key: <partner api key>
Response:
{
"success":true
}
5. You can also set the task limit for one or more users using the following API call.
POST https://app.integry.io/partners/api/insights/users/tasks/?app_key=APP_KEY_OF_ACCOUNT
Headers
api-key: <partner api key>
Body:
[
{
"user_id":"yasir@integry.io",
"allowed_tasks":10000
},
{
"user_id":"test@integry.io",
"allowed_tasks":10000
}
]
Response
{
"success":"true"
}
-
-
- App_key: This is your app's key and can be found in the SDK embed
- API-key: This is your API secret and can be found in your account
- user_id: This is the user's email id whose tasks limit you are setting
-
Set the default task limit of all new users
PATCH https://app.integry.io/partners/api/accounts/me/
Headers
api-key: <partner api key>
Body:
{
"tasks_limit":15000
}
Response
{
"success":"true"
}
Update the default tasks limit of all existing users
POST https://app.integry.io/partners/api/insights/users/tasks-bulk/
Headers
api-key: <partner api key>
Body:
{
"tasks_limit":15000
}
Response
{
"success":"true"
}