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

> ## Agent Instructions
> Integrating Pilot Status end to end? Follow https://docs.pilotstatus.com.br/guides/integrate-with-ai.md (pt-BR: https://docs.pilotstatus.com.br/pt-BR/guides/integrate-with-ai.md). No step requires contacting support: every credential is shown in the dashboard or in an API response, and a lost one is regenerated, not recovered.
> Webhook signing secret: shown ONCE in the Signing secret window right after creating the webhook on /webhooks, and in the `secret` field of the POST /v1/webhooks response (MCP: webhooks_create). Lost it: Edit Webhook → Generate a new secret, POST /v1/webhooks/{id}/rotate-secret, or webhooks_rotate_secret (the old one stops working at once). Verify `x-pilot-status-signature` = hex HMAC-SHA256 of the raw request body keyed with that secret.
> Meta verify token (number connected with the user's own Meta app credentials): Meta Number Created! window after connecting, then the number's card on Numbers (workspace Owner), or webhook.verifyToken in the POST /v1/numbers/meta response. It is not the webhook signing secret.
> REST auth: `x-api-key: ps_...` header, never Authorization: Bearer. MCP: https://mcp.pilotstatus.com.br/mcp (148 tools, OAuth 2.1 or x-api-key); Code Mode: https://mcp.pilotstatus.com.br/code. Destructive MCP tools return a preview and a confirm_token: show the preview and call again only after the user's explicit yes. Over OAuth, revealing or creating ps_ API keys is workspace Owner only.

# Ads and Lead Ads in the Dashboard

> The Ads screen (/ads): conversations per click-to-WhatsApp ad over 7, 30 or 90 days, linking a Meta ad account by partner sharing (the Partner ID (Pilot Status) — Pilot Status's Meta business portfolio ID — is shown on the screen with a Copy button, and returned by GET /v1/ads/accounts as partnerBusinessId), Facebook Pages for Lead Ads, per-form auto-send to WhatsApp, and the received leads list.

The **Ads** screen answers two questions: which ad each WhatsApp conversation came from, and who filled in the Instant Forms (Lead Ads) of your Facebook Pages. It never asks for a Meta login: access comes from **partner sharing** in Meta Business Manager, where the advertiser adds the Pilot Status business portfolio as a partner.

## How to get there

* Sidebar: **Ads** (marked **Beta**), keyboard shortcut `s`. Also in the command palette (`Ctrl+K`) as **Ads**.
* Path: `/ads`. The tab is in the address: `/ads` is **Conversations**, `/ads?tab=forms` is **Forms**.
* `/ads?ad=<ad id>` opens the screen filtered to one ad — that is where the ad badge of a conversation in the chat takes you. The old address `/anuncios` still works and redirects to `/ads`, keeping the filter.
* The screen needs a connected WhatsApp number. Without one it stays blurred under **Connect a number to continue**. The ad counts and the received leads are for the number selected at the top of the dashboard.

## Who can do what

| Action | Owner | Admin | Agent | Analyst |
| - | - | - | - | - |
| Open the screen, read the per-ad counts | ✓ | ✓ | ✓ | ✓ |
| Link / unlink an ad account, see the partner ID | ✓ | ✓ | — | — |
| Link / unlink Facebook Pages, configure forms, resync | ✓ | ✓ | — | — |
| See the received leads (personal data), filter by form | ✓ | ✓ | ✓ | — |
| Filter the leads by Page | ✓ | ✓ | — | — |
| Delete a lead | ✓ | ✓ | — | — |

A member limited to some numbers only sees the counts, Pages and leads of those numbers.

Without the right to link accounts, the connection card says **Only a workspace admin can connect the ad account. The counts above are still yours to read.** On the **Forms** tab, an Agent sees **Linking Pages and configuring forms is done by a workspace admin.** above the leads list; an Analyst sees **No access to forms** — *Viewing leads requires chat access, and linking Pages requires integrations access. Ask a workspace admin.*

## Conversations tab

### Period and counters

At the top, **7 days**, **30 days** and **90 days** (30 days by default). Three counters add up the ads listed below: **Conversations**, **Ads** and **Messages**.

> [!NOTE]
>
> Ad attribution has no history. When the chosen window reaches back before the day attribution started, the screen says so: **Ad attribution started on \{date}. Conversations from before that date do not show up here, even the ones that came from an ad: the origin was not being stored yet.**

The list holds at most 200 ads. When it is capped, **List cut short** says that only the 200 ads with the most conversations are shown and that the counters add up that list alone — shorten the range to see the rest.

When filtered by an ad (`?ad=`), a chip **Filtered to one ad:** shows the ad id, with **See all ads**, and the counters add up that ad alone. If this ad has no conversation in the period — whether or not other ads have — the list says **No data for this ad yet** and *No conversation came from this ad in the last \{N} days. It may be older than the selected period — or, if the conversation just arrived, give it a few minutes.*, with **View last 90 days** (when the period is shorter) and **See all ads**.

### The ads list

One row per ad, ordered by conversations. Each row shows:

* the ad name, with campaign and ad set below — or **Ad with no name** with **Name not looked up yet** (not asked Meta yet) or **Name unavailable: this ad's account has not been shared yet**;
* **Ad ID** — the ad's `sourceId`;
* conversations, messages, **leads** (Lead Ads leads the same ad brought in the period, on the same number) and **last on** (date of the latest conversation).

With nothing in the period: **No conversation came from an ad in this period**. For whoever can link accounts, it adds whether an account is linked; when none is, **See how to link** opens the instructions below.

### Connecting the ad account

While the connection is being checked, the card says **Checking the connection to your ad account…**. If that check fails, **Could not check the connection** says the problem is on the Pilot Status side, not in your Business Manager, with **Check again**.

Without a linked account, the card **Connect your ad account** shows how many conversations and ads came in during the period. With one, the card **Linked accounts** lists each account (name, or **Unnamed account**, and its `act_…` id) with **Unlink**. It asks first: **Unlink this ad account?** names the account and explains that new ads from it stop getting campaign, ad set and ad names, that conversations keep being counted and the names already shown stay, and that you can link it again later with the same ID — **Cancel** or **Unlink**. If the advertiser revoked the grant on Meta, the row warns **Partner access to this account is no longer active on Meta. Share it again to keep the names coming.**

Both cards contain **Link your ad account**:

1. **Ad account ID** — type the id as `act_` followed by digits (placeholder `act_1234567890`), exactly as in the advertiser's Meta Ads Manager, then **Link account**. Under the field the screen says up front what the link needs: *The link only works for an account whose ads have already brought at least one conversation to a number in this workspace. If no conversation from an ad has arrived yet, run the ad, wait for the first one and come back here.*
2. **How to grant access** (expandable, closed by default) lists the steps in Meta Business Manager:

   1. In Meta Business Manager, open **Users** and then **Partners**.
   2. Click **Add** and choose **Give a partner access to your assets**.
   3. Enter the partner ID shown below.
   4. Pick **Ad accounts** and check the **View performance** permission.
   5. Come back here, paste the ad account ID in the field below and click **Link account**.

   Inside it, **Partner ID (Pilot Status)** shows the numeric ID of the Pilot Status business portfolio, with **Copy**. This is the value you paste in Business Manager. It is not a secret; it is also returned as `partnerBusinessId` by `GET /v1/ads/accounts`. If the installation has none configured, the screen says **The partner ID is not configured in this installation. Talk to support before going into Business Manager.**
3. **Accounts shared with us** — appears only when there are accounts already tied to this workspace by ads it received; each has a **Link** button.
4. **Refresh** re-reads the accounts and their sharing state.

An account can only be linked when this workspace already has a conversation from one of its ads whose details were read from Meta, or when it was linked here before. The account must also be shared with the Pilot Status portfolio.

Link errors shown under the field:

| Message | Meaning |
| - | - |
| **The ID must look like act\_ followed by digits…** | Typo in the id. |
| **This account has not been shared with the Pilot Status portfolio yet…** | The partner grant has not reached Meta. Redo the partner step with the partner ID and **View performance**, then link again. |
| **We could not confirm the sharing with Meta right now…** | Meta did not answer; try again in a few minutes. |
| **The ads integration is not configured in this installation…** | Server-side configuration; talk to support. |
| **We found no ad from this account in this workspace's conversations yet…** | No ad of this account has brought a conversation to this workspace yet (or its details were not read from Meta yet). Wait for the first conversation from one of its ads and link again, or talk to support. |
| **Could not link the account. Try again.** | Any other refusal. |

If the whole installation lacks Meta ads credentials, the banner **Ads integration unavailable in this installation** explains that no ad gets a campaign name and no account can be linked — sharing again in Business Manager will not help.

## Forms tab (Lead Ads)

### Facebook Pages

The **Facebook Pages** card (*Link a Page to receive the leads from its ad forms here.*) has:

* **Linked Pages** — each Page with its id, its lead count, the subscription state (**Receiving leads since \{date}**, **Subscription pending**, or **Subscription failed** with the reason underneath), **Number that receives the leads** (a selector), **Show forms** / **Hide forms**, **Resync** and **Unlink**.
* **Pages shared with us** — Pages shared with the Pilot Status portfolio, owned by the business portfolio of one of your official numbers, and not yet linked: choose the number that will receive the leads and click **Link**.
* **No Page shared yet** — with **Our portfolio ID:** (the same partner business ID) to give the Page owner, who shares the Page in Business Manager with the ads and community permissions. **Refresh list** re-reads.

The number selectors list the workspace's numbers except the shared Pilot Status test number.

Rules and messages:

* A Page can only be linked when an **official Meta number** (Cloud API) of the business portfolio that owns the Page is connected. Without any official number: **No official Meta number connected**. A Page owned by another portfolio is refused with *The Page belongs to a different business portfolio than your official numbers; contact support.*
* If the Page was shared without the needed permissions, the Page shows what to ask for instead of the **Link** button (for example, *Ask the client to add the community permission when sharing the Page.*). When the permissions could not be checked: *We could not check this Page permissions right now. We check again when you link it.*
* If Meta could not list the shared Pages: *Could not ask Meta for the shared Pages right now. Try refreshing in a few minutes.* If the installation has no Meta credentials: **Lead capture unavailable on this installation**.
* **Resync** asks Meta again for the leads (*Resync started. Leads show up as they arrive.*). A Page can be resynced once every 10 minutes; before that: **A sync ran a moment ago. Wait a few minutes before trying again.**
* Changing the receiving number can turn auto-send off: **Auto-send turned off: the new number uses a different message type; review the forms.**

**Unlink** opens an inline confirmation, **Unlink \{page}?** — *This deletes the leads captured through this Page and stops receiving new ones. It cannot be undone.* (with the number of leads when there are any) — with **Cancel** and **Unlink and delete leads**.

### Forms and auto-send

**Show forms** lists the Page's Instant Forms with their status, **Auto-send on** / **Auto-send off**, **No WhatsApp consent checkbox** when applicable, and **Configure**. A Page with too many forms shows *This Page has more forms than we could list; the most recent ones show first.*

**Configure** opens the dialog **Configure \{form}** — *Choose whether the lead gets a WhatsApp message as soon as they fill in the form.*:

* **WhatsApp consent checkbox** — the form's checkbox that authorizes the message. Only leads who tick it get a message. A form without one shows **This form has no WhatsApp consent** and auto-send cannot be turned on: create a version of the form on Meta with that checkbox.
* **Send automatic message** — opens the WhatsApp conversation with every new lead who gave consent.
* **Template** when the Page's receiving number is official (only an approved template can start a conversation; with none approved on the number, the dialog says so) or **Message** (free text for other numbers, with variables like `{{nome}}`).
* **Variables** — for each variable, **Source of \{name}**: a form question or **Fixed text** (then type the text).
* **Cancel** / **Save**. Save stays disabled while something is missing (consent, template or message, variable sources) or while the message has a malformed variable (empty name or spaces inside the braces).

### Received leads

**Received leads** — who filled in the forms on the selected number, newest first, 25 per page (**Previous** / **Next**, with the current page, the page count and the total of leads). Filters: **Filter by Page** (Owner and Admin) and **Filter by form**. Columns: **Date**, **Name**, **Phone**, **Form**, **Ad / campaign** (or **Organic (no ad)**), **Auto-send** (**Off**, **Queued**, **Sent**, **Not sent**, **Failed** — the last two with the reason underneath), and the actions **Open conversation** (when the lead has a conversation) and **Delete** (Owner and Admin).

Name and phone show as redacted when the receiving number's privacy mode is relay-only, or when the lead is older than the number's retention window. **Delete** opens an inline confirmation, **Delete this lead?** — the lead's name, e-mail, phone and form answers are erased permanently; the chat conversation, if any, stays as it is — with **Cancel** and **Delete permanently**.

In the chat, a conversation that came from a form shows a badge **Came from the form \{form}** (followed by the ad or campaign when known, and the number of forms when there are several). Expanding it shows the lead's name, e-mail, phone, date and **Answers**.

## Do it via API / MCP

| Dashboard action | API | MCP tool |
| - | - | - |
| Per-ad summary | `GET /v1/ads/summary` | `ads_summary` |
| List linked/candidate accounts, read the partner ID | `GET /v1/ads/accounts` (`partnerBusinessId`) | `ads_accounts_list` |
| Link an ad account | `POST /v1/ads/accounts` | `ads_accounts_link` |
| Unlink an ad account | `DELETE /v1/ads/accounts/{adAccountId}` | `ads_accounts_unlink` |
| List Pages (linked, candidates, partner ID) | `GET /v1/lead-pages` | `lead_pages_list` |
| Link a Page | `POST /v1/lead-pages` | `lead_pages_link` |
| Change the receiving number | `PATCH /v1/lead-pages/{pageLinkId}` | `lead_pages_update` |
| Unlink a Page (deletes its leads) | `DELETE /v1/lead-pages/{pageLinkId}` | `lead_pages_unlink` |
| Resync | `POST /v1/lead-pages/{pageLinkId}/resync` | `lead_pages_resync` |
| List a Page's forms | `GET /v1/lead-pages/{pageLinkId}/forms` | `lead_forms_list` |
| Configure a form (consent, auto-send) | `PUT /v1/lead-pages/{pageLinkId}/forms/{formId}` | `lead_forms_update` |
| List leads / one lead | `GET /v1/leads`, `GET /v1/leads/{id}` | `leads_list`, `leads_get` |
| Delete a lead | Dashboard only | Dashboard only |

The partner grant itself happens in Meta Business Manager; no endpoint does it. References: [Ads API](https://docs.pilotstatus.com.br/api/ads.md), [Lead Ads Pages API](https://docs.pilotstatus.com.br/api/lead-pages.md), [Leads API](https://docs.pilotstatus.com.br/api/leads.md).


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