API Tokens

@if (session('success'))

{{ session('success') }}

@endif @if (session('newToken'))

Copy your new API token now — it won't be shown again.

{{ session('newToken') }}
@endif {{-- Create token --}}

Create API Token

Generate a token to access the analytics API programmatically.

@csrf
@error('name')

{{ $message }}

@enderror
{{-- Token list --}}

Your API Tokens

@if ($tokens->isEmpty())

No API tokens yet. Create one above to get started.

@else
@foreach ($tokens as $token)

{{ $token->name }}

Created {{ $token->created_at->diffForHumans() }} @if ($token->last_used_at) · Last used {{ $token->last_used_at->diffForHumans() }} @else · Never used @endif

@csrf @method('DELETE')
@endforeach
@endif
{{-- API docs snippet --}}

Quick Start

Use your token in the Authorization header to access the API.

curl -H "Authorization: Bearer YOUR_TOKEN" \
  {{ url('/api/v1/websites') }}

Available Endpoints

Method Endpoint Description
GET /api/v1/websites List your websites
GET /api/v1/websites/{id}/stats Summary metrics + timeseries
GET /api/v1/websites/{id}/pages Top pages by views
GET /api/v1/websites/{id}/referrers Traffic sources
GET /api/v1/websites/{id}/events Events report
GET /api/v1/websites/{id}/visitors Audience breakdown

All endpoints accept optional from and to query params (YYYY-MM-DD). Default: last 7 days. Rate limit: 60 requests/minute per token.