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

# AgentaOS Integration

> Sync revenue data and subscription events from AgentaOS to power segments and automations

Connect your AgentaOS account to sync customers, subscriptions, and revenue metrics into Sequenzy and trigger automations from signed checkout and subscription webhooks.

## What is AgentaOS?

[AgentaOS](https://agentaos.ai) is a merchant of record for SaaS, digital products, and AI apps. It handles global checkout, subscriptions, VAT and sales tax, invoicing, and payouts with both test and live API keys.

## Connecting AgentaOS

AgentaOS connects with an API key and a signed webhook. You can connect in either test mode (`sk_test_...`) or live mode (`sk_live_...`), and switch keys at any time by reconnecting.

### Step 1: Generate Your AgentaOS API Key

1. Open your [AgentaOS Dashboard](https://app.agentaos.ai)
2. Switch to **Test** or **Live** mode at the bottom of the sidebar
3. Go to **Developers → API keys**
4. Click **Generate Test Key** (`sk_test_...`) or **Generate Live Key** (`sk_live_...`) and copy the key

> [!NOTE]
>
> Sequenzy detects test or live mode automatically from the key prefix. Live
> connections skip test webhooks (`livemode: false`) and test connections skip
> live webhooks (`livemode: true`), so test checkouts never pollute live
> contacts or revenue. The dashboard test event (`webhook.test`) is always
> acknowledged.

### Step 2: Configure Your Webhook in AgentaOS

1. In AgentaOS, open **Settings → Developers → Webhooks**
2. Set your endpoint URL to:
   ```
   https://api.sequenzy.com/api/webhooks/agentaos/{your-company-id}
   ```
   > [!NOTE]
   >
   > You can copy this URL directly from the AgentaOS connection dialog in
   > Sequenzy.
3. Click **Save**
4. Click **Reveal signing secret** and copy the `whsec_...` value

### Step 3: Connect in Sequenzy

1. Go to **Settings → Integrations** in Sequenzy
2. Click **Connect** next to **AgentaOS**
3. Paste your **API key** (`sk_live_...` or `sk_test_...`)
4. Paste your **Signing secret** (`whsec_...`)
5. Click **Connect AgentaOS**

Sequenzy verifies your API key, starts an initial customer and revenue sync, and begins listening for signed AgentaOS webhooks (`X-AgentaOS-Signature`).

You can also connect from the CLI or API:

```bash theme={null}
sequenzy integrations connect agentaos \
  --api-key sk_live_... \
  --webhook-secret whsec_...
```

## Synced Attributes

When connected, Sequenzy matches or creates subscribers by email and adds these attributes:

| Attribute | Type | Description |
| - | - | - |
| `mrr` | Number | Monthly Recurring Revenue in USD (normalized from monthly and yearly plans) |
| `ltv` | Number | Lifetime Value in USD (inbound completed sales minus refunds and chargebacks) |
| `agentaosCustomerId` | String | Customer ID from AgentaOS |

### MRR Calculation

MRR is normalized from each active, trialing, or past-due subscription's recurring price:

* **Monthly**: Used as-is
* **Yearly**: Divided by 12

Amounts in EUR or other currencies (including USD- and EUR-pegged stablecoin settlements such as `USDC`, `EURC`, and `EURe`) are converted to USD.

## Automatic Tags

Sequenzy updates subscriber tags from AgentaOS subscription events and revenue syncs:

| Tag | Applied When |
| - | - |
| `customer` | Has an active subscription or completed a paid checkout |
| `trial` | Subscription is currently in `trialing` status |
| `cancelled` | Live subscription is scheduled to cancel at period end (`cancel_at_period_end`) |
| `churned` | Subscription has ended (`subscription.canceled`) |
| `saas.monthly` | On a monthly billing interval |
| `saas.yearly` | On a yearly billing interval |

When a scheduled cancellation is resumed before the period ends, AgentaOS sends `subscription.updated` with `cancel_at_period_end: false`, and Sequenzy removes the `cancelled` tag automatically.

## Tracked Events

AgentaOS sends all account events to your webhook URL. Sequenzy maps checkout and subscription events to built-in SaaS events and acknowledges other event types cleanly:

| Event | AgentaOS Webhook |
| - | - |
| `saas.purchase` | `checkout.session.completed` with paid amount greater than `0` |
| `saas.purchase.monthly` | Paid `checkout.session.completed` on a monthly subscription |
| `saas.purchase.yearly` | Paid `checkout.session.completed` on a yearly subscription |
| `saas.trial_started` | `subscription.created` with `status: "trialing"` |
| `saas.trial_cancelled` | `subscription.updated` with `cancel_at_period_end: true` in trial |
| `saas.payment_failed` | `subscription.payment_failed` |
| `saas.cancelled` | `subscription.updated` with `cancel_at_period_end: true` |
| `saas.churn` | `subscription.canceled` |

> [!NOTE]
>
> `subscription.created` (when `status: "active"`), `subscription.renewed`, and
> plan-change `subscription.updated` deliveries refresh subscription attributes
> and MRR without firing a duplicate `saas.purchase` event. Free trial
> checkouts (`trial: true`, `amount: "0"`) and credit-covered `$0` renewals do
> not emit `saas.purchase`.

AgentaOS does not emit a refund webhook, so `saas.refund` is not triggered automatically. Refunded and charged-back transactions are excluded from `ltv` whenever a revenue sync runs.

## Event Properties

Purchase and subscription events carry product and checkout context so you can filter sequence triggers:

| Property | Type | Description |
| - | - | - |
| `productId` | String | Payment link ID (UUID when resolved via the API, or link token) |
| `productIds` | Array | Array containing the payment link ID |
| `planId` | String | Backing payment link ID |
| `planName` | String | Plan or product name |
| `subscriptionId` | String | AgentaOS subscription UUID (on subscription checkouts and renewals) |
| `metadata` | Object | Custom `metadata` attached to the checkout or payment link |
| `amount` | Number | Amount in minor currency units (for example `4999` for `49.99`) |
| `currency` | String | Normalized currency code (for example `EUR`, `USD`) |

## Which Lists Contacts Join

AgentaOS has no per-integration list targeting. Customers it creates, including during the initial revenue backfill, join your workspace [Default Lists](https://docs.sequenzy.com/concepts/subscribers.md#default-lists).

A JSON `null` on that setting means **every current and future list**, not "no lists". `[]` joins nothing. You can inspect or change it before connecting:

```bash theme={null}
sequenzy companies get comp_abc123
sequenzy companies update comp_abc123 --default-list list_customers
```

## Troubleshooting

### Webhooks Not Arriving

1. Confirm your webhook URL in AgentaOS (**Settings → Developers → Webhooks**) matches `https://api.sequenzy.com/api/webhooks/agentaos/{your-company-id}`
2. Click **Send test event** in AgentaOS to verify your endpoint responds with `200`
3. Check that your connected API key mode (`sk_test_` vs `sk_live_`) matches the mode of the checkout you are testing

### Invalid Webhook Signature

1. Open **Settings → Developers → Webhooks** in AgentaOS and click **Reveal signing secret**
2. Copy the complete `whsec_...` secret without extra whitespace
3. Reconnect AgentaOS in Sequenzy with the current signing secret

### Missing Monthly or Yearly Tags on Purchases

AgentaOS webhook payloads do not include the billing interval directly. Sequenzy looks up the payment link or subscription with your API key when the webhook arrives. Make sure your connected API key is active and matches the event's mode (`sk_test_` for test events, `sk_live_` for live events).


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