# profiles.accept_egress_change

`POST /api/public/v1/profiles/{id}/accept-egress-change`

Accept a changed exit location the guard measured (egress.pending): it becomes the new baseline and launches resume; the time zone moves only with timezone=follow.

- Capability: `profile.edit`
- Command (idempotent): yes — send a `command_id`; resending the same id and body returns the stored receipt
- MCP tool: `profiles_accept_egress_change`

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | Yes | Profile id |
| `command_id` | body | string (uuid) | Yes | Client-generated UUID for this command. Send the same id (and body) again to get the stored receipt instead of a second change; a different body under the same id is CONFLICT. |
| `expected_revision` | body | integer | Yes | The revision you last read; a newer revision on the server is CONFLICT (min 1, max 9007199254740991) |
| `timezone` | body | "keep" \| "follow" | Yes | keep: the profile's time zone stays as it is; follow: a custom time zone moves to the new exit's zone (a zone that follows the proxy needs no change) |

## Response

`201` with `{ data, replayed: false, correlation_id }` the first time; `200` with `replayed: true` for a repeated `command_id`.

| Field | Type | Always present | Description |
|---|---|---|---|
| `data` | object | Yes |  |
| `data.profile_id` | string (uuid) | Yes |  |
| `data.revision` | integer | Yes | (min -9007199254740991, max 9007199254740991) |
| `data.changed` | array<string> | Yes | egress_baseline, plus config when the time zone followed |
| `data.baseline` | object | Yes |  |
| `data.baseline.ip` | string | No |  |
| `data.baseline.country` | string | No | ISO 3166-1 alpha-2 |
| `data.baseline.timezone` | string | No | IANA zone of the exit, when the worker could tell |
| `data.baseline.source` | string | No | first_launch \| accepted |
| `data.baseline.set_at` | string (date-time) | No |  |
| `data.baseline.observed_at` | string (date-time) | No |  |
| `correlation_id` | string (uuid) | Yes |  |
| `replayed` | boolean | No | true when this command_id was already applied and the stored receipt came back |

New fields can appear at any time; ignore the ones you do not know.

## Errors

| Code | HTTP | Retryable |
|---|---|---|
| `UNAUTHENTICATED` | 401 | No |
| `FORBIDDEN` | 403 | No |
| `RATE_LIMITED` | 429 | Yes |
| `VALIDATION_FAILED` | 422 | No |
| `NOT_FOUND` | 404 | No |
| `CONFLICT` | 409 | No |
| `OUTCOME_UNKNOWN` | 202 | Yes |
| `DEPENDENCY_UNAVAILABLE` | 503 | Yes |
| `UNKNOWN` | 500 | No |

## Examples (curl)

```bash
curl -X POST "https://browlix.com/api/public/v1/profiles/<id>/accept-egress-change" \
  -H "Authorization: Bearer $BROWLIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command_id":"<uuid>","expected_revision":1,"timezone":"keep"}'
```

## Examples (TypeScript SDK)

```ts
import { Browlix } from "@browlix/sdk";

const bx = new Browlix({ apiKey: process.env.BROWLIX_API_KEY! });
const reply = await bx.call("profiles.accept_egress_change", { path: { id: "<id>" }, body: {"expected_revision":1,"timezone":"keep"} });
console.log(reply.data);
```

## Examples (Python)

```python
import os, uuid
import requests

r = requests.post(
    "https://browlix.com/api/public/v1/profiles/<id>/accept-egress-change",
    headers={"Authorization": f"Bearer {os.environ['BROWLIX_API_KEY']}"},
    json={"command_id":str(uuid.uuid4()),"expected_revision":1,"timezone":"keep"},
    timeout=60,
)
print(r.status_code, r.json())
```

## Examples (MCP)

```json
{
  "method": "tools/call",
  "params": {
    "name": "profiles_accept_egress_change",
    "arguments": {
      "id": "<id>",
      "expected_revision": 1,
      "timezone": "keep"
    }
  }
}
```
