# Policy translations

Read and write localized policy fields through the Store API.

## Get policy translation

`GET /api/2025-01/policies/{id}/translations/{locale}`

Returns stored translated Policy fields for one locale, including whether the translation is out of date. Translation routes use the policy UUID returned by list/get, while policy CRUD routes use the fixed policy type. Fields without a translation in this locale are omitted from the response. An omitted field is not empty: shoppers see the store's base-language value, which the resource's own GET endpoint returns.

Scope: `read_pages + read_translations`

```curl
curl 'https://api-store.tringify.com/api/2025-01/policies/5ff7d4ea-3250-4a4d-9d26-07f64d917d31/translations/fr' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{
  "data": {
    "fields": {
      "title": {
        "is_outdated": false,
        "value": "Politique de confidentialité",
        "word_count": 3
      }
    }
  },
  "success": true
}
```

## Set policy translation

`PUT /api/2025-01/policies/{id}/translations/{locale}`

Writes translated Policy fields for one locale. Empty values, and `content` with no text and no media, clear the matching field translation. The `{id}` value is the policy UUID returned by list/get, not the policy type. Rich-text content is cleaned the same way as the source: when unsafe markup is removed, the response lists a warning in `data.content_warnings` (shown in the example); otherwise the response has no `data`. Unknown or wrongly typed body properties are refused. A translated slug must be unique among the URLs of this type in that language (a translated slug, or the source slug where there is none). A write waits at most 2 seconds for other translation writes of the same item or of a clashing name or slug (for example a translation CSV import writing the same language); writes of other items, types and languages never wait. A row or call that fails with `TRANSLATION_WRITE_BUSY` (HTTP 503) saved nothing: send it again after `error.details.retry_after_seconds` (the call's `Retry-After` header says the same). Every row or call either saved or reports an error; none is left in an unknown state.

Scope: `write_pages + write_translations`

```curl
curl -X PUT 'https://api-store.tringify.com/api/2025-01/policies/5ff7d4ea-3250-4a4d-9d26-07f64d917d31/translations/fr' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "translations": {
    "content": "\u003cp onclick=\"track()\"\u003eComment nous traitons vos données.\u003c/p\u003e",
    "title": "Politique de confidentialité"
  }
}'
```

Response:

```json
{
  "code": "TRANSLATION_SAVED",
  "data": {
    "content_warnings": [
      "Some content was removed because it is not allowed, such as scripts, embedded frames, event handlers or unsupported links. Check the saved content."
    ]
  },
  "message": "Translation saved.",
  "success": true
}
```

## Batch get policy translations

`GET /api/2025-01/policies/translations/{locale}`

Returns translated Policy fields for up to 100 policy ids in one locale. `ids` is required: send 1 to 100 comma-separated ids; duplicates count once. Fields without a translation in this locale are omitted from the response. An omitted field is not empty: shoppers see the store's base-language value, which the resource's own GET endpoint returns.

Scope: `read_pages + read_translations`

```curl
curl 'https://api-store.tringify.com/api/2025-01/policies/translations/fr?ids=5ff7d4ea-3250-4a4d-9d26-07f64d917d31' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{
  "data": {
    "resources": {
      "policy:5ff7d4ea-3250-4a4d-9d26-07f64d917d31": {
        "title": {
          "is_outdated": false,
          "value": "Politique de confidentialité",
          "word_count": 3
        }
      }
    }
  },
  "success": true
}
```

## Batch set policy translations

`PUT /api/2025-01/policies/translations`

Each row is one policy in one language: `id`, `locale` (any enabled non-default store locale) and `fields`. Rows for several languages can be mixed in one call; send at most 100 rows (one row = one policy in one locale) and at most one row per policy and locale. Each row is saved on its own: a failing row never stops the others. Empty values clear the matching field translation; omitted fields keep their translation. Every row is validated exactly like the single translation endpoint. The response has `totals` (`rows`, `saved`, `failed`) and one `results` entry per row in request order: `{id, locale, status}` with status `saved` or `failed`. A failed row carries the full `error` (code, message, details); its codes are the single endpoint's codes plus `TRANSLATION_ROW_DUPLICATE`. A saved rich-text row whose unsafe markup was removed lists `warnings`. A top-level `code` and `message` give the outcome: `TRANSLATIONS_SAVED` (200, every row saved), `TRANSLATIONS_PARTIALLY_SAVED` (200, `success: true`; the message counts saved and failed rows and names the failure reasons, e.g. "2 saved, 1 failed. No source text found for the requested fields (description).") `TRANSLATIONS_NOT_SAVED_RETRY` (503 with a `Retry-After` header, `success: false`; no row saved because every row failed only with `TRANSLATION_WRITE_BUSY`, so the same call can be sent again after `error.details.retry_after_seconds`) or `TRANSLATIONS_NOT_SAVED` (422, `success: false`; no row saved and at least one row failed for another reason). Both carry the same `totals` and `results` in `error.details`. With an `Idempotency-Key`, repeating the same request re-applies nothing that already saved and retries the failed rows. A translated slug must be unique among the URLs of this type in that language (a translated slug, or the source slug where there is none). Of two rows of one call that would share a value in one language, the earlier row keeps it and the later row fails with the duplicate code and `details.existing_id`, the earlier row's id. Rows are saved independently, each checked against the values stored when it is saved, so two rows that swap values (one row takes the value another row's resource holds, and that row takes a different one) fail: the row that takes a held value is refused with the duplicate code. To swap them, import a translation CSV with both rows (`POST /imports`, type `translations`): an import checks consecutive rows together, so a swap is accepted when its two rows sit next to each other in the file. A write waits at most 2 seconds for other translation writes of the same item or of a clashing name or slug (for example a translation CSV import writing the same language); writes of other items, types and languages never wait. A row or call that fails with `TRANSLATION_WRITE_BUSY` (HTTP 503) saved nothing: send it again after `error.details.retry_after_seconds` (the call's `Retry-After` header says the same). Every row or call either saved or reports an error; none is left in an unknown state.

Scope: `write_pages + write_translations`

```curl
curl -X PUT 'https://api-store.tringify.com/api/2025-01/policies/translations' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "translations": [
    {
      "fields": {
        "title": "Politique de confidentialité"
      },
      "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
      "locale": "fr"
    },
    {
      "fields": {
        "title": "Datenschutzerklärung"
      },
      "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
      "locale": "de"
    },
    {
      "fields": {
        "title": "Política de privacidade"
      },
      "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
      "locale": "pt-BR"
    }
  ]
}'
```

Response:

```json
{
  "code": "TRANSLATIONS_PARTIALLY_SAVED",
  "data": {
    "results": [
      {
        "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
        "locale": "fr",
        "status": "saved"
      },
      {
        "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
        "locale": "de",
        "status": "saved"
      },
      {
        "error": {
          "code": "TRANSLATION_LOCALE_NOT_ENABLED",
          "message": "Locale pt-BR is not enabled for this store."
        },
        "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
        "locale": "pt-BR",
        "status": "failed"
      }
    ],
    "totals": {
      "failed": 1,
      "rows": 3,
      "saved": 2
    }
  },
  "message": "2 saved, 1 failed. Locale pt-BR is not enabled for this store.",
  "success": true
}
```

## Webhook events

Subscribe to these events when your integration mirrors localized policies. Update and clear events identify the locale and changed fields. One write can emit both events when it sets some fields and clears others. No event announces that translations became outdated. A translation is outdated (`is_outdated: true`) once its source field changes, and the policy update event reports that change, so after an update that changes a translated field, treat that field's stored translations in every locale as outdated until they are updated or cleared.

## Policy translations updated

Event: `policies/translations/update` · App scope: `read_pages, read_translations` · Staff permission: `pages:write`

Fired when a policy's translations are added or updated for a locale. Payload carries only the fields that changed. It and policies/update can arrive in any order.

```json
{
  "locale": "fr",
  "policy": {
    "content": "\u003cp\u003eReturns are accepted within 30 days of delivery.\u003c/p\u003e",
    "created_at": "2026-06-09T12:00:00-04:00",
    "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
    "robots": "index",
    "seo_description": "Our 30-day return terms.",
    "seo_title": "Refund policy",
    "slug": "refund-policy",
    "social_image_id": "8f2a1c2b-9d4e-4a56-b789-0123456789ab",
    "status": "published",
    "title": "Refund policy",
    "type": "refund",
    "updated_at": "2026-06-09T12:00:00-04:00"
  },
  "translation": {
    "content": "\u003cp\u003eLes retours sont acceptés sous 30 jours.\u003c/p\u003e",
    "seo_description": "Nos conditions de retour sous 30 jours.",
    "seo_title": "Politique de remboursement",
    "slug": "politique-remboursement",
    "title": "Politique de remboursement"
  },
  "updated_at": "2026-06-09T12:00:00-04:00"
}
```

## Policy translations deleted

Event: `policies/translations/delete` · App scope: `read_pages, read_translations` · Staff permission: `pages:write`

Fired when a policy's translations are cleared for one or more fields in a locale. It and policies/update can arrive in any order.

```json
{
  "locale": "fr",
  "policy": {
    "content": "\u003cp\u003eReturns are accepted within 30 days of delivery.\u003c/p\u003e",
    "created_at": "2026-06-09T12:00:00-04:00",
    "id": "5ff7d4ea-3250-4a4d-9d26-07f64d917d31",
    "robots": "index",
    "seo_description": "Our 30-day return terms.",
    "seo_title": "Refund policy",
    "slug": "refund-policy",
    "social_image_id": "8f2a1c2b-9d4e-4a56-b789-0123456789ab",
    "status": "published",
    "title": "Refund policy",
    "type": "refund",
    "updated_at": "2026-06-09T12:00:00-04:00"
  },
  "translation": {
    "content": "",
    "seo_description": "",
    "seo_title": "",
    "slug": "",
    "title": ""
  },
  "updated_at": "2026-06-09T12:00:00-04:00"
}
```

