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

# How to leave a community on Twitter via API

> Leave a Twitter Community by ID with one connected account. Existing posts stay. Poll the write action, then verify membership removal. Costs 10 credits.

<Panel>
  <Tabs defaultTabIndex={0} sync={false}>
    <Tab title="200" id="response-x-write-leave-community-200">
      ```json theme={null}
      {
        "object": "x_write_action",
        "id": "12345",
        "writeActionId": "12345",
        "action": "leave_community",
        "status": "success",
        "terminal": true,
        "retryable": false,
        "safeToRetry": false,
        "statusUrl": "/api/v1/x/write-actions/12345",
        "pollAfterMs": null
      }
      ```
    </Tab>

    <Tab title="202" id="response-x-write-leave-community-202">
      ```json theme={null}
      {
        "object": "x_write_action",
        "id": "12346",
        "writeActionId": "12346",
        "action": "leave_community",
        "status": "dispatching",
        "terminal": false,
        "retryable": false,
        "safeToRetry": false,
        "statusUrl": "/api/v1/x/write-actions/12346",
        "pollAfterMs": 2000
      }
      ```
    </Tab>

    <Tab title="400" id="response-x-write-leave-community-400">
      ```json theme={null}
      {
        "error": "missing_idempotency_key",
        "message": "Idempotency-Key is required. Generate one unique key for this write.",
        "charged": false,
        "chargedCredits": "0",
        "retryable": false,
        "safeToRetry": true
      }
      ```
    </Tab>

    <Tab title="401" id="response-x-write-leave-community-401">
      ```json theme={null}
      {
        "error": "unauthenticated",
        "message": "Authentication required. Provide a valid API key or bearer token."
      }
      ```
    </Tab>

    <Tab title="402" id="response-x-write-leave-community-402">
      ```json theme={null}
      {
        "error": "insufficient_credits",
        "message": "Insufficient credits. Top up or subscribe to continue."
      }
      ```
    </Tab>

    <Tab title="403" id="response-x-write-leave-community-403">
      ```json theme={null}
      {
        "error": "account_needs_reauth",
        "message": "X account needs re-authentication. Re-add the account."
      }
      ```
    </Tab>

    <Tab title="404" id="response-x-write-leave-community-404">
      ```json theme={null}
      {
        "error": "account_not_found",
        "message": "X account not found. Connect it first at /dashboard/account?tab=x-accounts."
      }
      ```
    </Tab>

    <Tab title="409" id="response-x-write-leave-community-409">
      ```json theme={null}
      {
        "error": "idempotency_conflict",
        "message": "Idempotency-Key was already used with a different request.",
        "charged": false,
        "chargedCredits": "0",
        "retryable": false,
        "safeToRetry": true
      }
      ```
    </Tab>

    <Tab title="422" id="response-x-write-leave-community-422">
      ```json theme={null}
      {
        "error": "x_rejected",
        "message": "X rejected this request. Check what you sent & the account on x.com before you try again."
      }
      ```
    </Tab>

    <Tab title="429" id="response-x-write-leave-community-429">
      ```json theme={null}
      {
        "error": "rate_limit_exceeded",
        "message": "Too many requests. Try again later.",
        "retryAfter": 60
      }
      ```
    </Tab>

    <Tab title="500" id="response-x-write-leave-community-500">
      ```json theme={null}
      {
        "error": "x_write_failed",
        "message": "Write action failed unexpectedly. Contact support if this persists."
      }
      ```
    </Tab>

    <Tab title="503" id="response-x-write-leave-community-503">
      ```json theme={null}
      {
        "error": "write_tracking_unavailable",
        "message": "Write tracking unavailable. Try again.",
        "charged": false,
        "chargedCredits": "0",
        "retryable": true,
        "safeToRetry": true
      }
      ```
    </Tab>
  </Tabs>
</Panel>

<blockquote className="agent-llms-directive">
  For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
</blockquote>

## How to leave a community on Twitter via API

Call `DELETE /x/communities/{id}/join` to remove one connected account's
membership. Other members keep access to the Community. Xquik tracks the
departure as a write action.

This route does not delete the Community. It does not delete the connected
Twitter account. It also does not remove Community posts or replies.

Use [Delete Community](/api-reference/x-write/delete-community) only for an
owned Community that should close. Use [Delete Tweet](/api-reference/x-write/delete-tweet)
for an owned post that should disappear.

<Callout icon="coins" color="#5c3327">
  **10 credits per call** · [All plans](https://xquik.com/#pricing) from \$0.00012/credit
</Callout>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE https://xquik.com/api/v1/x/communities/1893726451023847424/join \
    -H "x-api-key: xq_YOUR_KEY_HERE" \
    -H "Idempotency-Key: community-leave-1895432178065391234" \
    -H "Content-Type: application/json" \
    -d '{
      "account": "myxhandle"
    }' | jq
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://xquik.com/api/v1/x/communities/1893726451023847424/join", {
    method: "DELETE",
    headers: {
      "x-api-key": "xq_YOUR_KEY_HERE",
      "Idempotency-Key": "community-leave-1895432178065391234",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      account: "myxhandle",
    }),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.delete(
      "https://xquik.com/api/v1/x/communities/1893726451023847424/join",
      headers={
          "x-api-key": "xq_YOUR_KEY_HERE",
          "Idempotency-Key": "community-leave-1895432178065391234",
      },
      json={
          "account": "myxhandle",
      },
  )
  data = response.json()
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      body, _ := json.Marshal(map[string]interface{}{
          "account": "myxhandle",
      })

      req, err := http.NewRequest("DELETE", "https://xquik.com/api/v1/x/communities/1893726451023847424/join", bytes.NewReader(body))
      if err != nil {
          panic(err)
      }
      req.Header.Set("x-api-key", "xq_YOUR_KEY_HERE")
      req.Header.Set("Idempotency-Key", "community-leave-1895432178065391234")
      req.Header.Set("Content-Type", "application/json")

      resp, err := http.DefaultClient.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      var data map[string]interface{}
      if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
          panic(err)
      }
      fmt.Println(data)
  }
  ```
</CodeGroup>

## How to leave a Twitter community with Xquik

Resolve and review the numeric Community ID. Call
[Community Info](/api-reference/x/community-info) to confirm its name, rules,
creator, and description.

Show the selected connected account beside those details. Keep the Community ID
separate from the connected account ID.

Check [Community Members](/api-reference/x/community-members) when current
membership needs proof. Follow every cursor before declaring the account
absent. One partial page proves nothing.

Record these values before the write:

* Numeric Community ID and verified name.
* Connected username and stable account ID.
* Departure reason and approval reference.
* New idempotency key for this request.
* Pre-departure roster time and cursor coverage.

Never reuse the earlier join key. Joining and leaving are separate actions.

## Archive community posts before leaving

Leaving does not erase earlier Community posts or replies. X says those posts
continue to exist after a member leaves. They can remain visible on the
Community page, profiles, timelines, and search.

Archive required posts before removing membership. Follow every
[Community Tweets](/api-reference/x/community-tweets) cursor. Save Tweet IDs,
authors, text, timestamps, media URLs, replies, reposts, likes, and cursors.

Use [Community Search](/api-reference/x/community-search) for keyword matches
inside the known Community. That route cannot archive every post unless the
query covers them. Use the unfiltered timeline for a complete export.

No request field sends a notification. Notify members through a separate
approved workflow when a handoff requires notice. Never claim that this API
sends a farewell post, direct message, or moderator alert.

## Leave a Twitter community step by step

Create one idempotency key for this departure. Send the Community ID in the
path. Send the connected username through `account`.

Use this sequence:

1. Verify the Community and connected account.
2. Archive required Community posts and member evidence.
3. Approve one membership-removal request.
4. Submit `DELETE /x/communities/{id}/join` once.
5. Store the returned action ID.
6. Poll until the action reaches a terminal result.
7. Verify the account no longer appears as a member.

A `202` response confirms accepted processing. It does not confirm departure.
Do not create another key during a timeout. Inspect the existing action first.

## Verify the Twitter community departure

Read [Community Members](/api-reference/x/community-members) after terminal
success. Follow every cursor required for the account search. Store the final
cursor, lookup time, username, and account ID.

Keep the write receipt separate from later roster snapshots. The receipt shows
the requested action. The roster shows membership observed later.

If the account remains, refresh the complete roster once. Pair that result with
the returned action ID. Do not submit parallel departures with different keys.

| Membership task | Correct route | Expected result |
| - | - | - |
| Confirm the Community | `GET /x/communities/{id}/info` | Review its name, rules, creator, and policies. |
| Confirm membership | `GET /x/communities/{id}/members` | Find the account in a complete roster. |
| Leave the Community | `DELETE /x/communities/{id}/join` | Remove one connected account's membership. |
| Rejoin later | `POST /x/communities/{id}/join` | Submit a new membership action. |
| Delete the Community | `DELETE /x/communities/{id}` | Remove the entire owned Community. |

## Leave a Twitter community on PC or phone

For a manual departure, X says to open the Community page. Select the Joined
button, then choose Leave the community. X documents that flow for
its Community interface.

Use the API for software workflows. The request stays the same across server,
desktop, iOS, and Android clients. Do not automate screen labels when the REST
route fits the workflow.

Read the official [X Communities guide](https://help.x.com/en/using-x/communities)
for current interface behavior. X can change its buttons without changing
Xquik's documented request.

## Community departure questions

### Do my community posts disappear after I leave?

No. X says Community posts and replies remain after their author leaves. Use
Delete Tweet for an owned post that you want removed.

### Can I rejoin the community later?

Yes, when X permits membership. X may accept the original invitation during a
later membership request. Restricted Communities may need moderator approval.

Rejoining needs another approval and idempotency key.

### Can this API cancel a pending join request?

No. This route removes existing membership. The API has no
cancel-pending-request field or separate cancellation endpoint.

### Does leaving delete the community?

No. Other members, moderators, rules, and Community posts remain. Use Delete
Community only to close an owned group.

### Is a Twitter group chat the same as a community?

No. Leaving a Community keeps every group direct message unchanged.

### Can an admin transfer ownership before leaving?

This request has no ownership-transfer field. Finish any available transfer in
X. Verify the new admin before leaving.

### What are the privacy effects of leaving?

The departing account stops appearing as a current member after success.
Earlier posts can remain public. Saved exports and third-party copies also
remain outside this membership action.

### Is community notes the same as X communities?

No. Community Notes adds context to eligible posts. Use its separate workflow
for Community Notes participation.

### Do Twitter communities still exist?

Yes. X still publishes current Communities guidance. X controls interface
availability, membership modes, invitations, moderation, and search.

## Recover from leave community failures

Fix malformed IDs or bodies after `400`. Replace invalid credentials after
`401`. Restore credits after `402`. Reconnect the selected account after `403`.

Check both the account and Community after `404`. A missing account differs
from a missing Community. Tell the operator which one is missing.

For `409`, compare the saved account, Community ID, and request body. Keep the
key only for identical inputs. Changed inputs need fresh approval.

Save `422` rejection details. Do not delete the Community as a fallback.
After `429`, wait for `Retry-After`. Keep the approved inputs unchanged.

After `500` or `503`, inspect `safeToRetry` and the existing lifecycle. Never
infer failure from a dropped connection. Verify first to avoid a duplicate
membership write.

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key. OAuth bearer authentication is also supported. Generate a key from the [dashboard](https://xquik.com/dashboard).
</ParamField>

<ParamField header="Idempotency-Key" type="string" required>
  Unique key for this intended write. Reuse it only for an exact network replay.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`.
</ParamField>

## Path parameters

<ParamField path="id" type="string" required>
  The ID of the community to leave.
</ParamField>

## Body

<ParamField body="account" type="string" required>
  The connected X account to remove from the community. Must be a username you have connected to your Xquik account.
</ParamField>

## Response

<Tabs>
  <Tab title="404 Account not found">
    Connect the requested account, then submit a newly approved write.
  </Tab>
</Tabs>

## Durable write recovery

<Warning>
  Send one unique `Idempotency-Key` per intended write.
  Replay the same account, target, payload, and media after a lost response.
  Keep the original key for that replay.
</Warning>

1. Store `id`, the nested `hash` in `request`, `billing`, and `statusUrl`.
2. Poll after `Retry-After` or `pollAfterMs` when `terminal` is `false`.
3. Retry only when `safeToRetry` is `true`.
4. Use a new key when `nextAction.requiresNewIdempotencyKey` is `true`.

### 200 terminal or 202 active

* After HTTP `200`, store the result and settled billing.
* After HTTP `202`, poll the same action. Never submit another write.
* After HTTP `400`, fix the named field. Use a new idempotency key.
* After HTTP `401`, fix authentication. Do not retry unchanged.
* After HTTP `402`, fund the account before another write.
* After HTTP `403`, reconnect the account.
* After HTTP `409`, keep the original action. Use a new key for new input.
* After HTTP `422`, fix the rejected request before retrying.
* After HTTP `429`, wait for `Retry-After`. Follow `nextAction`.

See [Get Write Action Status](/api-reference/x-write/get-write-action-status)
for every lifecycle field, terminal state, billing field, and retry rule.


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