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

# Update a zone

> Change a zone's details, active verticals, outline or connectivity state.

```http theme={null}
PATCH /v1/tenant/zones/{zone_code}
```

## Authentication

Session token (`Authorization: Bearer <token>`) with the `zones:manage` permission: `company_admin`, `company_tech` or `country_admin`. The integration API key and other roles receive `403 forbidden`.

> [!WARNING]
>
> A `connectivity_state` sent with a session token changes the real state of the zone for your tenant, and wede routes production events by it. If the request is made with a sandbox key, a `connectivity_state` change only affects the sandbox state of the zone; the other fields you send still change the zone itself. To test connectivity changes, use [`POST /v1/sandbox/simulate-connectivity`](/api-reference/sandbox/simulate) with a sandbox key.

## Shared zones

A zone can be linked to more than one tenant. Its common data (`name`, `region`, `lat_center`, `lng_center` and `boundary`) is then shared, and a tenant cannot change it: the request returns `403 shared_zone`. On a shared zone you can still change your own `connectivity_state` and `verticals_active`. A zone linked only to your tenant accepts every field.

## Path parameters

**zone\_code** `string` *required*

Code of a zone linked to your tenant.

## Body

All fields are optional. Send only what you want to change.

**name** `string`

Display name.

**region** `string`

Region or district.

**lat\_center** `number`

Latitude of the zone centre.

**lng\_center** `number`

Longitude of the zone centre.

**boundary** `object[]`

Zone outline as a list of `{ "lat": number, "lng": number }` points. Send `[]` to clear it.

**verticals\_active** `string[]`

Verticals your tenant runs in this zone. Replaces the current list. Each must be a vertical registered in wede.

**connectivity\_state** `string`

`online`, `degraded`, `sms_only`, `voice_only` or `offline`.

## Connectivity webhooks

When `connectivity_state` changes, wede notifies your tenant:

| Change | Webhook |
| - | - |
| From `online` to any other state | `connectivity.degraded` |
| From any other state back to `online` | `connectivity.restored` |

Changes between two non-online states (for example `degraded` to `offline`) send no webhook. The webhook `data` is `{ zone_id, previous_state, state, detected_at }`, where `zone_id` is the zone code.

## Example

```bash theme={null}
curl -X PATCH https://api.wede.pt/v1/tenant/zones/zone_lisbon_central \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "connectivity_state": "sms_only",
    "boundary": [
      { "lat": 38.72, "lng": -9.14 },
      { "lat": 38.71, "lng": -9.13 },
      { "lat": 38.70, "lng": -9.15 }
    ]
  }'
```

## Response `200`

The updated zone object, with the same fields as in [List zones](/api-reference/zones/list.md#response-200).

## Errors

| Status | `error` | When |
| - | - | - |
| `401` | `unauthorized` | Missing, invalid or revoked credentials. |
| `403` | `forbidden` | The credential lacks `zones:manage` (including every API key). |
| `403` | `shared_zone` | You sent `name`, `region`, `lat_center`, `lng_center` or `boundary` for a zone shared with another tenant. |
| `404` | `not_found` | No zone with this code is linked to your tenant. |
| `500` | `internal_error` | Unexpected server error, including a `connectivity_state` outside the allowed values or an unknown vertical. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.