All features

REST API

Analytics REST API
for your entire stack

The GhostlyX REST API gives you programmatic access to all your analytics data. Build custom dashboards, automate reporting, and pull stats into any tool in your stack with a single authenticated request.

ghostlyx.com/api/v1
API Explorer

Endpoints

Shell

curl \

   -H "Authorization: Bearer ghx_live_••••••••••••" \

Response

Simulated preview with sample data. Get started free to get your API token and start querying real data.

What the analytics REST API covers

Every metric visible in the GhostlyX dashboard is accessible through the API. You can query aggregated totals, time-series data, and ranked breakdowns for pages, referrers, countries, devices, and custom events.

Requests are authenticated with scoped API tokens. Each token is associated with specific sites, so you can give a third-party tool read access to one site without exposing the rest of your account.

All API responses are JSON. The full reference, including request parameters, response schemas, and code examples in multiple languages, is available in the API reference documentation.

Pageviews and sessions

Query total pageviews and unique sessions for any site over any date range.

Top pages

Retrieve a ranked list of your most visited pages with view counts and bounce rates.

Referrers and UTM data

Pull traffic source breakdowns including UTM campaign, medium, and source values.

Geographic data

Query visitor counts by country, region, or city.

Custom events

Retrieve counts and breakdowns for any custom event you have defined.

Scoped API tokens

Create tokens with read access limited to specific sites. Rotate or revoke tokens at any time from your account settings.

What teams build with the REST API

Custom dashboards

Pull your analytics into an internal tool, a Notion embed, or a client-facing dashboard built to your own specification.

Automated reporting

Schedule a script to pull weekly stats and format them into a Slack message, a spreadsheet, or an email digest tailored to your team.

Cross-platform data pipelines

Push GhostlyX data into a data warehouse alongside revenue and product usage data for unified business intelligence reporting.

Frequently asked questions

What is the GhostlyX analytics REST API?

The GhostlyX REST API is an HTTP JSON API that gives you programmatic access to all your analytics data. You can query pageviews, unique visitors, top pages, referrers, geographic breakdowns, and custom events for any site on your account using scoped API tokens.

Is the API available on all plans?

API access is available on the Business plan and above. The Business plan includes access to all core stats endpoints. The Scale plan additionally includes priority rate limits and advanced data export options.

Is there a rate limit?

Yes. API requests are rate-limited per token. The specific limits depend on your plan and are documented in the API reference alongside the response headers that communicate your current usage.

Does the API support filtering by date range?

Yes. All stats endpoints accept start and end date parameters. You can query any date range up to the data retention limit for your plan.

Can I create multiple API tokens?

Yes. You can create as many tokens as you need from your account settings. Each token can be scoped to specific sites and given a descriptive name so you can track which token is used by which integration.

Is there an SDK available?

GhostlyX provides official SDKs for JavaScript and PHP that wrap the REST API. The SDKs handle authentication, pagination, and error handling. See the SDK documentation for installation and usage details.

What format do API responses use?

All API responses are JSON. Each response includes the requested data along with metadata such as the queried period, site ID, and pagination details where applicable.

Your data, your way

Start with the dashboard and extend with the API whenever you need to go deeper.