# Localization (/en/api/localization)

Each project has a localization: a country and a currency. DeepScout converts the prices of all websites in the project to this currency. Thus you can compare the prices of stores that sell in different currencies.

For example, the currency of your project is `CZK`. A German competitor sells a product for 19.99 EUR. The export of the competitor shows this price in CZK.

At this time, only the currency changes the data. The country and the locale do not change the exports.

In the console, the localization is the **Market** on **Settings → Project**.

## Fields [#fields]

| Field | Description |
| --- | --- |
| `country` | The country of the market, as a two-letter country code (ISO 3166-1 alpha-2). The API returns it in lower case, for example `cz`. |
| `currency` | The currency of the prices in the exports, as an ISO 4217 code. The API returns it in upper case, for example `CZK`. |
| `locale` | The most probable language of the country, for example `cs_CZ` or `de_AT`. The API sets it from the country. You cannot set it. |

[`GET /projects`](/en/api/reference/projects/list-projects.md) shows the localization of each project. A project without a localization has no `localization` field.

```json title="Response"
[
  {
    "project_id": "proj_01k7c2r9v8e3s0b1x6m4q5n2tz",
    "name": "Default project",
    "customer_id": "cust_01k7c2r9t2f8a5d3h7j9k1m6pw",
    "is_default": true,
    "localization": { "locale": "cs_CZ", "country": "cz", "currency": "CZK" }
  }
]
```

## How a project gets its localization [#how-a-project-gets-its-localization]

- **New project.** [`POST /customers/{customer_id}/projects`](/en/api/reference/customers/create-project.md) needs the `localization`. In the console, the **New project** dialog asks for the country and the currency.
- **Default project.** Your first sign-in creates the default project without a localization. The first website that you add to this project sets it. The project gets the country and the currency of the setup job. If the setup job fails, the project stays without a localization.

```bash
curl https://api.deepscout.ai/v1/customers/$CUSTOMER_ID/projects \
  -H "Authorization: Bearer $SCOUT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Germany", "localization": {"country": "DE", "currency": "EUR"}}'
```

<Callout title="A competitor as the first website" type="warn">
If the first website of the default project is a foreign competitor, the project gets the currency of this competitor. If this is not your currency, change the localization.
</Callout>

A project without a localization does not convert prices. Each website keeps the currency of its store. The `currency` field of each product shows it.

## Change the localization [#change-the-localization]

In the console:

1. Open **Settings → Project**.
2. In **Market**, select the country and the currency.
3. Click **Save**.

With the API, send [`PATCH /projects/{project_id}`](/en/api/reference/projects/update-project.md). You need the `ADMIN` role in the project.

```bash
curl -X PATCH https://api.deepscout.ai/v1/projects/$PROJECT_ID \
  -H "Authorization: Bearer $SCOUT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"localization": {"country": "AT", "currency": "EUR"}}'
```

```json title="Response"
{
  "project_id": "proj_01k7c2r9v8e3s0b1x6m4q5n2tz",
  "name": "Default project",
  "customer_id": "cust_01k7c2r9t2f8a5d3h7j9k1m6pw",
  "is_default": true,
  "localization": { "locale": "de_AT", "country": "at", "currency": "EUR" }
}
```

The API accepts the country and the currency in any letter case. An unknown country or currency gets `400 INVALID_LOCALE`.

A change does not convert the current export files. The next completed scrape or matching writes all export files of the project again, in the new currency. See [Know when new files are ready](/en/api/exports.md#know-when-new-files-are-ready).

## Currency conversion [#currency-conversion]

DeepScout uses the [euro reference rates](https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html) of the European Central Bank (ECB). The ECB publishes new rates on working days, at about 16:00 Central European Time. An export uses the latest rates at the time when the API writes the files.

The conversion changes these fields of the [`all_products_with_details`](/en/datasets/products.md) dataset:

| Field | Change |
| --- | --- |
| `price` | Converted to the currency of the project. |
| `price_standard`, `price_discounted`, `price_coupon`, `price_club`, `price_recommended` | Converted to the currency of the project. |
| The same five prices with the `_no_vat` suffix | Converted to the currency of the project. |
| `currency` | Changes to the currency of the project. |

These prices do not change:

- The prices in the `history` records. They stay in the currency of the website.
- The [sample data](/en/api/sample-data.md) of a setup job. It shows the prices of the store.

DeepScout does not round the converted prices. Thus a converted price can have more decimal places than its currency uses, for example `485.9569` CZK.

<Callout title="Currencies without an ECB rate">
The conversion needs an ECB rate for the currency of the project and for the currency of each website. The ECB publishes rates for about 30 currencies, for example `EUR`, `USD`, `GBP`, `CHF`, `CZK`, `PLN` and `HUF`.
</Callout>
