> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://respan.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://respan.ai/docs/_mcp/server.

# Get a limit policy

GET https://api.respan.ai/api/limit-policies/{id}/

Return the policy with its live `current_state`.

Reference: https://respan.ai/docs/apis/limit-policies/get-limit-policy

## Authentication

- `Authorization` header (bearer token, required) — Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer \<RESPAN\_API\_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan\_params.credential\_override in the request body, not in this authentication field.

## Request

### Path parameters

- `id` (string, required) — Limit policy id.

## Response

### 200

The policy.

- `id` (string, optional)
- `name` (string, optional) — Human label.
- `scope` (string, optional) — Display category (e.g. `API Key`, `Model`). Not used for matching.
- `scope_value` (string, optional) — Identity to meter. For composites, a JSON list of values in `compose` order.
- `compose` (list of string, optional) — Empty for single-dimension policies. Members: `organization_id`, `api_key_id`, `user_id`, `customer_identifier`, `model`, `endpoint`.
- `metric` (enum, optional, default: cost) — What the cap counts. `cost` is US dollars, `token_count` is total tokens, `request_count` is calls.
  - Allowed values: `cost`, `request_count`, `token_count`
- `algorithm` (enum, optional, default: balance_fixed_window) — `balance_fixed_window` is the shipped algorithm. `token_bucket` is reserved and not yet enforced.
  - Allowed values: `balance_fixed_window`
- `period` (string, optional, nullable) — Cadence. A named bucket (`minute`, `hour`, `day`, `week`, `month`), a positive integer of seconds as a string, or `null` for a cumulative (lifetime) cap that never resets.
- `anchor` (enum, optional, default: calendar) — When a recurring window aligns. `calendar` resets on the boundary (e.g. the 1st of the month).
  - Allowed values: `calendar`, `first_event`, `explicit_ts`
- `anchor_at` (datetime, optional, nullable) — Required when `anchor` is not `calendar`.
- `effective_at` (datetime, optional, nullable) — Active-range start. `null` = live since forever.
- `expires_at` (datetime, optional, nullable) — Active-range end. `null` = live until deactivated. Must be after `effective_at`.
- `priority` (integer, optional, default: 0) — Higher is checked first.
- `is_active` (boolean, optional, default: true)
- `rules` (list of LimitPolicyRule, optional) — Any number of soft rules and at most one effective hard rule.
- `threshold_value` (double, optional) — First hard-rule threshold; falls back to the largest soft threshold.
- `meter_definition_id` (string, optional) — Stable hash of the policy identity. Same identity resolves to the same id across recreations.
- `current_state` (LimitPolicyCurrentState, optional) — Live counter for the current window instance.
- `created_at` (datetime, optional)
- `updated_at` (datetime, optional)

## Errors

### 403 Forbidden Error

The API key is missing, invalid or expired.

- `detail` (string, required)

### 404 Not Found Error

Limit policy not found.

- `detail` (string, required)

## Types

### LimitPolicyRule

- `trigger` (map from string to any, required) — Threshold condition. Common shape: `{"counter": {"operator": "gte", "value": 10000}}`.
- `severity` (enum, required) — `soft` fires an alert without blocking; `hard` blocks the request with 429.
  - Allowed values: `soft`, `hard`
- `description` (string, optional, nullable) — Shown in events and alert payloads.
- `is_active` (boolean, optional, default: true)
- `notification_method_id` (string, optional, nullable) — Optional OrganizationNotificationMethod id to ping when this rule trips.

### LimitPolicyCurrentState

Live counter for the current window instance.

- `meter_id` (string, optional)
- `interval_start` (integer, optional, nullable) — Epoch seconds, inclusive.
- `interval_end` (integer, optional, nullable) — Epoch seconds, exclusive.
- `current_value` (double, optional) — Accumulated value in this window.

## Examples

**Response**

```json
{
  "id": "string",
  "name": "string",
  "scope": "string",
  "scope_value": "string",
  "compose": [
    "string"
  ],
  "metric": "cost",
  "algorithm": "balance_fixed_window",
  "period": "string",
  "anchor": "calendar",
  "anchor_at": "2024-01-15T09:30:00Z",
  "effective_at": "2024-01-15T09:30:00Z",
  "expires_at": "2024-01-15T09:30:00Z",
  "priority": 0,
  "is_active": true,
  "rules": [
    {
      "trigger": {},
      "severity": "soft",
      "description": "string",
      "is_active": true,
      "notification_method_id": "string"
    }
  ],
  "threshold_value": 1.1,
  "meter_definition_id": "string",
  "current_state": {
    "meter_id": "string",
    "interval_start": 1,
    "interval_end": 1,
    "current_value": 1.1
  },
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.respan.ai/api/limit-policies/id/"

headers = {"Authorization": "Bearer <respanApiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.respan.ai/api/limit-policies/id/';
const options = {method: 'GET', headers: {Authorization: 'Bearer <respanApiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.respan.ai/api/limit-policies/id/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <respanApiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.respan.ai/api/limit-policies/id/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <respanApiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.respan.ai/api/limit-policies/id/")
  .header("Authorization", "Bearer <respanApiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.respan.ai/api/limit-policies/id/', [
  'headers' => [
    'Authorization' => 'Bearer <respanApiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.respan.ai/api/limit-policies/id/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <respanApiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <respanApiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.respan.ai/api/limit-policies/id/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```