Skip to content

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 ​

KeyDefaultWhat it does
enabledtrueGive 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.

KeyDefaultWhat it does
enabledtrueResolve 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_….
resolversapi_key → ApiKeyResolver, sanctum → SanctumResolverThe resolver for each guard.
resolverAttributeResolverThe resolver for guards not in resolvers. It reads the attributes below from the authenticated model or token claims.
attributesscopes → api_scopes, version → api_version, rate_limit_tier → api_rate_limit_tierWhich attributes hold the client's scopes, pinned version and rate limit tier.
test_keys_in_productionfalseWhether 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.

KeyDefaultWhat it does
enabledtrueLimit requests and send the RateLimit-* headers.
tiersguest: 60 a minute, default: 300 a minuteEach 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.

KeyDefaultWhat it does
enabledfalseTurn on date-based versioning. While off, every request gets the current API and the Api-Version header is ignored.
latestnullThe newest released version, such as 2027-01-15.atlas. Set by api:version:release.
defaultnullThe 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.
keep2How 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_usagetrueRecord each authenticated client's version once a day, with a queued job, for api:version:usage.
upgrade_guide_urlnullLinked from api_version_retired errors.
changelog_urlnullLinked 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.

KeyDefaultWhat it does
max_include_depth3How deep include may nest, such as orders.customer.team.
page_size25The page size when the request sets none.
max_page_size100The largest page[size] a request may ask for.

idempotency ​

See Idempotency.

KeyDefaultWhat it does
enabledtrueStore responses to requests with an Idempotency-Key and replay them to retries.
methods['POST', 'PATCH', 'DELETE']The methods that honour the header.
ttl86400How many seconds a stored response is kept.
lock_seconds60How long a running request holds its key. Retries within this time get 409 idempotency_in_progress.
storenullThe cache store. It must support atomic locks; Redis is recommended. null uses the default store.

http_cache ​

See Caching.

KeyDefaultWhat it does
etagstrueGive 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.

KeyDefaultWhat it does
enabledtrueSwitch every #[CacheResponse] off at once when false.
storenullThe cache store. null uses the default store.

openapi ​

What api:openapi and the API reference put in the OpenAPI document.

KeyDefaultWhat it does
titlenullThe API's title. null uses app.name.
descriptionnullA description of the API, in Markdown.
serversnullThe 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.

KeyDefaultWhat it does
enabledtrueServe 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.
scalarScalar 1.86.1 on jsDelivrThe 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.
redocRedoc 2.5.4 on redoc.lyThe Redoc script's url and integrity.
integrityThe hash of each default scriptUnder 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 ​

KeyDefaultWhat it does
connectionnullThe queue connection for deliveries. null uses the default.
queuenullThe queue for deliveries. null uses the default.
timeout10How many seconds a delivery waits for a response.
backoff1 min to 12 hThe 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_after5Disable an endpoint after this many deliveries in a row fail, and dispatch WebhookEndpointDisabled. null never disables.
allow_private_addressesfalseDeliver 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 ​

KeyDefaultWhat 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.

KeyDefaultWhat it does
enabledtrueServe 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.
namenullThe server's name. null uses app.name.
versionnullThe API version the tools speak. null uses the latest.
log_channelnullWhere each tool call is logged. null uses the default channel; false logs nothing.

Released under the MIT License.