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

# Analytics and APIs

> See who uses your published app, and call your app's API from outside Vybe with API tokens

Two editor tabs help once your app is live. **Analytics** shows who opens the published app and which pages they load. **APIs** lists your app's API routes and lets you create tokens so scripts and other systems can call them.

Neither tab is open by default. Add them from the **+** menu in the editor's tab bar.

## Analytics

The **Analytics** tab shows usage of your published app. Because it lives in the app editor, only people who can edit the app see it.

| Card | What it shows |
| - | - |
| **Total Unique Users** | How many different people opened the app |
| **Total Page Views** | Every page load, including repeat visits |
| **Top Users** | The 10 people with the most page views |
| **Top Pages** | The 10 most viewed pages |
| **Unique Users Over Time (Last 7 Weeks)** | People per week |
| **Page Views Over Time (Last 7 Weeks)** | Page views per week |

All figures cover the last 7 weeks, and the charts group them by week, starting on Monday. You can't change the date range.

### What counts as a page view

A page view is counted when a signed-in person loads a page of the published app in their browser: opening the app or a link to one of its pages, or reloading. Opening the app from Slack counts too.

These aren't counted:

* visits to the editor's **Preview**
* data the app loads in the background while you use it
* calls made with an API token

Clicking between pages inside the app often doesn't reload the page, so those views may not be counted. **Top Pages** mostly shows where people land.

> [!TIP]
>
> If an important page gets little traffic, ask the AI to make it easier to find, for example with a link on the home page or a place in the navigation.

## APIs

The **APIs** tab lets other systems call your app's API routes from outside Vybe, for example a script, a spreadsheet or another internal tool. It has three sections.

**APIs** lists the app's API routes by **Path** and **Methods**. Routes with a variable part in their path are marked **dynamic**. To learn what a route expects and returns, ask the AI:

> Write documentation for the /api/deals route: its parameters, its response format and an example request.

**Usage** shows what you need to make a call:

* **Base URL**: your app's published URL
* **Authentication Header**: `x-vybe-personal-access-token`
* **Example**: a ready-made `curl` command

**API Tokens** lists the tokens you've created for this app, with **Create Token**.

### Create an API token

**1. Open the dialog**

In **API Tokens**, click **Create Token**.

**2. Name the token and set its expiration**

Give it a **Name** (up to 32 characters) that says where it's used. Choose an **Expiration**: 7 days, 30 days (the default), 90 days, 1 year or Never.

**3. Choose allowed endpoints**

Under **Allowed Endpoints**, tick each route and method the token may call. You must pick at least one. Use the search box or **Select all** for apps with many routes.

**4. Copy the token**

Click **Create Token**, then copy the token. You won't see it again. The button reads **Copy token first** until you copy it.

### Call your app's API

Send the token in the `x-vybe-personal-access-token` header:

```bash theme={null}
curl https://sales-dashboard-acme.vybe.build/api/deals \
  -H "x-vybe-personal-access-token: <YOUR_TOKEN>"
```

How tokens work:

* **One app, chosen endpoints.** A token works only for this app, and only for the routes and methods you picked. You can't change a token's endpoints later; create a new token instead.
* **API routes only.** Tokens work for paths that start with `/api/`, not for the app's pages.
* **Calls run as you.** Vybe treats each call as made by the person who created the token.
* **Calls reach the published app.** After you change an API route, publish the app before callers can use the change. If you change a route that others call, they need to update how they call it.
* **Tokens stop working** when they expire, when you delete them, or if you leave the organization.

The token list shows each token's name, its first characters, its allowed endpoints, when it was created and when it was last used. To revoke a token, click its delete icon. Anything still using it loses access immediately.

> [!WARNING]
>
> Treat tokens like passwords. Anyone with the token can call the allowed endpoints as you. Don't put tokens in shared documents or in code that runs in a browser.

### Common errors

A token that is wrong, expired or deleted is rejected. Check that you copied all of it. Other errors you may see:

| Response | What it means |
| - | - |
| `403` "Token is not authorized for this endpoint" | The route or method isn't in the token's **Allowed Endpoints**. Create a token that includes it. |
| `403` "Token is not authorized for this app" | The token belongs to a different app. Check the base URL. |
| `403` "User is no longer a member of this organization" | The person who created the token left the organization. Create a new token. |

Need an API route that doesn't exist yet? Ask the AI:

> Add an API route that returns open deals as JSON so our finance team can pull them into a spreadsheet.


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