# leave_workspace

Source: https://modulify.ai/docs/api/workspaces/leave-workspace

Removes you from a workspace you were invited to, ending your access to every site in it.

- Title: Leave a workspace
- Scope: `workspaces:write`
- Access: Destructive
- Endpoint: `POST /v1/leave_workspace`

You lose access immediately and can only get back in by being invited again. It acts on the person the token belongs to, and the tool tells the client never to call it on somebody else's behalf.

An owner cannot leave their own workspace, and is refused with `Workspace owner cannot leave workspace! Transfer ownership or delete workspace!` Leaving also revokes the connectors you installed in that workspace and takes your account email off the [forwarding addresses](https://modulify.ai/docs/automations/emails#forwarding-addresses) of its sites where you added it yourself. See [Workspaces](https://modulify.ai/docs/reference/workspaces#leave-a-workspace).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/leave_workspace`, sending the inputs below as a JSON object. The token needs the `workspaces:write` scope.

> **Warning**
>
> This method is marked destructive: it deletes or overwrites data. Check the inputs before you call it, and send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it.

```bash
curl -X POST https://api.modulify.ai/v1/leave_workspace \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"workspaceId":"WORKSPACE_ID"}'
```

Over MCP, the same method is the [leave_workspace tool](https://modulify.ai/docs/mcp/workspaces/leave-workspace).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `workspaceId` | string | Yes | The workspace to leave. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.