RequestRocketRequestRocketDocs
ControlLimits

Meter limits API

Read the counters for a meter's windows.

The windows are stored on the meter. They are fixed UTC calendar windows, not rolling periods. This route reads the current counters. A call blocked by a reached limit returns 429, requestrocket-proxy-code: rate-limited, and Retry-After with seconds until the latest exceeded window resets.

Endpoints

MethodPathWhat it does
GET/api/clients/:clientId/proxies/:proxyId/meters/:meterId/usageRead minute, hour, day, and month counters
PUT/api/clients/:clientId/proxies/:proxyId/meters/:meterIdSet the windows on the meter

Read usage

GET /api/clients/:clientId/proxies/:proxyId/meters/:meterId/usage returns the counters for the windows that are configured.

Request

curl -X GET "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId/usage" \
  -H "Authorization: u-your-token"
import axios from "axios";

const response = await axios.request({
  method: "GET",
  url: "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId/usage",
  headers: {
    "Authorization": "u-your-token",
  }
});

console.log(response.status, response.data);
import requests

response = requests.request(
    "GET",
    "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId/usage",
    headers={
        "Authorization": "u-your-token",
    }
)
print(response.status_code, response.json())
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    var payload io.Reader
    req, _ := http.NewRequest("GET", "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId/usage", payload)
    req.Header.Set("Authorization", "u-your-token")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.StatusCode, string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId/usage"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .header("Authorization", "u-your-token")
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}

Responses

{
  "meterId": "4b7c2e95-1a60-4d38-9f2b-8c5e0a3d7b16",
  "notes": "",
  "usage": {
    "minute": {
      "current": 12,
      "limit": 100,
      "windowKey": "2026-11-02-07-30"
    }
  },
  "message": "Success"
}
{
  "message": "Meter not found"
}
{
  "message": "Unauthorized"
}
{
  "Message": "User is not authorized to access this resource with an explicit deny in an identity-based policy"
}
{
  "message": "method / endpoint not supported"
}

Returns meterId, notes, and a usage object for each window that has a limit, with message set to "Success".

Query parameters

None.

Response attributes

AttributeTypeDescription
meterIdstringMeter id from the path.
notesstringNote stored on the meter, or empty string.
usageobjectOne entry for each configured window.
usage.minuteobjectMinute-window counters, when configured.
usage.hourobjectHour-window counters, when configured.
usage.dayobjectDay-window counters, when configured.
usage.monthobjectMonth-window counters, when configured.
usage.<window>.currentnumberCount in the open window.
usage.<window>.limitnumberCap stored on the meter for that window.
usage.<window>.windowKeystringOpen window in UTC. Minute: YYYY-MM-DD-HH-mm, hour: YYYY-MM-DD-HH, day: YYYY-MM-DD, month: YYYY-MM.
messagestring"Success".

Set windows

PUT /api/clients/:clientId/proxies/:proxyId/meters/:meterId writes the enforced windows. A window is counted when it has a limit or is used by a threshold alert.

Request

curl -X PUT "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId" \
  -H "Authorization: u-your-token" \
  -H "Content-Type: application/json" \
  -d '{
  "limits": {
    "minute": 100,
    "hour": 1000
  }
}'
import axios from "axios";

const response = await axios.request({
  method: "PUT",
  url: "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId",
  headers: {
    "Authorization": "u-your-token",
    "Content-Type": "application/json",
  },
  data: {
  "limits": {
    "minute": 100,
    "hour": 1000
  }
}
});

console.log(response.status, response.data);
import requests

response = requests.request(
    "PUT",
    "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId",
    headers={
        "Authorization": "u-your-token",
        "Content-Type": "application/json",
    },
    data="{\n  \"limits\": {\n    \"minute\": 100,\n    \"hour\": 1000\n  }\n}"
)
print(response.status_code, response.json())
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader(`{
  "limits": {
    "minute": 100,
    "hour": 1000
  }
}`)
    req, _ := http.NewRequest("PUT", "https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId", payload)
    req.Header.Set("Authorization", "u-your-token")
    req.Header.Set("Content-Type", "application/json")
    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()
    body, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.StatusCode, string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.requestrocket.com/api/clients/:clientId/proxies/:proxyId/meters/:meterId"))
            .method("PUT", HttpRequest.BodyPublishers.ofString("{\n  \"limits\": {\n    \"minute\": 100,\n    \"hour\": 1000\n  }\n}"))
            .header("Authorization", "u-your-token")
            .header("Content-Type", "application/json")
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode());
        System.out.println(response.body());
    }
}

Responses

{
  "meters": [
    {
      "pKey": "5d8a1c30-4e72-4b19-8f6a-0c3d9e7b1a25",
      "sKey": "4b7c2e95-1a60-4d38-9f2b-8c5e0a3d7b16",
      "meterType": "request_count",
      "meterActive": true,
      "limits": {
        "minute": 100,
        "hour": 1000
      },
      "updatedAt": "2026-11-02T07:30:00.000Z"
    }
  ],
  "message": "Success"
}
{
  "message": "Meter not found"
}
{
  "message": "Unauthorized"
}
{
  "Message": "User is not authorized to access this resource with an explicit deny in an identity-based policy"
}
{
  "message": "method / endpoint not supported"
}

Returns a meters array with the updated meter and message set to "Success".

This is the meter update. All fields are optional. Omit a field to leave it unchanged; send null to clear it. The other fields are on Meters. Sending limits replaces the whole limits object.

Request body

ParameterTypeRequiredDescription
limitsobject—Windows to count and enforce. Shape: { minute?, hour?, day?, month? }, each a number. The object you send replaces every limit on the meter.

Returns a meters array. The attributes match Meters API.

Caller response when a limit is reached

{
  "error": "Too Many Requests",
  "message": "Usage limit exceeded for this proxy.",
  "meters": [
    {
      "meterId": "4b7c2e95-1a60-4d38-9f2b-8c5e0a3d7b16",
      "window": "minute",
      "limit": 100,
      "current": 100
    }
  ]
}

Next

On this page