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

# Set FreeWheel execution currency

> Declare the currency FreeWheel will assign to insertion orders

`PUT /api/v2/storefront/esa/{esaId}/execution-currency`

Sets the execution currency for an existing FreeWheel source without replacing
its stored credentials. Use the connection `id` returned by [Get ad-server
connection](/v2/storefront/inventory-sources/tasks/get-ad-server-connection) as
`esaId`; this is not the inventory source's `sourceId`.

The currency must match the currency FreeWheel will assign to insertion orders
and must be one your storefront settles. Interchange does not choose a default
currency for you.

## Request

<CodeGroup>
  ```bash curl theme={null}
  curl -X PUT https://api.interchange.io/api/v2/storefront/esa/550199/execution-currency \
    -H "Authorization: Bearer $SCOPE3_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"executionCurrency":"EUR"}'
  ```
</CodeGroup>

## Parameters

| Field               | Type           | Required | Notes                                              |
| ------------------- | -------------- | -------- | -------------------------------------------------- |
| `esaId`             | integer (path) | Yes      | Connection `id` for the managed ad-server source   |
| `executionCurrency` | string         | Yes      | Three-letter ISO 4217 currency code, such as `EUR` |

## Response

`200 OK` with the updated `EsaConnection`. The non-secret FreeWheel config
shows the saved value in `adServer.executionCurrency`:

```json theme={null}
{
  "id": "550199",
  "name": "Retail video",
  "customerId": 4210,
  "tenantId": "tnt_retail_freewheel",
  "adServer": {
    "type": "freewheel",
    "clientId": "fw-client-id",
    "username": null,
    "environment": "production",
    "defaultAdvertiserId": "adv_88421",
    "executionCurrency": "EUR"
  },
  "lastError": null,
  "lastErrorCode": null
}
```

For a network with existing insertion orders, FreeWheel must report the same
currency before the change is accepted. A network with no priced orders has no
currency to report yet. In that case, Interchange carries the declared currency
to the first booking and refuses the buy if FreeWheel reports a different one.
See [Ad-server execution currency is not
ready](/v2/storefront/inventory-sources/troubleshooting#ad-server-execution-currency-is-not-ready)
for the full readiness path.

## Errors

* `400 VALIDATION_ERROR` means the value is not a three-letter currency code,
  the storefront does not settle it, the source is not active and provisioned,
  the source is not FreeWheel, or FreeWheel cannot verify the network currency.
  The previous execution currency remains active.
* `401 UNAUTHORIZED` means the API key is missing or invalid.
* `404 NOT_FOUND` means no ad-server source has this `esaId` on your storefront.
* `409 CONFLICT` means another ad-server configuration change is awaiting
  reconciliation. Retry after that change completes.

See [Errors](/v2/reference/errors) for the full error contract.

## Related

<CardGroup cols={2}>
  <Card title="Get ad-server connection" href="/v2/storefront/inventory-sources/tasks/get-ad-server-connection" icon="server">
    Read the current FreeWheel execution currency
  </Card>

  <Card title="Test connection" href="/v2/storefront/inventory-sources/tasks/test-connection" icon="plug-circle-check">
    Verify the source against FreeWheel now
  </Card>

  <Card title="Replace ad-server config" href="/v2/storefront/inventory-sources/tasks/replace-ad-server-config" icon="gear">
    Replace the full adapter configuration
  </Card>

  <Card title="Troubleshoot source problems" href="/v2/storefront/inventory-sources/troubleshooting" icon="wrench">
    Resolve execution-currency readiness blocks
  </Card>
</CardGroup>
