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

# Update entity country activation

> Update country activation status for a merchant entity. Idempotent when status is unchanged; emits entity.country_activation_changed webhook on change.

## Overview

Sets the operational activation status for one country on a merchant entity. This does **not** modify entity profile data — use [`GET /entities/{id}`](/en/api-reference/entities/get) to re-fetch the dossier after activation.

On every real status change, Gu1 emits the [`entity.country_activation_changed`](/en/webhooks/events/entity-events) webhook to subscribed endpoints. Transitions between statuses are **free-form** (any status may move to any other).

Supported `countryCode` values: **AR**, **BR**, **CL**, **CO**, **MX**, **US** (case-insensitive).

## Endpoint

```
PATCH http://api.gu1.ai/entities/{id}/country-activations/{countryCode}
```

## Authentication

Requires `entities:edit` (legacy fallback: `entities:write`).

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

<ParamField path="id" type="string" required>
  UUID of the entity (merchant).
</ParamField>

<ParamField path="countryCode" type="string" required>
  ISO 3166-1 alpha-2 country to update (`AR`, `BR`, `CL`, `CO`, `MX`, `US`).
</ParamField>

## Request Body

<ParamField body="status" type="string" required>
  One of: `deactivated`, `activation_requested`, `activation_in_progress`, `activated`.
</ParamField>

## Response

| Field                 | Type           | Description                                                    |
| --------------------- | -------------- | -------------------------------------------------------------- |
| `data.entityId`       | string         | Entity UUID                                                    |
| `data.countryCode`    | string         | Normalized country code                                        |
| `data.status`         | string         | New status                                                     |
| `data.previousStatus` | string         | Status before this call                                        |
| `data.changed`        | boolean        | `false` if status was already the requested value (no webhook) |
| `data.activatedAt`    | string \| null | Last `activated` timestamp                                     |
| `data.deactivatedAt`  | string \| null | Last `deactivated` timestamp                                   |
| `data.updatedAt`      | string \| null | Last change timestamp                                          |
| `data.countries`      | array          | Full snapshot of all allowlist countries after this call       |

## Example

```bash theme={null}
curl -X PATCH "https://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000/country-activations/CO" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status":"activation_requested"}'
```

```json theme={null}
{
  "success": true,
  "data": {
    "entityId": "550e8400-e29b-41d4-a716-446655440000",
    "countryCode": "CO",
    "status": "activation_requested",
    "previousStatus": "deactivated",
    "changed": true,
    "activatedAt": null,
    "deactivatedAt": null,
    "updatedAt": "2026-07-03T15:00:00.000Z",
    "countries": [
      { "countryCode": "AR", "status": "deactivated", "activatedAt": null, "deactivatedAt": null, "updatedAt": null },
      { "countryCode": "CO", "status": "activation_requested", "activatedAt": null, "deactivatedAt": null, "updatedAt": "2026-07-03T15:00:00.000Z" },
      { "countryCode": "MX", "status": "activated", "activatedAt": "2026-07-03T14:00:00.000Z", "deactivatedAt": null, "updatedAt": "2026-07-03T14:00:00.000Z" }
    ]
  }
}
```

## Webhook payload (on change)

When `changed` is `true`, subscribers receive:

```json theme={null}
{
  "event": "entity.country_activation_changed",
  "timestamp": "2026-07-03T15:00:00.000Z",
  "organizationId": "org-uuid",
  "payload": {
    "entity": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "externalId": "merchant_123",
      "name": "Acme Corp",
      "type": "company",
      "countryCode": "US"
    },
    "countryCode": "CO",
    "status": "activation_requested",
    "previousStatus": "deactivated",
    "activeCountryCodes": ["MX"],
    "countries": [
      { "countryCode": "AR", "status": "deactivated" },
      { "countryCode": "CO", "status": "activation_requested" },
      { "countryCode": "MX", "status": "activated" }
    ],
    "timeline": [
      {
        "previousStatus": "deactivated",
        "status": "activation_requested",
        "changedAt": "2026-07-03T15:00:00.000Z"
      }
    ],
    "changedAt": "2026-07-03T15:00:00.000Z"
  }
}
```

## Errors

| HTTP | Code                       | When                                              |
| ---- | -------------------------- | ------------------------------------------------- |
| 400  | `UNSUPPORTED_COUNTRY_CODE` | Country not in v1 allowlist                       |
| 404  | `ENTITY_NOT_FOUND`         | Entity does not exist in the current organization |
