curl --request GET \
--url https://api.affinity.co/v2/rate-limit \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.affinity.co/v2/rate-limit"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.affinity.co/v2/rate-limit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.affinity.co/v2/rate-limit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.affinity.co/v2/rate-limit"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.affinity.co/v2/rate-limit")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/rate-limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"callerPerMinute": {
"limit": 300,
"remaining": 299,
"reset": 42,
"used": 1
},
"orgPerMonth": {
"limit": 100000,
"remaining": 99999,
"reset": 1200000,
"used": 1
}
}Get rate limit usage
| ⚠️ This endpoint is currently in BETA |
|---|
Returns the current rate limit usage for the authenticated caller.
orgPerMonth is included only for callers that have a monthly quota; it is absent for callers that don’t have one.
curl --request GET \
--url https://api.affinity.co/v2/rate-limit \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.affinity.co/v2/rate-limit"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.affinity.co/v2/rate-limit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.affinity.co/v2/rate-limit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.affinity.co/v2/rate-limit"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.affinity.co/v2/rate-limit")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.affinity.co/v2/rate-limit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"callerPerMinute": {
"limit": 300,
"remaining": 299,
"reset": 42,
"used": 1
},
"orgPerMonth": {
"limit": 100000,
"remaining": 99999,
"reset": 1200000,
"used": 1
}
}Authorizations
A static Affinity API key, presented as a bearer token.
Response
OK
Rate limit usage for the authenticated caller. Contains one or two windows depending on the caller's quota configuration: callerPerMinute is always present (per-caller minute limit); orgPerMonth is present only for callers whose org has a bounded monthly quota (DEVELOPER keys and OAuth apps on capped plans). Absence of orgPerMonth indicates no monthly quota applies.
Rate limit window for per-caller requests within a one-minute period.
Show child attributes
Show child attributes
Rate limit window for monthly aggregate requests. Only present for callers with a monthly quota; omitted for API key types without monthly limits.
Show child attributes
Show child attributes
Was this page helpful?