Scribe generates example responses by running your application in a special environment, and it uses the request context to generate URLs. By default, Scribe does not know your base URL unless you explicitly tell it. Therefore, the links in the pagination object fall back to relative URLs like /?page=1.
To get absolute URLs in Scribe's generated documentation, you need to set the base_url in your Scribe config file (config/scribe.php). This ensures Scribe is aware of your app's full URL when generating paginated links.
Solution Steps
-
Open
config/scribe.php. -
Find (or add) the
base_urlsetting near the top of the config file. -
Set it explicitly to your app's URL. For example:
'base_url' => env('SCRIBE_BASE_URL', env('APP_URL', 'https://hub.test')), -
Optionally, set
SCRIBE_BASE_URLin your.env:SCRIBE_BASE_URL=https://hub.test -
Regenerate Scribe documentation:
php artisan scribe:generate
Why is This Necessary?
Scribe doesn't always have access to your real request context, so you need to tell it what base URL to use. The APP_URL is not always respected unless it’s passed via SCRIBE_BASE_URL or directly in the config.
After this change, the links in your documented response will show absolute URLs as expected (e.g., https://hub.test/api/v1/sign-ins?page=1).
Summary:
Set the base_url option in config/scribe.php (or use SCRIBE_BASE_URL via .env) and then regenerate your docs. This will make Scribe output absolute URLs in paginated response examples.