For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.
List guardrails
GET https://modelgates.ai/api/v1/guardrails
List all guardrails for the authenticated user. Management key required.
Reference: https://modelgates.ai/docs/api/api-reference/guardrails/list-guardrails
OpenAPI Specification
yaml
openapi: 3.1.0info: title: ModelGates API version: 1.0.0paths: /guardrails: get: operationId: list-guardrails summary: List guardrails description: >- List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required. tags: - subpackage_guardrails parameters: - name: offset in: query description: Number of records to skip for pagination required: false schema: type: integer - name: limit in: query description: Maximum number of records to return (max 100) required: false schema: type: integer - name: workspace_id in: query description: >- Filter guardrails by workspace ID. By default, guardrails in the default workspace are returned. required: false schema: type: string format: uuid - name: Authorization in: header description: API key as bearer token in Authorization header required: true schema: type: string responses: '200': description: List of guardrails content: application/json: schema: $ref: '#/components/schemas/ListGuardrailsResponse' '401': description: Unauthorized - Authentication required or invalid credentials content: application/json: schema: $ref: '#/components/schemas/UnauthorizedResponse' '500': description: Internal Server Error - Unexpected server error content: application/json: schema: $ref: '#/components/schemas/InternalServerResponse'servers: - url: https://modelgates.ai/api/v1components: schemas: ContentFilterBuiltinAction: type: string enum: - redact - block - flag description: Action taken when the builtin filter triggers title: ContentFilterBuiltinAction ContentFilterBuiltinSlug: type: string enum: - email - phone - ssn - credit-card - ip-address - person-name - address - regex-prompt-injection description: The builtin filter identifier title: ContentFilterBuiltinSlug ContentFilterBuiltinEntry: type: object properties: action: $ref: '#/components/schemas/ContentFilterBuiltinAction' label: type: string description: >- Optional label used in redaction placeholders (e.g. "[PROMPT_INJECTION]") slug: $ref: '#/components/schemas/ContentFilterBuiltinSlug' required: - action - slug description: >- A builtin content filter entry. Builtin filters include PII detectors and the regex-based prompt injection detector. title: ContentFilterBuiltinEntry ContentFilterAction: type: string enum: - redact - block description: Action taken when the pattern matches title: ContentFilterAction ContentFilterEntry: type: object properties: action: $ref: '#/components/schemas/ContentFilterAction' label: type: - string - 'null' description: Optional label used in redaction placeholders or error messages pattern: type: string description: A regex pattern to match against request content required: - action - pattern description: >- A custom regex content filter that scans request messages for matching patterns. title: ContentFilterEntry GuardrailInterval: type: string enum: - daily - weekly - monthly description: Interval at which the limit resets (daily, weekly, monthly) title: GuardrailInterval Guardrail: type: object properties: allowed_models: type: - array - 'null' items: type: string description: Array of model canonical_slugs (immutable identifiers) allowed_providers: type: - array - 'null' items: type: string description: List of allowed provider IDs content_filter_builtins: type: - array - 'null' items: $ref: '#/components/schemas/ContentFilterBuiltinEntry' description: >- Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. content_filters: type: - array - 'null' items: $ref: '#/components/schemas/ContentFilterEntry' description: Custom regex content filters applied to request messages created_at: type: string description: ISO 8601 timestamp of when the guardrail was created description: type: - string - 'null' description: Description of the guardrail enforce_zdr: type: - boolean - 'null' description: >- Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. enforce_zdr_anthropic: type: - boolean - 'null' description: >- Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. enforce_zdr_google: type: - boolean - 'null' description: >- Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. enforce_zdr_openai: type: - boolean - 'null' description: >- Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. enforce_zdr_other: type: - boolean - 'null' description: >- Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. id: type: string format: uuid description: Unique identifier for the guardrail ignored_models: type: - array - 'null' items: type: string description: Array of model canonical_slugs to exclude from routing ignored_providers: type: - array - 'null' items: type: string description: List of provider IDs to exclude from routing limit_usd: type: - number - 'null' format: double description: Spending limit in USD name: type: string description: Name of the guardrail reset_interval: $ref: '#/components/schemas/GuardrailInterval' updated_at: type: - string - 'null' description: ISO 8601 timestamp of when the guardrail was last updated workspace_id: type: string description: The workspace ID this guardrail belongs to. required: - created_at - id - name - workspace_id title: Guardrail ListGuardrailsResponse: type: object properties: data: type: array items: $ref: '#/components/schemas/Guardrail' description: List of guardrails total_count: type: integer description: Total number of guardrails required: - data - total_count title: ListGuardrailsResponse UnauthorizedResponseErrorData: type: object properties: code: type: integer message: type: string metadata: type: - object - 'null' additionalProperties: description: Any type required: - code - message description: Error data for UnauthorizedResponse title: UnauthorizedResponseErrorData UnauthorizedResponse: type: object properties: error: $ref: '#/components/schemas/UnauthorizedResponseErrorData' modelgates_metadata: type: - object - 'null' additionalProperties: description: Any type user_id: type: - string - 'null' required: - error description: Unauthorized - Authentication required or invalid credentials title: UnauthorizedResponse InternalServerResponseErrorData: type: object properties: code: type: integer message: type: string metadata: type: - object - 'null' additionalProperties: description: Any type required: - code - message description: Error data for InternalServerResponse title: InternalServerResponseErrorData InternalServerResponse: type: object properties: error: $ref: '#/components/schemas/InternalServerResponseErrorData' modelgates_metadata: type: - object - 'null' additionalProperties: description: Any type user_id: type: - string - 'null' required: - error description: Internal Server Error - Unexpected server error title: InternalServerResponse securitySchemes: apiKey: type: http scheme: bearer description: API key as bearer token in Authorization headerSDK Code Examples
python
import requests url = "https://modelgates.ai/api/v1/guardrails" headers = {"Authorization": "Bearer <token>"} response = requests.get(url, headers=headers) print(response.json())javascript
const url = 'https://modelgates.ai/api/v1/guardrails';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}}; 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://modelgates.ai/api/v1/guardrails" 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(res) fmt.Println(string(body)) }ruby
require 'uri'require 'net/http' url = URI("https://modelgates.ai/api/v1/guardrails") 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_bodyjava
import com.mashape.unirest.http.HttpResponse;import com.mashape.unirest.http.Unirest; HttpResponse<String> response = Unirest.get("https://modelgates.ai/api/v1/guardrails") .header("Authorization", "Bearer <token>") .asString();php
<?phprequire_once('vendor/autoload.php'); $client = new \GuzzleHttp\Client(); $response = $client->request('GET', 'https://modelgates.ai/api/v1/guardrails', [ 'headers' => [ 'Authorization' => 'Bearer <token>', ],]); echo $response->getBody();csharp
using RestSharp; var client = new RestClient("https://modelgates.ai/api/v1/guardrails");var request = new RestRequest(Method.GET);request.AddHeader("Authorization", "Bearer <token>");IRestResponse response = client.Execute(request);swift
import Foundation let headers = ["Authorization": "Bearer <token>"] let request = NSMutableURLRequest(url: NSURL(string: "https://modelgates.ai/api/v1/guardrails")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.httpMethod = "GET"request.allHTTPHeaderFields = headers let session = URLSession.sharedlet 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()