Skip to content

API

Option Default Purpose
$apiPanels [] panels whose resources with $api are available under /api/v1/<slug>
$apiEndpoints [] classes with custom endpoints (Anvil\Api\ApiEndpoints)
$apiRateLimit 120 requests per minute and client (clients may have their own)
$apiIpRateLimit 600 requests per minute and IP address over all clients
$apiAccessLogDays 90 days the access log is kept (anvil:prune)
$apiSignatureWindow 300 seconds a signed request (X-Anvil-Signature) is valid
$apiExpiryNoticeDays 14 days before tokens and clients expire when owners are notified
$apiUnusedDays 90 days without a call after which owners are asked about the client
$apiTitle 'API' title of the OpenAPI description (/api/v1/openapi.json)
$apiLocale 'en' locale of API requests: validation messages and number parsing
public array $apiPanels = ['admin'];
public array $apiEndpoints = [\App\Api\DeploymentApi::class];
public string $apiTitle = 'ACME Back Office API';
  • Without $apiPanels and $apiEndpoints the API routes are not registered at all.
  • Schedule php spark anvil:api:review daily for the notices of expiring and unused clients, and anvil:prune for the access log.
  • $apiLocale keeps the API independent of the language of the application: numbers with a point, messages in English.

See API for machine clients.