# Connect

Connect a Webflow site with the Zernio Webflow app or a site API token, from the dashboard or with the connect API.

There are two ways to connect a site:

- **Connect with Webflow** (OAuth): needed to [install tracking pixels](/platforms/webflow/tracking-pixels), and nothing to copy.
- **Site API token**: blogs only.

## Connect with Webflow

Call `GET /v1/connect/webflow` and send the user to the returned `authUrl`. They pick one site on Webflow's screen and approve the Zernio app.

Webflow then returns them to Zernio, which connects the site and redirects to `redirect_url` (or the dashboard).

```bash
curl "https://zernio.com/api/v1/connect/webflow?profileId=PROFILE_ID&redirect_url=https://example.com/done" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```

```json
{ "authUrl": "https://webflow.com/oauth/authorize?...", "state": "..." }
```

Pick exactly one site per connection. Picking several connects none and redirects with `error=webflow_pick_one_site`.

Connecting a site that is already connected with a site token upgrades the same account. In the dashboard, choose Webflow on the Connections page and click **Connect with Webflow**.

## Create a site API token

In Webflow, open the site's **Site settings > Apps & integrations > API access** and generate a token with **Sites: read-only** and **CMS: read and write**. A site token covers exactly one site.

## Connect the site

```bash
curl -X POST "https://zernio.com/api/v1/connect/webflow/token" \
  -H "Authorization: Bearer $ZERNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "profileId": "PROFILE_ID", "siteToken": "WEBFLOW_SITE_TOKEN" }'
```

```json
{ "account": { "_id": "…", "platform": "webflow", "username": "my-site.webflow.io", "displayName": "My site", "profileId": "PROFILE_ID" } }
```

Zernio checks the token's scopes, reads its site and stores the token encrypted. Connecting the same site to the same profile again replaces the token in place.

In the dashboard, choose Webflow on the Connections page and paste the token.

## How it behaves

- Site tokens do not expire while they are used; Webflow revokes one after 365 days without use.
- If Webflow rejects the token (it was deleted or regenerated), the account is flagged for reconnect. Connect again with a new token.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `400` "rejected the site token" | The token is wrong, deleted or regenerated | Generate a new site token and connect again. |
| `400` "missing cms:write" | The token was created without CMS write access | Create a token with Sites read-only and CMS read and write. |
| `400` "scoped to one site" | The token is a workspace token or covers several sites | Use a site API token from the site's settings. |
| `error=webflow_pick_one_site` | Several sites were picked on Webflow's screen | Connect again and pick one site. |
| `error=webflow_access_denied` | The user declined on Webflow's screen | Connect again and approve the app. |