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

# Simulate connectivity

> Put a zone into any connectivity state in the sandbox to test your fallback handling.

```
POST /v1/sandbox/simulate-connectivity
```

Sets the simulated connectivity state of one of your zones in the sandbox for a limited time. Sandbox events from that zone then follow the same channel decision as production would in that state, without any message leaving wede. The real state of the zone and your production traffic are never touched.

## Authentication

Sandbox API key (`wede_test_`) only. Any other credential receives `403 sandbox_key_required`.

## Request body

**zone\_id** `string` *required*

Code of a zone linked to your tenant, for example `zone_lisbon_central`.

**connectivity\_state** `string` *required*

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

**duration\_seconds** `integer` (default: 60)

How long the simulated state lasts, from 5 to 3600 seconds. When it ends, the zone is `online` again in the sandbox.

## Example

```bash theme={null}
curl -X POST https://api.wede.pt/v1/sandbox/simulate-connectivity \
  -H "x-wede-api-key: wede_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "zone_id": "zone_lisbon_central",
    "connectivity_state": "offline",
    "duration_seconds": 300
  }'
```

## Response

`200 OK`

```json theme={null}
{
  "zone_id": "zone_lisbon_central",
  "environment": "sandbox",
  "state_applied": "offline",
  "active_until": "2026-09-26T10:10:00.000Z"
}
```

**zone\_id** `string`

Zone code.

**environment** `string`

Always `sandbox`.

**state\_applied** `string`

The simulated state now in effect.

**active\_until** `string`

When the simulation ends.

If the state changes to or from `online`, wede sends `connectivity.degraded` or `connectivity.restored` with `"environment": "sandbox"`. The return to `online` when the simulation expires does not send a webhook.

## A typical test

1. Simulate `offline` for your zone.
2. Send an event with `metadata.zone_id` set to that zone, using the sandbox key.
3. Read it with [`GET /v1/events/:event_id`](/api-reference/events/get): `channel_used` and the `lifecycle` (notes starting with `sandbox:`) show the path production would take with your continuity mode and channel cascade.
4. Check that your webhook endpoint received `event.delivered` or `event.status_changed` with `"environment": "sandbox"`.

## Errors

| Status | Code | When |
| - | - | - |
| 400 | `invalid_payload` | Invalid JSON, a missing field, an invalid state or `duration_seconds` outside 5 to 3600. `details` lists each problem |
| 401 | `unauthorized` | Credential missing, malformed, revoked or expired |
| 403 | `sandbox_key_required` | The credential is not a sandbox API key |
| 422 | `invalid_reference` | The zone is not linked to your tenant |
| 503 | `service_unavailable` | The API key could not be validated right now. Retry |


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