Configuration
Fusion Stack reads config/api.php. Publish it with php artisan api:install, or php artisan vendor:publish --tag=fusion-stack-config. Each section below is one top-level key, with its default.
request_id
| Key | Default | What it does |
|---|---|---|
enabled | true | Give every response an X-Request-Id header. A valid incoming value is kept; otherwise a req_… ID is generated. The ID is added to the log context and to the meta of every error. |
auth
Each request tries guards in order. The first that authenticates it becomes the request's guard, and its resolver turns the identity into an ApiClient: client ID, scopes, pinned version and rate limit tier. Guards the application does not define are skipped.
| Key | Default | What it does |
|---|---|---|
enabled | true | Resolve an ApiClient for each request. |
guards | ['api_key', 'sanctum'] | The guards to try, in order. api_key is built in: send Authorization: Bearer fs_live_…. |
resolvers | api_key → ApiKeyResolver, sanctum → SanctumResolver | The resolver for each guard. |
resolver | AttributeResolver | The resolver for guards not in resolvers. It reads the attributes below from the authenticated model or token claims. |
attributes | scopes → api_scopes, version → api_version, rate_limit_tier → api_rate_limit_tier | Which attributes hold the client's scopes, pinned version and rate limit tier. |
test_keys_in_production | false | Whether fs_test_ API keys work when APP_ENV is production. Off, production answers them with a 401, as it does an unknown key. |
rate_limit
Requests are limited per client, or per IP address for guests. Counts live in the cache store set by Laravel's cache.limiter.
| Key | Default | What it does |
|---|---|---|
enabled | true | Limit requests and send the RateLimit-* headers. |
tiers | guest: 60 a minute, default: 300 a minute | Each tier's limit and per_seconds. A client without a tier, or with an unknown one, uses default; guests use guest. A null limit is unlimited. |
versions
See Versioning.
| Key | Default | What it does |
|---|---|---|
enabled | false | Turn on date-based versioning. While off, every request gets the current API and the Api-Version header is ignored. |
latest | null | The newest released version, such as 2027-01-15.atlas. Set by api:version:release. |
default | null | The version for requests without an Api-Version header or a pinned client. Defaults to latest. When turning versioning on in an existing API, set it to the baseline date so existing clients keep their behaviour. |
changes | [] | Each version and the version change classes it introduces, such as '2027-01-15.atlas' => [RenameCustomerNameToFullName::class]. List a version with only additive changes with an empty list. |
retired | [] | Versions that now get a 410 api_version_retired. |
keep | 2 | How many released versions stay current; older ones are deprecated. null keeps every version until it is listed in deprecated or retired. |
deprecated | [] | Versions deprecated by hand, each with an optional sunset date and brownouts, a list of start and end times when it answers 410 api_version_brownout. After its sunset a version is retired. |
track_usage | true | Record each authenticated client's version once a day, with a queued job, for api:version:usage. |
upgrade_guide_url | null | Linked from api_version_retired errors. |
changelog_url | null | Linked from deprecated versions' responses in a Link: <…>; rel="deprecation" header. Falls back to upgrade_guide_url. |
query
Limits for endpoints built with ApiQuery. Requests over a limit get a 400, not a silently clamped result.
| Key | Default | What it does |
|---|---|---|
max_include_depth | 3 | How deep include may nest, such as orders.customer.team. |
page_size | 25 | The page size when the request sets none. |
max_page_size | 100 | The largest page[size] a request may ask for. |
idempotency
See Idempotency.
| Key | Default | What it does |
|---|---|---|
enabled | true | Store responses to requests with an Idempotency-Key and replay them to retries. |
methods | ['POST', 'PATCH', 'DELETE'] | The methods that honour the header. |
ttl | 86400 | How many seconds a stored response is kept. |
lock_seconds | 60 | How long a running request holds its key. Retries within this time get 409 idempotency_in_progress. |
store | null | The cache store. It must support atomic locks; Redis is recommended. null uses the default store. |
http_cache
See Caching.
| Key | Default | What it does |
|---|---|---|
etags | true | Give successful GET and HEAD responses a weak ETag, and answer a matching If-None-Match with 304 Not Modified. Each version has its own ETags. |
cache_control | 'private, no-cache' | The Cache-Control of responses whose route or action sets none. The default makes clients revalidate with the ETag every time. |
vary | ['Api-Version', 'Authorization', 'Accept'] | The Vary header of every GET and HEAD response. Api-Version is left out while versioning is off. |
response_cache
Successful GET responses of actions marked #[CacheResponse] are stored in the latest version's shape, so one entry serves every version.
| Key | Default | What it does |
|---|---|---|
enabled | true | Switch every #[CacheResponse] off at once when false. |
store | null | The cache store. null uses the default store. |
openapi
What api:openapi and the API reference put in the OpenAPI document.
| Key | Default | What it does |
|---|---|---|
title | null | The API's title. null uses app.name. |
description | null | A description of the API, in Markdown. |
servers | null | The server URLs. null uses app.url. |
version | '1.0.0' | The document's version while versioning is off. With versioning on it is the API version. |
error_codes | [] | Your own error code enums, documented with the package's. |
docs
The API reference page, with a switcher between the released versions that are not retired, and a changelog page.
| Key | Default | What it does |
|---|---|---|
enabled | true | Serve the API reference. |
path | 'docs' | Where to serve it. The OpenAPI document is at {path}/openapi.json. |
middleware | [] | The route's middleware. It is public by default; add ['web', 'auth'] for a private API. |
renderer | 'scalar' | scalar or redoc. |
scalar | Scalar 1.86.1 on jsDelivr | The Scalar script's url and integrity, and a config passed to Scalar.createApiReference, such as ['theme' => 'purple']. Without a theme or customCss, the reference uses Fusion Stack's colours. Scalar's developer toolbar (showDeveloperTools) and AI assistant (agent) are off unless you set them. |
redoc | Redoc 2.5.4 on redoc.ly | The Redoc script's url and integrity. |
integrity | The hash of each default script | Under scalar and redoc: the hash of the file at url, such as sha384-…. The browser only runs the script when it matches. When you change a url, set it to that file's hash, or to null to load the script unchecked. |
lint | 'warn' | What api:docs:lint does when something has no description: warn lists it, fail also exits with an error. |
webhooks
| Key | Default | What it does |
|---|---|---|
connection | null | The queue connection for deliveries. null uses the default. |
queue | null | The queue for deliveries. null uses the default. |
timeout | 10 | How many seconds a delivery waits for a response. |
backoff | 1 min to 12 h | The delays in seconds between retries of a failed delivery. The defaults make 8 attempts over about 23 hours. The sync queue cannot delay jobs, so there each delivery is tried once. |
disable_after | 5 | Disable an endpoint after this many deliveries in a row fail, and dispatch WebhookEndpointDisabled. null never disables. |
allow_private_addresses | false | Deliver to addresses that are not on the public internet, such as localhost and private networks. Off, a delivery to such a host fails without being sent. Redirects are never followed. |
errors
| Key | Default | What it does |
|---|---|---|
paths | ['*'] | Requests matching these paths have their exceptions rendered as JSON:API errors. api:install narrows it to the API's prefix, such as ['api/*'], so web pages keep Laravel's error pages. |
mcp
From fusion-stack/mcp, read as config('api.mcp'). Publish them to config/api-mcp.php with php artisan vendor:publish --tag=fusion-stack-mcp-config. See MCP server.
| Key | Default | What it does |
|---|---|---|
enabled | true | Serve the endpoints marked #[McpTool] as MCP tools. |
path | 'mcp' | Where to serve them. |
middleware | [] | Middleware that authenticates the MCP connection itself, such as auth:sanctum. Each tool call also runs through the API with the caller's Authorization header. |
name | null | The server's name. null uses app.name. |
version | null | The API version the tools speak. null uses the latest. |
log_channel | null | Where each tool call is logged. null uses the default channel; false logs nothing. |