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}| Field | Meaning |
|---|---|
allow | Endpoints the key may call. method is GET, POST, PUT, PATCH, DELETE or *. In path, * matches one segment and a final ** matches the rest. |
ratePerMinute | Requests per minute, measured over a sliding window. |
dailyRequests | Requests per UTC day. |
maxAmount | Largest amount per Stripe request, per currency, in the smallest unit (cents). A currency that is not listed is refused. |
dailyAmount | Total amount per UTC day, per currency, in the smallest unit. |
allowConnectedAccounts | Allows the Stripe-Account header and parameters that send money to other accounts, such as transfer_data[destination]. |
allowedModels | For AI providers: the only models the key may use. |
dailyTokens | For AI providers: input plus output tokens per UTC day. |
graphql | For GraphQL APIs: { allowMutations, allowSubscriptions, operations }. See GraphQL below. |
allowedIps | IPv4 or IPv6 addresses and CIDR ranges the key may be used from, up to 100. |
allowedCountries | Two-letter country codes the key may be used from, such as ["NL", "US"]. |
allowedOrigins | Websites 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, visitorPerDay | Requests one visitor (one IP address; on IPv6, one /64) may make per minute and per UTC day. |
userPerMinute, userPerDay | For 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. |
userDailyBudget | For AI providers and short-lived keys: the estimated cost one of your users may run up per UTC day, in US cents. |
autoKill | Kill the key by itself when it looks leaked: { blockedPerMinute, onNewCountry, onSpike }. See Automatic kill below. |
expiresAt | Time in milliseconds since 1970 after which the key stops working. |
Still have a question?
We read every email, usually within a day.