> ## Documentation Index
> Fetch the complete documentation index at: https://www.dropfans.io/developers/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api/external/v1/chat-gate/check — Check a private message

> Call it for every private message to an account whose chatbot is your bot, and with `from: "account"` for messages written from the account.

- Source: https://www.dropfans.io/developers/reference/check-chat-message
- Section: API reference
- OpenAPI: https://www.dropfans.io/developers/openapi.json

Also served at `/api/external/chat-gate/check` (the unversioned alias).

Call it for every private message to an account whose chatbot is your bot, and with `from: "account"` for messages written from the account.

On `action: "ask"` send `ask.text` with `ask.replyMarkup` (plain text, no `parse_mode`) through the business connection, pin it silently, unpin `ask.unpinMessageId` and report the sent message to [POST /chat-gate/asks/{id}](https://www.dropfans.io/developers/reference/report-chat-ask.md). The ask is already claimed: until you report it failed, the fan isn’t asked again for 12 hours.

`locked` says the fan would have to pay: keep automated replies out of the chat. On a timeout or 5xx, let the message stand. See [Pay to Chat from your own chatbot](https://www.dropfans.io/developers/guides/pay-to-chat.md).

Send `service: true` for service messages (something was pinned, the history was cleared): Telegram shows your own pin as a message from the account, and without the flag it would silence the gate for 12 hours. `dryRun: true` decides without changing anything, for comparing our answer with a gate you already run.

## Authentication

`Authorization: Bearer dpfn_...` — an API key generated in the dashboard (Vault → API Connect). By default the key acts for the one account it belongs to. Missing or invalid keys return 401 `{"error":"Unauthorized","code":"unauthorized"}`.

**For a creator you manage or onboarded:** `POST /api/external/v1/creators/{creatorId}/chat-gate/check` — with a verified agency's own key for a creator or AI persona it manages, or your app owner's own key for an account your app onboarded (ids from GET /api/external/v1/creators); for a managed creator the agency needs `canManageDrops`. The response echoes the account acted on in `X-Dropfans-Account`. Sending `X-Dropfans-Account: <account id>` on the plain path still works but is deprecated.

## Request body (application/json)

| Field | Type | Required | Description |
|---|---|---|---|
| `account` | string | yes | Telegram user id of the creator’s account (the business connection’s `user.id`). |
| `fan` | string | yes | Telegram user id of the fan (the private chat’s id). |
| `from` | `fan` \\| `account` |  | `account` for a message written from the account itself: nobody is asked in that chat for 12 hours. |
| `service` | boolean |  | A service message (a pin notice and the like), whoever it is from: never asks and never counts as the account writing. `reason` is `service`. |
| `dryRun` | boolean |  | Decide only: no ask is claimed, nothing is stamped, and `ask` is null even when `action` is `ask`. The response carries `dryRun: true`. |
| `languageCode` | string |  | The fan’s Telegram `language_code`, for the ask’s language. |
| `offline` | boolean |  | An away, greeting or scheduled message (`is_from_offline`): not someone talking. |
| `quiet` | boolean |  | A person has this chat: never ask (locked is still reported). |
| `accountName` | string |  | The account’s first name for the ask; defaults to the one you reported. |

Example — A fan writes:

```json
{
  "account": "5550001111",
  "fan": "48213377",
  "from": "fan",
  "languageCode": "en"
}
```

## Responses

### 200

What to do.

| Field | Type | Required | Description |
|---|---|---|---|
| `dryRun` | boolean |  | Only on a dry run: true. |
| `mode` | `EVERYONE` \\| `PAY` \\| `SUB` | yes | Who may chat: everyone, fans who paid (tip or drop) or subscribed, or subscribers only. |
| `payScope` | `ONCE` \\| `PER_CONVERSATION` | yes | Pay to Chat: `ONCE` = paid once, open for good; `PER_CONVERSATION` = a conversation can be ended and the fan pays again. |
| `source` | `account` \\| `creator` | yes | `account`: that Telegram account has its own setting; `creator`: the creator’s applies. |
| `status` | `open` \\| `team` \\| `exempt` \\| `subscribed` \\| `paid` \\| `opened` \\| `locked` | yes | `open` the gate is off; `team` the creator, their agency or Dropfans staff; `exempt` on the Accept for list; `subscribed` / `paid` let in by money; `opened` an app opened the chat itself ([POST /chat-gate/fans/open](https://www.dropfans.io/developers/reference/open-chats.md)); `locked` would be asked. |
| `locked` | boolean | yes | The fan would have to pay: keep automated replies out. |
| `action` | `none` \\| `ask` | yes | Send the ask, or nothing. |
| `reason` | `asked` \\| `mode_off` \\| `no_subscription_on_sale` \\| `not_locked` \\| `account_wrote` \\| `self` \\| `service` \\| `quiet` \\| `creator_talking` \\| `asked_recently` \\| `no_username` | yes | Why. |
| `ask` | object \\| null | yes | Set on `action: "ask"`, except on a dry run. |
| `ask.id` | string | yes | Report the sent ask by it. |
| `ask.text` | string | yes | Send as plain text. |
| `ask.replyMarkup` | object | yes | A Bot API `InlineKeyboardMarkup` with URL buttons into the Dropfans Mini App. |
| `ask.pin` | boolean | yes | Always true: pin it silently. |
| `ask.unpinMessageId` | integer \\| null | yes | The earlier ask pinned in this chat: unpin it. |
| `ask.locale` | string | yes | The language the ask is in. |

```json
{
  "mode": "PAY",
  "payScope": "ONCE",
  "source": "creator",
  "status": "locked",
  "locked": true,
  "action": "ask",
  "reason": "asked",
  "ask": {
    "id": "ask_3f2a9c1d0b8e7f6a5c4d3e2f",
    "text": "❌ Mia has Pay to Chat turned on. Send a tip of any amount to start a conversation and they'll be notified right away 💬",
    "replyMarkup": {
      "inline_keyboard": [
        [
          {
            "text": "💵 Send a tip",
            "url": "https://t.me/DropfansBot/app?startapp=t_mia"
          }
        ]
      ]
    },
    "pin": true,
    "unpinMessageId": null,
    "locale": "en"
  }
}
```

## Errors

| Status | Body | When |
|---|---|---|
| 400 | `{"error":"account must be a Telegram user id (digits, as a string)","code":"invalid_telegram_id"}` | `account` is missing or not a Telegram user id. |
| 400 | `{"error":"fan must be a Telegram user id (digits, as a string)","code":"invalid_telegram_id"}` | `fan` is missing or not a Telegram user id. |
| 400 | `{"error":"from must be 'fan' or 'account'","code":"invalid_request"}` | A bad `from`. |
| 401 | `{"error":"Unauthorized","code":"unauthorized"}` | Missing or invalid API key. |
| 403 | `{"error":"This endpoint needs a key bound to an app with the chat_gate API category enabled — personal keys cannot use it.","code":"app_key_required","category":"chat_gate"}` | A personal key: the chat gate answers back through app webhooks. |
| 409 | `{"error":"The chat gate is for creator accounts.","code":"not_a_creator"}` | The account is a fan account, suspended or banned. |
| 503 | `{"error":"The chat gate is not available right now. Let the message through.","code":"unavailable"}` | Something failed on our side. Fail open: let the message stand. |
| 400 | `{"error":"X-Dropfans-Account must be an account id (from GET /api/external/agency/creators), not a username.","code":"invalid_account_header"}` | `X-Dropfans-Account` is not an account id. |
| 400 | `{"error":"X-Dropfans-Account names a different account than the path — send one or the other.","code":"account_mismatch"}` | Called under /v1/creators/{creatorId}/ with an `X-Dropfans-Account` naming another account. |
| 403 | `{"error":"This key cannot act for that account.","code":"account_not_managed"}` | The creator in the path (or `X-Dropfans-Account`) is one this key cannot act for: no ACCEPTED management by your agency and not an account your app onboarded (or it no longer holds a key bound to your app), a key minted for one creator, or someone is suspended, banned or deleted. An unknown id gets the same answer. |
| 403 | `{"error":"The agency does not have permission for this on that account.","code":"permission_denied","permission":"canManageDrops"}` | For a managed creator: the agency lacks `canManageDrops` on that account. |
| 403 | `{"error":"This app does not have the chat_gate API category enabled. Contact support to enable it.","code":"api_category_disabled","category":"chat_gate"}` | Your app has the Pay to Chat [API category](https://www.dropfans.io/developers/concepts/api-categories.md) switched off (the default for new apps). |

## Rate limiting

Per-key fixed windows by tier (Personal 60/min · 5,000/day; approved apps 300/min · 50,000/day; Dropfans-operated integrations exempt). Read the live values from X-RateLimit-Tier, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset and their -Day variants; a 429 carries Retry-After and `{"error":"Rate limit exceeded","code":"rate_limited"}`. See [Rate limits](https://www.dropfans.io/developers/concepts/rate-limits.md).

## Code samples

### curl

```bash
curl -X POST "https://www.dropfans.io/api/external/v1/chat-gate/check" \
  -H "Authorization: Bearer $DROPFANS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "account": "5550001111",
  "fan": "48213377",
  "from": "fan",
  "languageCode": "en"
}'
```

### Node

```javascript
const res = await fetch(`https://www.dropfans.io/api/external/v1/chat-gate/check`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "account": "5550001111",
    "fan": "48213377",
    "from": "fan",
    "languageCode": "en"
  }),
});
console.log(await res.json());
```

### Python

```python
import os
import requests

res = requests.post(
    "https://www.dropfans.io/api/external/v1/chat-gate/check",
    headers={"Authorization": f"Bearer {os.environ['DROPFANS_API_KEY']}"},
    json={
        "account": "5550001111",
        "fan": "48213377",
        "from": "fan",
        "languageCode": "en",
    },
)
print(res.json())
```

## OpenAPI

```json
{
  "method": "POST",
  "path": "/api/external/v1/chat-gate/check",
  "operationId": "checkChatMessage",
  "tags": [
    "chatgate"
  ],
  "summary": "Check a private message",
  "description": "Call it for every private message to an account whose chatbot is your bot, and with `from: \"account\"` for messages written from the account.\n\nOn `action: \"ask\"` send `ask.text` with `ask.replyMarkup` (plain text, no `parse_mode`) through the business connection, pin it silently, unpin `ask.unpinMessageId` and report the sent message to [POST /chat-gate/asks/{id}](https://www.dropfans.io/developers/reference/report-chat-ask.md). The ask is already claimed: until you report it failed, the fan isn’t asked again for 12 hours.\n\n`locked` says the fan would have to pay: keep automated replies out of the chat. On a timeout or 5xx, let the message stand. See [Pay to Chat from your own chatbot](https://www.dropfans.io/developers/guides/pay-to-chat.md).\n\nSend `service: true` for service messages (something was pinned, the history was cleared): Telegram shows your own pin as a message from the account, and without the flag it would silence the gate for 12 hours. `dryRun: true` decides without changing anything, for comparing our answer with a gate you already run.",
  "parameters": [
    {
      "name": "X-Dropfans-Account",
      "in": "header",
      "required": false,
      "deprecated": true,
      "description": "Deprecated: call the …ForCreator operation (/api/external/v1/creators/{creatorId}/…) instead; the header keeps working and such responses carry Deprecation and Link: rel=\"successor-version\". With a verified agency’s own key, the id of a creator or AI persona the agency manages (from GET /api/external/v1/agency/creators): the request then acts as that account, exactly as if it were sent with that account’s own key. Account ids only — usernames are refused (400 invalid_account_header). Checked on every request: the management must be ACCEPTED, nobody may be suspended, banned or deleted (else 403 account_not_managed), and the agency needs the endpoint’s permission on that account (else 403 permission_denied). Omit it to act as the key’s own account.",
      "schema": {
        "type": "string",
        "pattern": "^c[a-z0-9]{20,32}$"
      },
      "example": "cmh4v2q8k0003xy9z7w6v5u4t"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "account": {
              "type": "string",
              "description": "Telegram user id of the creator’s account (the business connection’s `user.id`).",
              "example": "5550001111"
            },
            "fan": {
              "type": "string",
              "description": "Telegram user id of the fan (the private chat’s id).",
              "example": "48213377"
            },
            "from": {
              "type": "string",
              "description": "`account` for a message written from the account itself: nobody is asked in that chat for 12 hours.",
              "enum": [
                "fan",
                "account"
              ],
              "default": "fan"
            },
            "service": {
              "type": "boolean",
              "description": "A service message (a pin notice and the like), whoever it is from: never asks and never counts as the account writing. `reason` is `service`."
            },
            "dryRun": {
              "type": "boolean",
              "description": "Decide only: no ask is claimed, nothing is stamped, and `ask` is null even when `action` is `ask`. The response carries `dryRun: true`."
            },
            "languageCode": {
              "type": "string",
              "description": "The fan’s Telegram `language_code`, for the ask’s language.",
              "example": "en"
            },
            "offline": {
              "type": "boolean",
              "description": "An away, greeting or scheduled message (`is_from_offline`): not someone talking."
            },
            "quiet": {
              "type": "boolean",
              "description": "A person has this chat: never ask (locked is still reported)."
            },
            "accountName": {
              "type": "string",
              "description": "The account’s first name for the ask; defaults to the one you reported."
            }
          },
          "required": [
            "account",
            "fan"
          ]
        },
        "examples": {
          "fanWrites": {
            "summary": "A fan writes",
            "value": {
              "account": "5550001111",
              "fan": "48213377",
              "from": "fan",
              "languageCode": "en"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "What to do.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-Dropfans-Account": {
          "description": "The id of the account this request acted on — the key’s own account, or the managed account named in the X-Dropfans-Account request header. Assert it when acting for several accounts.",
          "schema": {
            "type": "string"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "dryRun": {
                "type": "boolean",
                "description": "Only on a dry run: true."
              },
              "mode": {
                "type": "string",
                "description": "Who may chat: everyone, fans who paid (tip or drop) or subscribed, or subscribers only.",
                "enum": [
                  "EVERYONE",
                  "PAY",
                  "SUB"
                ]
              },
              "payScope": {
                "type": "string",
                "description": "Pay to Chat: `ONCE` = paid once, open for good; `PER_CONVERSATION` = a conversation can be ended and the fan pays again.",
                "enum": [
                  "ONCE",
                  "PER_CONVERSATION"
                ]
              },
              "source": {
                "type": "string",
                "description": "`account`: that Telegram account has its own setting; `creator`: the creator’s applies.",
                "enum": [
                  "account",
                  "creator"
                ]
              },
              "status": {
                "type": "string",
                "description": "`open` the gate is off; `team` the creator, their agency or Dropfans staff; `exempt` on the Accept for list; `subscribed` / `paid` let in by money; `opened` an app opened the chat itself ([POST /chat-gate/fans/open](https://www.dropfans.io/developers/reference/open-chats.md)); `locked` would be asked.",
                "enum": [
                  "open",
                  "team",
                  "exempt",
                  "subscribed",
                  "paid",
                  "opened",
                  "locked"
                ]
              },
              "locked": {
                "type": "boolean",
                "description": "The fan would have to pay: keep automated replies out."
              },
              "action": {
                "type": "string",
                "description": "Send the ask, or nothing.",
                "enum": [
                  "none",
                  "ask"
                ]
              },
              "reason": {
                "type": "string",
                "description": "Why.",
                "enum": [
                  "asked",
                  "mode_off",
                  "no_subscription_on_sale",
                  "not_locked",
                  "account_wrote",
                  "self",
                  "service",
                  "quiet",
                  "creator_talking",
                  "asked_recently",
                  "no_username"
                ]
              },
              "ask": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Report the sent ask by it."
                  },
                  "text": {
                    "type": "string",
                    "description": "Send as plain text."
                  },
                  "replyMarkup": {
                    "type": "object",
                    "description": "A Bot API `InlineKeyboardMarkup` with URL buttons into the Dropfans Mini App."
                  },
                  "pin": {
                    "type": "boolean",
                    "description": "Always true: pin it silently."
                  },
                  "unpinMessageId": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "description": "The earlier ask pinned in this chat: unpin it."
                  },
                  "locale": {
                    "type": "string",
                    "description": "The language the ask is in."
                  }
                },
                "required": [
                  "id",
                  "text",
                  "replyMarkup",
                  "pin",
                  "unpinMessageId",
                  "locale"
                ],
                "description": "Set on `action: \"ask\"`, except on a dry run."
              }
            },
            "required": [
              "mode",
              "payScope",
              "source",
              "status",
              "locked",
              "action",
              "reason",
              "ask"
            ]
          },
          "example": {
            "mode": "PAY",
            "payScope": "ONCE",
            "source": "creator",
            "status": "locked",
            "locked": true,
            "action": "ask",
            "reason": "asked",
            "ask": {
              "id": "ask_3f2a9c1d0b8e7f6a5c4d3e2f",
              "text": "❌ Mia has Pay to Chat turned on. Send a tip of any amount to start a conversation and they'll be notified right away 💬",
              "replyMarkup": {
                "inline_keyboard": [
                  [
                    {
                      "text": "💵 Send a tip",
                      "url": "https://t.me/DropfansBot/app?startapp=t_mia"
                    }
                  ]
                ]
              },
              "pin": true,
              "unpinMessageId": null,
              "locale": "en"
            }
          }
        }
      }
    },
    "400": {
      "description": "`account` is missing or not a Telegram user id. Also: `fan` is missing or not a Telegram user id. Also: A bad `from`. Also: `X-Dropfans-Account` is not an account id. Also: Called under /v1/creators/{creatorId}/ with an `X-Dropfans-Account` naming another account.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, api_category_disabled, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "account must be a Telegram user id (digits, as a string)",
            "code": "invalid_telegram_id"
          }
        }
      }
    },
    "401": {
      "description": "Missing or invalid API key.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, api_category_disabled, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Unauthorized",
            "code": "unauthorized"
          }
        }
      }
    },
    "403": {
      "description": "A personal key: the chat gate answers back through app webhooks. Also: The creator in the path (or `X-Dropfans-Account`) is one this key cannot act for: no ACCEPTED management by your agency and not an account your app onboarded (or it no longer holds a key bound to your app), a key minted for one creator, or someone is suspended, banned or deleted. An unknown id gets the same answer. Also: For a managed creator: the agency lacks `canManageDrops` on that account. Also: Your app has the Pay to Chat [API category](https://www.dropfans.io/developers/concepts/api-categories.md) switched off (the default for new apps).",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, api_category_disabled, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "This endpoint needs a key bound to an app with the chat_gate API category enabled — personal keys cannot use it.",
            "code": "app_key_required",
            "category": "chat_gate"
          }
        }
      }
    },
    "409": {
      "description": "The account is a fan account, suspended or banned.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, api_category_disabled, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "The chat gate is for creator accounts.",
            "code": "not_a_creator"
          }
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded for the current minute or day window. Wait Retry-After seconds and retry.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "Retry-After": {
          "description": "Seconds to wait before retrying (sent with 429s).",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, api_category_disabled, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "Rate limit exceeded",
            "code": "rate_limited"
          }
        }
      }
    },
    "503": {
      "description": "Something failed on our side. Fail open: let the message stand.",
      "headers": {
        "X-RateLimit-Tier": {
          "description": "Rate-limit tier of the key: personal, app or first_party (first_party is unlimited).",
          "schema": {
            "type": "string",
            "enum": [
              "personal",
              "app",
              "first_party"
            ]
          }
        },
        "X-RateLimit-Limit": {
          "description": "Requests allowed per minute for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining": {
          "description": "Requests left in the current minute window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset": {
          "description": "Epoch seconds when the minute window resets.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Limit-Day": {
          "description": "Requests allowed per UTC day for this key (absent on first_party).",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Remaining-Day": {
          "description": "Requests left in the current UTC day window.",
          "schema": {
            "type": "integer"
          }
        },
        "X-RateLimit-Reset-Day": {
          "description": "Epoch seconds when the day window resets.",
          "schema": {
            "type": "integer"
          }
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "Human-readable message.",
                "example": "Rate limit exceeded"
              },
              "code": {
                "type": "string",
                "description": "Machine-readable code: unauthorized, app_suspended, first_party_only, api_category_disabled, rate_limited, username_required, invalid_account_header, account_not_managed, permission_denied, account_header_not_allowed, agency_key_required — plus endpoint-specific codes listed on each reference page.",
                "example": "rate_limited"
              }
            },
            "required": [
              "error",
              "code"
            ]
          },
          "example": {
            "error": "The chat gate is not available right now. Let the message through.",
            "code": "unavailable"
          }
        }
      }
    }
  },
  "x-codeSamples": [
    {
      "lang": "cURL",
      "label": "curl",
      "source": "curl -X POST \"https://www.dropfans.io/api/external/v1/chat-gate/check\" \\\n  -H \"Authorization: Bearer $DROPFANS_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"account\": \"5550001111\",\n  \"fan\": \"48213377\",\n  \"from\": \"fan\",\n  \"languageCode\": \"en\"\n}'"
    },
    {
      "lang": "JavaScript",
      "label": "Node",
      "source": "const res = await fetch(`https://www.dropfans.io/api/external/v1/chat-gate/check`, {\n  method: 'POST',\n  headers: {\n    Authorization: `Bearer ${process.env.DROPFANS_API_KEY}`,\n    'Content-Type': 'application/json',\n  },\n  body: JSON.stringify({\n    \"account\": \"5550001111\",\n    \"fan\": \"48213377\",\n    \"from\": \"fan\",\n    \"languageCode\": \"en\"\n  }),\n});\nconsole.log(await res.json());"
    },
    {
      "lang": "Python",
      "source": "import os\nimport requests\n\nres = requests.post(\n    \"https://www.dropfans.io/api/external/v1/chat-gate/check\",\n    headers={\"Authorization\": f\"Bearer {os.environ['DROPFANS_API_KEY']}\"},\n    json={\n        \"account\": \"5550001111\",\n        \"fan\": \"48213377\",\n        \"from\": \"fan\",\n        \"languageCode\": \"en\",\n    },\n)\nprint(res.json())"
    }
  ],
  "x-dropfans-docs": "https://www.dropfans.io/developers/reference/check-chat-message",
  "x-dropfans-category": "chat_gate",
  "x-dropfans-agency-permission": "canManageDrops"
}
```

---

Previous: [Report your bot as an account’s chatbot](https://www.dropfans.io/developers/reference/report-chatbot.md) · Next: [Report an ask as sent or failed](https://www.dropfans.io/developers/reference/report-chat-ask.md) · All pages: [llms.txt](https://www.dropfans.io/developers/llms.txt)
