/Rules

Rules and limits

Rules

What a key may do: allowed endpoints, request limits and an expiry date.

Each ghost key has its own rules, edited in the dashboard or through the API. Anything not allowed is refused. null means no limit.

rules.json
1{2  "allow": [3    { "method": "POST", "path": "/v1/payment_intents" },4    { "method": "GET",  "path": "/v1/**" }5  ],6  "ratePerMinute": 100,7  "dailyRequests": 5000,8  "maxAmount":   { "usd": 5000 },9  "dailyAmount": { "usd": 50000 },10  "allowConnectedAccounts": false,11  "allowedModels": null,12  "dailyTokens": null,13  "graphql": null,14  "allowedIps": ["203.0.113.0/24"],15  "allowedCountries": ["NL", "DE"],16  "autoKill": { "blockedPerMinute": 20, "onNewCountry": false, "onSpike": true },17  "expiresAt": null18}
FieldMeaning
allowEndpoints the key may call. method is GET, POST, PUT, PATCH, DELETE or *. In path, * matches one segment and a final ** matches the rest.
ratePerMinuteRequests per minute, measured over a sliding window.
dailyRequestsRequests per UTC day.
maxAmountLargest amount per Stripe request, per currency, in the smallest unit (cents). A currency that is not listed is refused.
dailyAmountTotal amount per UTC day, per currency, in the smallest unit.
allowConnectedAccountsAllows the Stripe-Account header and parameters that send money to other accounts, such as transfer_data[destination].
allowedModelsFor AI providers: the only models the key may use.
dailyTokensFor AI providers: input plus output tokens per UTC day.
graphqlFor GraphQL APIs: { allowMutations, allowSubscriptions, operations }. See GraphQL below.
allowedIpsIPv4 or IPv6 addresses and CIDR ranges the key may be used from, up to 100.
allowedCountriesTwo-letter country codes the key may be used from, such as ["NL", "US"].
allowedOriginsWebsites whose pages may use the key, up to 50, such as ["https://app.acme.com"]. null: web pages are refused. See Websites and apps.
visitorPerMinute, visitorPerDayRequests one visitor (one IP address; on IPv6, one /64) may make per minute and per UTC day.
userPerMinute, userPerDayFor short-lived keys: requests one of your users may make per minute and per UTC day, across all of that user's short-lived keys.
userDailyBudgetFor AI providers and short-lived keys: the estimated cost one of your users may run up per UTC day, in US cents.
autoKillKill the key by itself when it looks leaked: { blockedPerMinute, onNewCountry, onSpike }. See Automatic kill below.
expiresAtTime in milliseconds since 1970 after which the key stops working.

Still have a question?

We read every email, usually within a day.

Contact support