> ## 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.

# Test connection

> Probe the upstream adapter for reachability against the provisioned credentials

`POST /api/v2/storefront/inventory-sources/{sourceId}/test-connection`

Probes the upstream adapter for reachability against the provisioned ad-server credentials. Use it after saving config or rotating credentials to confirm the source can authenticate.

## Request

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.interchange.io/api/v2/storefront/inventory-sources/retail-gam/test-connection \
    -H "Authorization: Bearer $SCOPE3_API_KEY"
  ```
</CodeGroup>

## Parameters

| Field      | Type          | Required | Notes                                 |
| ---------- | ------------- | -------- | ------------------------------------- |
| `sourceId` | string (path) | Yes      | Storefront-scoped inventory source ID |

## Response

```json theme={null}
{
  "success": true,
  "error": null,
  "errorCode": null,
  "remediation": null,
  "details": { "networkCode": "12345678" },
  "capabilityChecks": [],
  "testedAt": "2026-05-02T09:14:00Z"
}
```

On failure, `success` is `false` and `errorCode` classifies the problem — for example `ADAPTER_PERMISSION_DENIED` (GAM grant still propagating) or `ADAPTER_NETWORK_NOT_FOUND` (wrong network code). `remediation` carries an operator-facing next step when available. `capabilityChecks` is an optional array of per-capability probe results — each entry has `{ capability, status, message?, errorCode?, remediation?, details? }` where `status` is `passed`, `failed`, or `not_checked`:

```json theme={null}
{
  "success": false,
  "error": "Service account is not authorized on network 12345678.",
  "errorCode": "ADAPTER_PERMISSION_DENIED",
  "remediation": "Grant the service-account email access in your GAM admin console, then retry after a minute.",
  "details": null,
  "testedAt": "2026-05-02T09:14:00Z"
}
```

## Errors

* `401 UNAUTHORIZED` — missing or invalid API key.
* `404 NOT_FOUND` — no ad-server-backed source with this `sourceId`.

A failed probe returns `200` with `success: false` — it is not an HTTP error. See [Errors](/v2/reference/errors) for the full error contract.

## Related

<CardGroup cols={2}>
  <Card title="Inventory source tasks" href="/v2/storefront/inventory-sources/tasks" icon="list-check">
    All operations
  </Card>

  <Card title="Replace ad-server config" href="/v2/storefront/inventory-sources/tasks/replace-ad-server-config" icon="gear">
    Fix the config, then re-test
  </Card>

  <Card title="Rotate credentials" href="/v2/storefront/inventory-sources/tasks/rotate-credentials" icon="key">
    Rotate, then re-test
  </Card>

  <Card title="Get status" href="/v2/storefront/inventory-sources/tasks/get-status" icon="heart-pulse">
    Operational snapshot
  </Card>
</CardGroup>
