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

# Revoke many API keys at once, X (Twitter) API docs

> Revoke up to 10,000 Xquik API keys in 1 request & get back the IDs it revoked. Unknown IDs are skipped, so a retry is safe. Revocation is immediate & free.

> For the complete documentation index, see [llms.txt](https://docs.xquik.com/llms.txt).

`POST https://xquik.com/api/v1/api-keys/bulk-revoke`

Clean up old or leaked keys in 1 request. Xquik revokes each listed key that belongs to your
account. It answers with the IDs it revoked. It skips IDs of unknown keys and of other accounts'
keys. So a retry is safe.

**Free.** This endpoint does not consume credits.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/bash.json","/languages/csharp.json","/languages/go.json","/languages/java.json","/languages/javascript.json","/languages/kotlin.json","/languages/php.json","/languages/python.json","/languages/ruby.json","/languages/typescript.json"]}}
curl -X POST https://dashboard.xquik.com/api/v1/api-keys/bulk-revoke \
  -H "Cookie: __Host-xquik_session=YOUR_SESSION_COOKIE" \
  -H "Origin: https://dashboard.xquik.com" \
  -H "Sec-Fetch-Site: same-origin" \
  -H "Content-Type: application/json" \
  -d '{"ids": ["42", "43"]}' | jq
```

```javascript Node.js theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/bash.json","/languages/csharp.json","/languages/go.json","/languages/java.json","/languages/javascript.json","/languages/kotlin.json","/languages/php.json","/languages/python.json","/languages/ruby.json","/languages/typescript.json"]}}
const response = await fetch("https://dashboard.xquik.com/api/v1/api-keys/bulk-revoke", {
  method: "POST",
  headers: {
    Cookie: "__Host-xquik_session=YOUR_SESSION_COOKIE",
    Origin: "https://dashboard.xquik.com",
    "Sec-Fetch-Site": "same-origin",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ ids: ["42", "43"] }),
});
const { revoked } = await response.json();
console.log(revoked);
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/bash.json","/languages/csharp.json","/languages/go.json","/languages/java.json","/languages/javascript.json","/languages/kotlin.json","/languages/php.json","/languages/python.json","/languages/ruby.json","/languages/typescript.json"]}}
import requests

response = requests.post(
    "https://dashboard.xquik.com/api/v1/api-keys/bulk-revoke",
    cookies={"__Host-xquik_session": "YOUR_SESSION_COOKIE"},
    headers={"Origin": "https://dashboard.xquik.com", "Sec-Fetch-Site": "same-origin"},
    json={"ids": ["42", "43"]},
)
print(response.json()["revoked"])
```

```go Go theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/bash.json","/languages/csharp.json","/languages/go.json","/languages/java.json","/languages/javascript.json","/languages/kotlin.json","/languages/php.json","/languages/python.json","/languages/ruby.json","/languages/typescript.json"]}}
package main

import (
	"bytes"
	"fmt"
	"io"
	"log"
	"net/http"
)

func main() {
	body := bytes.NewBufferString(`{"ids": ["42", "43"]}`)
	req, err := http.NewRequest("POST", "https://dashboard.xquik.com/api/v1/api-keys/bulk-revoke", body)
	if err != nil {
		log.Fatal(err)
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Origin", "https://dashboard.xquik.com")
	req.Header.Set("Sec-Fetch-Site", "same-origin")
	req.AddCookie(&http.Cookie{Name: "__Host-xquik_session", Value: "YOUR_SESSION_COOKIE"})

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

	answer, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(answer))
}
```

## Headers

| Header | Type | Required | Description |
| - | - | - | - |
| `Cookie` | `string` | Yes | Your signed-in dashboard session cookie, `__Host-xquik_session`. API keys and OAuth tokens get `403 session_required`. |
| `Origin` | `string` | Yes | Must be `https://dashboard.xquik.com`, sent with `Sec-Fetch-Site` set to `same-origin`. The dashboard sends both. |
| `Content-Type` | `string` | Yes | Must be `application/json`. |

## Body

| Body parameter | Type | Required | Description |
| - | - | - | - |
| `ids` | `string[]` | Yes | IDs of the keys to revoke, from 1 to 10,000. Get them from [List API keys](https://docs.xquik.com/api-reference/api-keys/list.md). |

## Response

### 200 OK

| Field | Type | Description |
| - | - | - |
| `revoked` | `string[]` | IDs of your keys that are now revoked, newest first. A key you had already revoked still appears. Unknown IDs and other accounts' keys never do. A repeated ID appears once. |

```json theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/bash.json","/languages/csharp.json","/languages/go.json","/languages/java.json","/languages/javascript.json","/languages/kotlin.json","/languages/php.json","/languages/python.json","/languages/ruby.json","/languages/typescript.json"]}}
{ "revoked": ["42", "43"] }
```

### 400 Invalid input

`{ "error": "invalid_input", "message": "Send ids as a list of 1 to 10000 API key IDs." }`




`ids` was missing, empty, or longer than 100. Or it held a value that is not a numeric ID.
Xquik revokes nothing.

### 401 Unauthenticated

Missing, expired, or invalid dashboard session cookie.

### 429 Rate limited

Too many requests. Wait for the `Retry-After` header before retrying.

> [!WARNING]
>
> Revocation is **immediate and permanent**. Every request with a revoked key returns
> `401 Unauthenticated`. Create a new key if you need one. To stop keys for a while, pause them on
> the [API keys page](https://dashboard.xquik.com/en/api-keys) instead.

> [!NOTE]
>
> API key revocation requires a same-origin dashboard session. API keys and OAuth bearer tokens cannot
> revoke account keys.
>
> **Related.** [Revoke API Key](https://docs.xquik.com/api-reference/api-keys/revoke.md) · [List API Keys](https://docs.xquik.com/api-reference/api-keys/list.md) · [Create API Key](https://docs.xquik.com/api-reference/api-keys/create.md)

## Response examples

* **400** `{ "error": "invalid_input", "message": "Invalid input. Check the request body." }`
* **401** `{ "error": "unauthenticated", "message": "Authentication required. Provide a valid API key or bearer token." }`
* **403** `{ "error": "session_required", "message": "API keys & OAuth tokens cannot use this route. Sign in at dashboard.xquik.com/account instead." }`
* **429** `{ "error": "rate_limit_exceeded", "message": "Too many requests. Try again later.", "retryAfter": 60 }`


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