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

# Connect an AdCP source (alpha)

> Project a registered AdCP seller account into the connected-account campaign connection plane

<Warning>
  Alpha: this operation is exposed only to customers enrolled in the
  `directed-campaigns` PostHog flag. It is for active, registered AdCP sources,
  not official social adapters.
</Warning>

Projects an existing registered AdCP source, credential, discovered account,
and advertiser mapping into the same connection plane used by
[tracked campaigns](/v2/buyer/campaigns/directed-campaigns). It does not
register credentials or create a new seller relationship.

## Before you call

1. Find the storefront and source with `list_storefronts` and
   `get_storefront_capabilities`.
2. Register the source credential with `register_source_credentials`.
3. Discover accounts with `list_available_accounts`; use only an account and
   credential ID returned by that operation.
4. Link the account to the intended advertiser.

The source must be an active sales agent on an active storefront. The credential
and account must be active for the calling customer, and the account must
already be mapped to the requested advertiser. Customer enrollment does not
create a seller: the exact storefront/source/customer relation is rechecked on
every provider call. Reported tools are retained as readiness evidence rather
than used as a connection allowlist. Plural `get_media_buys` is required for
account-wide mirroring and `get_media_buy_delivery` for reporting, but a source
that omits either may still connect and use its other directed operations.

```bash theme={null}
curl -X POST \
  "https://api.interchange.io/api/v2/buyer/storefronts/42/sources/publisher-sales/adcp-connection" \
  -H "Authorization: Bearer $SCOPE3_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "advertiserId": "12345",
    "accountId": "seller-account-7",
    "credentialId": "81"
  }'
```

| Field          | Location | Required    | Description                                                  |
| -------------- | -------- | ----------- | ------------------------------------------------------------ |
| `storefrontId` | path     | Yes         | Listed storefront ID containing the source                   |
| `sourceId`     | path     | Yes         | Active source ID returned by storefront capabilities         |
| `advertiserId` | body     | Yes         | Advertiser already linked to the source account              |
| `accountId`    | body     | Yes         | Account ID returned by `list_available_accounts`             |
| `credentialId` | body     | Conditional | Required when multiple active credentials expose the account |

## Response

```json theme={null}
{
  "data": {
    "connectionId": "101",
    "connectionAccountId": "102",
    "storefrontId": "42",
    "sourceId": "publisher-sales",
    "agentId": "publisher-sales-agent",
    "advertiserId": "12345",
    "externalAccountId": "seller-account-7",
    "providerType": "adcp",
    "connectionKind": "THIRD_PARTY_AGENT"
  }
}
```

Use `connectionId` and `connectionAccountId` to subscribe that account to the
tracked-campaign mirror. The operation is idempotent for the same
registered source credential and reuses its active connection.

`get_media_buys` is account-wide, so a seller agent credential can be associated
with only one source on the storefront. If a sibling source uses the same
credential, reuse the existing source; creating a second connection would
duplicate campaign shells and is rejected.

## Security boundary

This operation does not accept arbitrary endpoint URLs, tokens, or raw secrets.
Endpoint ownership, seller identity, and `adagents.json` authorization must be
established by the registered storefront source before it can be connected.

## Errors

* `403 FEATURE_NOT_ENABLED` — the customer is not enrolled in the alpha.
* `422 CAPABILITY_NOT_SUPPORTED` — the requested downstream operation is not
  supported by the seller. Other directed operations remain available.
* `409 CONFLICT` — the same account-wide agent credential is already associated
  with another source.
* `403 ACCESS_DENIED` — the advertiser is outside the caller's customer scope.
* `400 VALIDATION_ERROR` — the source/account relationship is not registered
  and mapped, the storefront/source is unavailable, or `credentialId`
  is required to disambiguate it.

<CardGroup cols={2}>
  <Card title="Campaigns on connected seller accounts" href="/v2/buyer/campaigns/directed-campaigns" icon="arrows-rotate">
    Subscribe, mirror, and read delivery
  </Card>

  <Card title="Register source credentials" href="/v2/buyer/storefronts/tasks/register-source-credentials" icon="user-lock">
    Establish the source credential first
  </Card>
</CardGroup>
