> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchski-attract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List captured page views

> Captured page views, newest first, a page at a time.

```php Laravel wrap theme={"dark"}
use Fetchski\AttractCmsLaravel\Facades\Attract;

$requestLogPage = Attract::requestLog()->listRequestLogEntries();
```

```json 200 wrap theme={"dark"}
{
  "requests": [
    {
      "_id": "66f1c2a9e4b0a1b2c3d4e5f6",
      "createdAt": "2026-10-01T14:03:22.000Z",
      "url": "https://www.example.com/pricing?utm_source=newsletter&gclid=Cj0KCQ",
      "path": "/pricing",
      "query": "utm_source=newsletter&gclid=Cj0KCQ",
      "params": [
        {
          "key": "utm_source",
          "value": "newsletter",
          "group": "utm"
        },
        {
          "key": "gclid",
          "value": "Cj0KCQ",
          "group": "ads"
        }
      ],
      "paramGroups": [
        "utm",
        "ads"
      ],
      "ip": "203.0.113.7",
      "country": "US",
      "geoSource": "geoip",
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 15_0) AppleWebKit/605.1.15",
      "referrer": "https://news.example.org/issue-42",
      "visitorId": "3f2b8c1e-5d4a-4e6f-9a7b-1c2d3e4f5a6b",
      "locale": "en",
      "status": 200,
      "notFound": false
    }
  ],
  "total": 1,
  "page": 1,
  "perPage": 25,
  "totalPages": 1
}
```

## In your app

A controller answers a route on your app: it calls `listRequestLogEntries()` and returns the answer.

**1. Add the controller**

```php app/Http/Controllers/ListRequestLogEntriesController.php theme={"dark"}
<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use Fetchski\AttractCmsLaravel\Data\RequestLogPage;
use Fetchski\AttractCmsLaravel\Facades\Attract;

final class ListRequestLogEntriesController
{
    public function __invoke(): RequestLogPage
    {
        return Attract::requestLog()->listRequestLogEntries();
    }
}
```

**2. Add the route**

```php routes/web.php theme={"dark"}
use App\Http\Controllers\ListRequestLogEntriesController;
use Illuminate\Support\Facades\Route;

Route::get('/request-log/requests', ListRequestLogEntriesController::class);
```

**3. Call it**

```bash Terminal theme={"dark"}
curl http://localhost:8000/request-log/requests
```

With `php artisan serve` running, it prints its answer as JSON.

> [!TIP]
>
> To keep the call in an Action instead, this writes `app/Actions/Attract/ListRequestLogEntries.php` (an invokable Action that calls `listRequestLogEntries()`) and its test under `tests/Feature/Actions/Attract/` (Pest when your app has it):
>
> ```bash Terminal theme={"dark"}
> php artisan make:attract-action requestLog.listRequestLogEntries
> ```

## Call it from the terminal

```bash Terminal theme={"dark"}
php artisan attract:call requestLog.listRequestLogEntries
```

It calls `listRequestLogEntries()` on your default site and prints its answer as JSON. See [Call any method from the terminal](https://docs.fetchski-attract.com/call-command.md) for every argument type.

Every filter is optional and they combine.

> [accordion] Optional parameters
>
> Named arguments, e.g. `listRequestLogEntries(from: …)`; leave out the optional ones.
>
> **from** `\\DateTimeInterface|string|null`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Captured at or after this ISO 8601 date or date-time. Format: an ISO 8601 date and time.
>
> **to** `\\DateTimeInterface|string|null`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Captured at or before this ISO 8601 date or date-time. Format: an ISO 8601 date and time.
>
> **pathPrefix** `?string`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Only paths starting with this, e.g. `/blog`.
>
> **visitorId** `?string`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Only this visitor (the `fetchski_vid` UUID).
>
> **country** `?string`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Only this two-letter country code, e.g. `US`. Matches `^[A-Za-z]{2}$`.
>
> **status** `?int`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Only this HTTP status, e.g. `404`. At least 100.
>
> **notFound** `?bool`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Only page views that did (`true`) or did not (`false`) find a page.
>
> **group** `?string`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Only rows with a parameter in this group, e.g. `ads` or `utm`.
>
> **key** `?string`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. Only rows with this query parameter (case-insensitive), e.g. `gclid`.
>
> **paramKey** `?string`
>
> **Optional.** Leave it out (or pass `null`) and it isn’t sent: the site’s default applies. The same as `key` (`paramKey` wins when both are sent).
>
> **page** `?int`
>
> **Optional.** Leave it out and the site uses `1`. Page number, from 1 (a page past the end answers the last page).
>
> **perPage** `?int`
>
> **Optional.** Leave it out and the site uses `25`. Rows per page. 1 to 100.

> [accordion] Returns
>
> A `RequestLogPage` (`Fetchski\AttractCmsLaravel\Data\RequestLogPage`). A page of captured page views. Read its properties (`$requestLogPage->requests`): each says whether the site always sends it. The example answer is the site’s wire JSON: one key differs from the property names (`_id` → `id`).
>
> **requests** `Collection\<int, RequestLogEntry\>`
>
> **Always sent.** A list of `RequestLogEntry`.
>
> **RequestLogEntry (Fetchski\AttractCmsLaravel\Data\RequestLogEntry)**
>
> One captured page view. Without Analytics or Marketing consent the row keeps only the network (a truncated IP), no user-agent and the referrer’s origin.
>
> **id** `string`
>
> **Always sent.**
>
> **createdAt** `CarbonImmutable`
>
> **Always sent.** Format: an ISO 8601 date and time.
>
> **url** `string`
>
> **Always sent.**
>
> **path** `string`
>
> **Always sent.**
>
> **query** `?string`
>
> **Always sent, can be `null`.** The raw query string.
>
> **params** `Collection\<int, RequestLogParam\>`
>
> **Always sent.** A list of `RequestLogParam`. Each query parameter, when parameter classification is on.
>
> **RequestLogParam (Fetchski\AttractCmsLaravel\Data\RequestLogParam)**
>
> **key** `string`
>
> **Always sent.**
>
> **value** `string`
>
> **Always sent.** Empty for an ad identifier the visitor gave no Marketing consent for.
>
> **group** `?string`
>
> **Always sent, can be `null`.** The group a classification rule put it in.
>
> **paramGroups** `Collection\<int, string\>`
>
> **Always sent.**
>
> **ip** `?string`
>
> **Always sent, can be `null`.** The visitor’s address (truncated without consent).
>
> **country** `?string`
>
> **Always sent, can be `null`.** Two-letter country code.
>
> **geoSource** `Enums\\GeoSource|string|null`
>
> **Always sent, can be `null`.** Where the country came from. One of `header`, `geoip`; a newer site may send others, so keep a fallback.
>
> **userAgent** `?string`
>
> **Always sent, can be `null`.** Empty without consent.
>
> **referrer** `?string`
>
> **Always sent, can be `null`.** Origin + path with consent, origin only without.
>
> **visitorId** `?string`
>
> **Always sent, can be `null`.** Set only with Analytics or Marketing consent.
>
> **locale** `?string`
>
> **Always sent, can be `null`.** The page’s locale.
>
> **status** `int`
>
> **Always sent.** The HTTP status the page answered.
>
> **notFound** `bool`
>
> **Always sent.**
>
> **total** `int`
>
> **Always sent.** Every match, across all pages.
>
> **page** `int`
>
> **Always sent.**
>
> **perPage** `int`
>
> **Always sent.**
>
> **totalPages** `int`
>
> **Always sent.** At least 1.

> [accordion] Errors
>
> Nothing to catch: the SDK retries what is safe, and Laravel logs and renders the rest (see [Errors and testing](https://docs.fetchski-attract.com/laravel/errors.md)).
>
> **AuthenticationFailed** `401`
>
> The API key is missing, malformed, unknown, disabled, expired or archived, or a request its signing mode requires to be signed is not.
>
> **Retried first:** No. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **Forbidden** `403`
>
> The API key lacks the scope this route needs (the message names it) or is used from outside its allowlist; or, on a route that answers 403 to everyone it refuses, the caller may not use it.
>
> **Retried first:** No. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **NotFound** `404`
>
> Nothing matches the identifier, or the caller may not use this route at all (it is not advertised).
>
> **Retried first:** No. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **RateLimited** `429`
>
> The key used up its per-minute limit. Still, after the client’s own waits and retries.
>
> **Retried first:** Yes: the client waits `Retry-After` (1 s when absent; over 60 s it gives up at once) and retries, up to `retries` times (2 by default). **Read:** `retryAfter()` (seconds, or null), `siteMessage()`.
>
> **SiteError** `5xx`
>
> The site failed (or something in front of it did). Its logs say why.
>
> **Retried first:** A 502, 503 or 504: yes, after 0.5 s then 1 s. A 500: no. **Read:** `siteMessage()`, `errorName()`, `data()`.
>
> **SiteUnreachable** `no answer`
>
> No answer: DNS, a refused connection, TLS, or the timeout (15 s per attempt by default).
>
> **Retried first:** Yes, after 0.5 s then 1 s. **Read:** `reason()`, `neverConnected()`.
>
> **RequestNotSent** `not sent`
>
> The client refused to send it (e.g. a path segment of `..`); the site never saw it.
>
> **Retried first:** No. **Read:** `reason()` (what to change).
>
> **SiteRequestFailed** `any other`
>
> Any other status, or a success whose JSON doesn’t match this SDK version’s types (update the SDK).
>
> **Retried first:** No. **Read:** `reason()`, `status()`.
>
> **UnknownSite** `setup`
>
> `Attract::site('acme')` named a slug that isn’t under `sites` in `config/fetchski-attract.php`.
>
> **Retried first:** No: nothing was sent. **Read:** `getMessage()`, `$e->slug`.
>
> **SiteConfigurationError** `setup`
>
> The site’s config entry is wrong: no `url`, a malformed `api_key`, a key filed under another slug, or no default site.
>
> **Retried first:** No: nothing was sent. **Read:** `getMessage()` (what to fix).

## Behavior

* **Access:** an API key with `request-log:read`, or `ads:all`, or `admin:all`, or a signed-in user holding the `request-log:view` permission. Other callers get 404.
* **Rate limit:** the key’s own reads-per-minute limit, set when the key is created (default 600); over it, 429 with `Retry-After`. The client waits and retries for you; you see `RateLimited` only if that runs out.
* **Retries:** a read is safe to repeat: the client retries it on no answer, a 502/503/504 and a 429.
* **Timeout:** 15 s per attempt by default; raise `timeout` in `config/fetchski-attract.php` for longer.
* **Paging:** one page per call. To walk them all, use `listRequestLogEntriesAll()` (see More examples): it asks for the next page as you iterate, and stops after page `totalPages`.

## More examples

`listRequestLogEntriesAll()` takes `listRequestLogEntries()`’s arguments except `page`.

```php Every page wrap theme={"dark"}
use Fetchski\AttractCmsLaravel\Facades\Attract;

$requestLogEntrys = Attract::requestLog()->listRequestLogEntriesAll(); // LazyCollection<int, RequestLogEntry>: the next page is fetched as you iterate
```

## Test it

It calls the route above with the SDK faked: the fake answers every call with a valid example, so nothing leaves your machine and no config or key is needed. Save it as `tests/Feature/ListRequestLogEntriesTest.php`, then run your tests:

```php tests/Feature/ListRequestLogEntriesTest.php theme={"dark"}
<?php

declare(strict_types=1);

namespace Tests\Feature;

use Fetchski\AttractCmsLaravel\Facades\Attract;
use Tests\TestCase;

final class ListRequestLogEntriesTest extends TestCase
{
    public function test_list_request_log_entries(): void
    {
        Attract::fake();

        $this->getJson('/request-log/requests')->assertOk();

        Attract::assertCalled('requestLog.listRequestLogEntries');
    }
}
```

```bash Terminal theme={"dark"}
php artisan test
```

**Answer with your own values:** fake `requestLog.listRequestLogEntries` with a `sequence()` of pages, each `RequestLogPage::factory()->make([...])`, and walk `listRequestLogEntriesAll()`.

```php tests/Feature/ListRequestLogEntriesAnswerTest.php theme={"dark"}
<?php

declare(strict_types=1);

namespace Tests\Feature;

use Fetchski\AttractCmsLaravel\Data\RequestLogPage;
use Fetchski\AttractCmsLaravel\Facades\Attract;
use Tests\TestCase;

final class ListRequestLogEntriesAnswerTest extends TestCase
{
    public function test_list_request_log_entries_answers_your_values(): void
    {
        Attract::fake([
            'requestLog.listRequestLogEntries' => Attract::sequence(
                RequestLogPage::factory()->make(['page' => 1, 'totalPages' => 2]),
                RequestLogPage::factory()->make(['page' => 2, 'totalPages' => 2]),
            ),
        ]);

        $requestLogEntrys = Attract::requestLog()->listRequestLogEntriesAll();

        $this->assertCount(2, $requestLogEntrys->all());
    }
}
```

To fake `listRequestLogEntriesAll()`, answer `requestLog.listRequestLogEntries` (the walk calls it page by page): a `sequence()` of answers for several pages.

## Related

> [card] [List captured query parameters](https://docs.fetchski-attract.com/laravel/reference/request-log/list-request-log-params.md)
>
> `Attract::requestLog()->listRequestLogParams()`

> [card] [GET /request-log/requests](https://docs.fetchski-attract.com/api-reference/request-log/list-captured-page-views.md)
>
> The endpoint this calls, in the API reference: the HTTP request and answer, and every rule the site checks.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.