openapi: 3.1.0
info:
  title: Telegram Threat-Intelligence Feed
  version: "1.0.0"
  summary: Read-only feed of Telegram bots abused by malware.
  description: |
    **Base URL: `https://ti.mboll.eu`** — every REST endpoint lives under `/v1`,
    e.g. `https://ti.mboll.eu/v1/records`. Authenticate with the `X-API-Key` header;
    access and terms of use are explained in the [guide](https://www.mboll.eu/api/).

    ## Quick start

    ```bash
    curl -G "https://ti.mboll.eu/v1/records" \
      -H "X-API-Key: YOUR_API_KEY" \
      --data-urlencode 'filter=created >= @todayStart' \
      --data-urlencode 'sort=-created' \
      --data-urlencode 'perPage=100'
    ```

    ## Understanding the data

    Everything starts with an **observation**: a malware sample in which a bot token — and, where observed, a chat ID — is hard-coded. Around it the data is organised in entities:

    | Entity | Key | What it holds |
    |---|---|---|
    | **Sample** | `sha256` | first VirusTotal submission, malware family, sandbox link |
    | **Bot** | `bot_id` (number before `:` in the token) | current username, description, commands, webhook — stable even if the operator rotates the token |
    | **Token** | `token` | which bot it belongs to; **liveness re-checked daily** (alive / dead, first and last seen alive) |
    | **Chat** | `chat_id` | the exfiltration chat: type, title, description, admins incl. usernames, member count; **re-checked daily** |
    | **History** | `bot_id` / `chat_id` | changed webhooks, descriptions, titles, admins, chat migrations, … |

    A **token + chat** pair is an exfiltration **channel**: everything a sample sends via this token ends up in this chat. Samples, bots and chats repeat across observations, so treat the data as a **graph** (sample —uses→ token —exfiltrates-to→ chat), not a flat table:

    - **Sample ↔ Bot** — a sample may ship several tokens (fallback / rotation); a bot is reused across many builds and samples.
    - **Bot ↔ Chat** — operators funnel **many bots into one chat/channel**.
    - **Operator ↔ Bots** — the same creator (`admins`) runs many bots.

    The REST API offers both views: **`/v1/records`** — one row per observation with sample, bot and chat data merged in — and the entity endpoints `/v1/samples`, `/v1/bots`, `/v1/tokens`, `/v1/chats`, `/v1/bot-history`, `/v1/chat-history`, joined by the keys above. The [MISP feed](/api/misp/) groups everything per bot and channel.

    `private`, `bot_name` and `permissions` in `/v1/records` describe the token **at the time the sample was collected**; the current state of a token is in `/v1/tokens`.

    ## Pivoting and clustering

    The data ships **no pre-computed cluster label** — commodity malware is used by many independent operators, so automatic transitive clustering chains unrelated actors together. **Correlate locally** over the natural join keys; your own labels then stay stable across days:

    | Group by | Gives you |
    |---|---|
    | `malware_file_hash` / `sha256` | all bots a given sample used |
    | `bot_id` | all samples / builds using that bot, across token rotations |
    | `source_chat_id` / `chat_id` | bots sharing a drop channel → same operator / campaign |
    | `admins` (the `creator`) | operator attribution across bots |
    | `relay_account` | Cloudflare Worker relays run by the same account |
    | `webhook`, `menu_webapp_url`, `bot_description` | shared infrastructure, MaaS templates, seller handles, referral codes |

    Beware of **shared tokens**: some tokens appear in hundreds of samples across many malware families — builder defaults or leaked tokens used by independent actors. They are valid indicators, but not a basis for attribution (the MISP feed flags them as `shared-suspected`).

    Where an observation has been tied to a **public report or investigation** by a bot, chat or token match, the bot carries the report link(s) in `investigation_url` (several links separated by ` | `), and so does every record of that bot. Since 2026-12-03 `investigation_name` is no longer filled.

    ## Update schedule

    All times Europe/Berlin (UTC+1 in winter, UTC+2 in summer).

    | Time | What changes |
    |---|---|
    | **15:00 – ~00:45** | Main pipeline: new observations, malware families, bot / chat enrichment, sandbox links → `/v1/records` and all entity endpoints |
    | **~00:45 – ~03:30** | Token liveness re-check → `/v1/tokens` (status, last seen alive) |
    | **~03:00 – ~04:00** | Chat check → `/v1/chats`, `/v1/chat-history`, then MISP feed regenerated |

    - **Recommended pull window: 05:00 – 14:30** — the daily run is complete and all data, including token and chat status, reflects the same state. Token and chat status do not change in this window; only occasionally a few observations from relay analysis (~10:00) are added.
    - **Avoid pulling while the pipeline runs** (15:00 – ~04:00): observations exist before their enrichment is complete, and token / chat status is being updated.
    - **Pull incrementally:** remember the newest `created` value you have seen and request `filter=created > "<that value>"` with `sort=created`.

    ## Versioning

    Within `v1` the response format and field semantics stay stable — fields may be
    added, never silently changed; a breaking change would ship as `/v2` with an
    overlap period.

    **Legacy path retired:** the former path `/api/collections/Telegram/records` was
    switched off on 30 November 2026 and now answers `410 Gone` — use `/v1/records`.

    ## MISP feed

    The same data is available as a MISP feed under `/misp/` with the same key —
    setup guide and object template: [MISP feed](https://www.mboll.eu/api/misp/).

servers:
  - url: https://ti.mboll.eu
    description: Production (requires a valid X-API-Key)

security:
  - ApiKey: []

tags:
  - name: Records
    description: |
      The flat feed: one record per observed link between a malware sample, a bot
      token and (where observed) a chat, with sample, bot and chat data merged in.
  - name: Samples
    description: One entry per malware sample. Join key `sha256` (= `malware_file_hash` in records).
  - name: Bots
    description: |
      One entry per bot (current state). Join key `bot_id` — the number before the
      colon of a token; stable even if the operator rotates the token secret.
  - name: Tokens
    description: |
      One entry per token string, with liveness over time (re-checked daily).
      Join keys `token` (= `bot_token` in records) and `bot_id`.
  - name: Chats
    description: One entry per exfiltration chat (current state). Join key `chat_id` (= `source_chat_id` in records).
  - name: History
    description: |
      Changes over time. `bot-history` records replaced bot values (webhook,
      description, commands, username); `chat-history` records chat events (title,
      description, photo, pinned message, admins, migration, chat gone/restored).
      For events reconstructed from data collected before November 2026,
      `detected_at` is the last time the old value was seen.

  - name: MISP feed
    description: |
      Static files of the MISP feed (one event per bot), regenerated daily between about
      03:00 and 04:00 Europe/Berlin; fetch after 05:00. Configure it in MISP as feed type *MISP Feed* with the URL
      `https://ti.mboll.eu/misp` and the header `X-API-Key` — step-by-step guide:
      [MISP feed](https://www.mboll.eu/api/misp/). The feed files have their own,
      higher rate limit for the initial synchronisation.

paths:
  /v1/records:
    get:
      tags: [Records]
      operationId: listRecords
      summary: List / search records
      description: |
        Returns a paginated list of records. Combine `filter`, `sort` and `fields`
        to search and to keep responses small.
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/perPage"
        - $ref: "#/components/parameters/filter"
        - $ref: "#/components/parameters/sort"
        - $ref: "#/components/parameters/fields"
        - $ref: "#/components/parameters/skipTotal"
      responses:
        "200":
          description: A page of records
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecordList"
              examples:
                default:
                  $ref: "#/components/examples/RecordListExample"
        "400":
          $ref: "#/components/responses/BadRequest"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/TooManyRequests"

  /v1/records/{id}:
    get:
      tags: [Records]
      operationId: getRecord
      summary: Get a single record
      parameters:
        - name: id
          in: path
          required: true
          description: Record ID (15 characters, `[a-z0-9]`).
          schema:
            type: string
            pattern: "^[a-z0-9]{15}$"
          example: 6wt5fl4nyzq8n1u
        - $ref: "#/components/parameters/fields"
      responses:
        "200":
          description: The record
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Record"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          description: No record with this ID
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "429":
          $ref: "#/components/responses/TooManyRequests"

  /v1/samples:
    get:
      tags: [Samples]
      operationId: listSamples
      summary: List / search samples
      description: |
        Same paging, filter, sort and field-selection rules as `/v1/records`.

        Examples: `filter=sha256 = "e636c2bcfe5215b07ac6bbd83e8292c62fbf1e36354f57645278ddc040a15de7"` · `filter=families ~ "stealer"`
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/perPage"
        - $ref: "#/components/parameters/filterEntity"
        - $ref: "#/components/parameters/sort"
        - $ref: "#/components/parameters/fields"
        - $ref: "#/components/parameters/skipTotal"
      responses:
        "200":
          description: A page of samples
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Page"
                  - type: object
                    properties:
                      items:
                        type: array
                        items: { $ref: "#/components/schemas/Sample" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/TooManyRequests" }
  /v1/samples/{id}:
    get:
      tags: [Samples]
      operationId: getSamples
      summary: Get a single sample
      parameters:
        - name: id
          in: path
          required: true
          description: Entry ID (15 characters, `[a-z0-9]`) as returned in a list response.
          schema: { type: string, pattern: "^[a-z0-9]{15}$" }
        - $ref: "#/components/parameters/fields"
      responses:
        "200":
          description: The sample
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Sample" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { description: No entry with this ID }
        "429": { $ref: "#/components/responses/TooManyRequests" }

  /v1/bots:
    get:
      tags: [Bots]
      operationId: listBots
      summary: List / search bots
      description: |
        Same paging, filter, sort and field-selection rules as `/v1/records`.

        Examples: `filter=bot_id = "8122935411"` · `filter=webhook != ""`
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/perPage"
        - $ref: "#/components/parameters/filterEntity"
        - $ref: "#/components/parameters/sort"
        - $ref: "#/components/parameters/fields"
        - $ref: "#/components/parameters/skipTotal"
      responses:
        "200":
          description: A page of bots
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Page"
                  - type: object
                    properties:
                      items:
                        type: array
                        items: { $ref: "#/components/schemas/Bot" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/TooManyRequests" }
  /v1/bots/{id}:
    get:
      tags: [Bots]
      operationId: getBots
      summary: Get a single bot
      parameters:
        - name: id
          in: path
          required: true
          description: Entry ID (15 characters, `[a-z0-9]`) as returned in a list response.
          schema: { type: string, pattern: "^[a-z0-9]{15}$" }
        - $ref: "#/components/parameters/fields"
      responses:
        "200":
          description: The bot
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Bot" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { description: No entry with this ID }
        "429": { $ref: "#/components/responses/TooManyRequests" }

  /v1/tokens:
    get:
      tags: [Tokens]
      operationId: listTokens
      summary: List / search tokens
      description: |
        Same paging, filter, sort and field-selection rules as `/v1/records`.

        Examples: `filter=bot_id = "8122935411"` · `filter=status = "ok"`
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/perPage"
        - $ref: "#/components/parameters/filterEntity"
        - $ref: "#/components/parameters/sort"
        - $ref: "#/components/parameters/fields"
        - $ref: "#/components/parameters/skipTotal"
      responses:
        "200":
          description: A page of tokens
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Page"
                  - type: object
                    properties:
                      items:
                        type: array
                        items: { $ref: "#/components/schemas/Token" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/TooManyRequests" }
  /v1/tokens/{id}:
    get:
      tags: [Tokens]
      operationId: getTokens
      summary: Get a single token
      parameters:
        - name: id
          in: path
          required: true
          description: Entry ID (15 characters, `[a-z0-9]`) as returned in a list response.
          schema: { type: string, pattern: "^[a-z0-9]{15}$" }
        - $ref: "#/components/parameters/fields"
      responses:
        "200":
          description: The token
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Token" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { description: No entry with this ID }
        "429": { $ref: "#/components/responses/TooManyRequests" }

  /v1/chats:
    get:
      tags: [Chats]
      operationId: listChats
      summary: List / search chats
      description: |
        Same paging, filter, sort and field-selection rules as `/v1/records`.

        Examples: `filter=chat_id = "-1001614217318"` · `filter=admins ~ ":creator" && user_count > 10`
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/perPage"
        - $ref: "#/components/parameters/filterEntity"
        - $ref: "#/components/parameters/sort"
        - $ref: "#/components/parameters/fields"
        - $ref: "#/components/parameters/skipTotal"
      responses:
        "200":
          description: A page of chats
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Page"
                  - type: object
                    properties:
                      items:
                        type: array
                        items: { $ref: "#/components/schemas/Chat" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/TooManyRequests" }
  /v1/chats/{id}:
    get:
      tags: [Chats]
      operationId: getChats
      summary: Get a single chat
      parameters:
        - name: id
          in: path
          required: true
          description: Entry ID (15 characters, `[a-z0-9]`) as returned in a list response.
          schema: { type: string, pattern: "^[a-z0-9]{15}$" }
        - $ref: "#/components/parameters/fields"
      responses:
        "200":
          description: The chat
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Chat" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { description: No entry with this ID }
        "429": { $ref: "#/components/responses/TooManyRequests" }

  /v1/bot-history:
    get:
      tags: [History]
      operationId: listBotHistory
      summary: List / search bot history
      description: |
        Same paging, filter, sort and field-selection rules as `/v1/records`.

        Examples: `filter=bot_id = "6205694016"` · `filter=event_type = "webhook_changed"`
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/perPage"
        - $ref: "#/components/parameters/filterEntity"
        - $ref: "#/components/parameters/sort"
        - $ref: "#/components/parameters/fields"
        - $ref: "#/components/parameters/skipTotal"
      responses:
        "200":
          description: A page of bot history events
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Page"
                  - type: object
                    properties:
                      items:
                        type: array
                        items: { $ref: "#/components/schemas/BotHistoryEvent" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/TooManyRequests" }
  /v1/bot-history/{id}:
    get:
      tags: [History]
      operationId: getBotHistory
      summary: Get a single bot history event
      parameters:
        - name: id
          in: path
          required: true
          description: Entry ID (15 characters, `[a-z0-9]`) as returned in a list response.
          schema: { type: string, pattern: "^[a-z0-9]{15}$" }
        - $ref: "#/components/parameters/fields"
      responses:
        "200":
          description: The bot history event
          content:
            application/json:
              schema: { $ref: "#/components/schemas/BotHistoryEvent" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { description: No entry with this ID }
        "429": { $ref: "#/components/responses/TooManyRequests" }

  /v1/chat-history:
    get:
      tags: [History]
      operationId: listChatHistory
      summary: List / search chat history
      description: |
        Same paging, filter, sort and field-selection rules as `/v1/records`.

        Examples: `filter=chat_id = "-1001868255344"` · `filter=event_type = "chat_migrated"`
      parameters:
        - $ref: "#/components/parameters/page"
        - $ref: "#/components/parameters/perPage"
        - $ref: "#/components/parameters/filterEntity"
        - $ref: "#/components/parameters/sort"
        - $ref: "#/components/parameters/fields"
        - $ref: "#/components/parameters/skipTotal"
      responses:
        "200":
          description: A page of chat history events
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Page"
                  - type: object
                    properties:
                      items:
                        type: array
                        items: { $ref: "#/components/schemas/ChatHistoryEvent" }
        "400": { $ref: "#/components/responses/BadRequest" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "429": { $ref: "#/components/responses/TooManyRequests" }
  /v1/chat-history/{id}:
    get:
      tags: [History]
      operationId: getChatHistory
      summary: Get a single chat history event
      parameters:
        - name: id
          in: path
          required: true
          description: Entry ID (15 characters, `[a-z0-9]`) as returned in a list response.
          schema: { type: string, pattern: "^[a-z0-9]{15}$" }
        - $ref: "#/components/parameters/fields"
      responses:
        "200":
          description: The chat history event
          content:
            application/json:
              schema: { $ref: "#/components/schemas/ChatHistoryEvent" }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { description: No entry with this ID }
        "429": { $ref: "#/components/responses/TooManyRequests" }

  /misp/manifest.json:
    get:
      tags: [MISP feed]
      operationId: mispManifest
      summary: Feed manifest (index of all events)
      description: |
        MISP feed index: event UUID → info, date, tags and `timestamp`. MISP compares the
        timestamps and downloads only new or changed events.
      responses:
        "200": { description: Manifest, content: { application/json: { schema: { type: object } } } }
        "403": { $ref: "#/components/responses/Forbidden" }
  /misp/{uuid}.json:
    get:
      tags: [MISP feed]
      operationId: mispEvent
      summary: One MISP event (one Telegram bot)
      description: |
        Standard MISP event JSON with `telegram-bot` objects (one per channel = token + chat),
        `telegram-account` objects, the Bot API endpoint and the event report „Overview“.
        Removed items are delivered with `deleted: true` for 30 days.
      parameters:
        - name: uuid
          in: path
          required: true
          description: Event UUID from the manifest (stable per bot).
          schema: { type: string, format: uuid }
      responses:
        "200": { description: MISP event, content: { application/json: { schema: { type: object } } } }
        "403": { $ref: "#/components/responses/Forbidden" }
        "404": { description: No event with this UUID }
  /misp/hashes.csv:
    get:
      tags: [MISP feed]
      operationId: mispHashes
      summary: Value hashes for MISP feed caching
      description: "`md5(value),event-uuid` per line — used by MISP's feed cache for correlation without import."
      responses:
        "200": { description: CSV, content: { text/csv: { schema: { type: string } } } }
        "403": { $ref: "#/components/responses/Forbidden" }

components:
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: |
        Your personal API key. Missing or invalid key → `403`.
        Keys are per partner and must not be shared.

  parameters:
    page:
      name: page
      in: query
      description: Page number (1-based).
      schema: { type: integer, minimum: 1, default: 1 }
    perPage:
      name: perPage
      in: query
      description: Records per page. Values above 1000 are capped at 1000.
      schema: { type: integer, minimum: 1, maximum: 1000, default: 30 }
    filterEntity:
      name: filter
      in: query
      description: |
        Filter expression, same syntax as for `/v1/records` (quote string values,
        URL-encode the expression). See the endpoint description for examples.
      schema: { type: string }
    filter:
      name: filter
      in: query
      description: |
        Filter expression. **URL-encode it** (e.g. `curl -G --data-urlencode`).

        - Operators: `=` `!=` `>` `>=` `<` `<=` `~` (contains, case-insensitive)
          `!~` (does not contain)
        - Combine with `&&`, `||` and parentheses
        - **String values must be quoted**: `families ~ "asyncrat"` — unquoted
          values return `400`
        - Dates are UTC, format `"YYYY-MM-DD HH:MM:SS"`; macros `@now`,
          `@todayStart`, `@monthStart`, `@yearStart`
        - Rolling windows ("last 10 days") cannot be computed in the filter —
          compute the date on your side and pass it as an absolute value
      schema: { type: string }
      examples:
        today:
          summary: Records added to the feed today
          value: created >= @todayStart
        family:
          summary: One malware family
          value: families ~ "asyncrat"
        chat:
          summary: All bots exfiltrating to one chat (same operator)
          value: source_chat_id = "5283662956"
        live:
          summary: Tokens that were still valid when last validated
          value: private = false
        sample:
          summary: All bots used by one sample
          value: malware_file_hash = "e636c2bcfe5215b07ac6bbd83e8292c62fbf1e36354f57645278ddc040a15de7"
        incremental:
          summary: Incremental sync since your last pull
          value: created > "2026-11-09 00:00:00"
    sort:
      name: sort
      in: query
      description: |
        Comma-separated field names; prefix `-` for descending.
        Examples: `-created`, `first_seen`, `-first_seen,bot_name`.
      schema: { type: string }
      example: -created
    fields:
      name: fields
      in: query
      description: Comma-separated list of fields to return (keeps responses small).
      schema: { type: string }
      example: bot_name,bot_token,families,first_seen
    skipTotal:
      name: skipTotal
      in: query
      description: |
        If `true`, `totalItems` and `totalPages` are not computed (returned as `-1`)
        — noticeably faster for large paged exports.
      schema: { type: boolean, default: false }

  responses:
    BadRequest:
      description: Invalid filter or sort expression (most often an unquoted string value).
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Error" }
          example:
            status: 400
            message: Something went wrong while processing your request.
            data: {}
    Forbidden:
      description: |
        Missing or invalid `X-API-Key`, a method other than `GET`, or a path outside
        the documented endpoints. Plain-text body.
      content:
        text/plain:
          schema: { type: string }
          example: Forbidden - valid X-API-Key required (read-only Telegram feed)
    TooManyRequests:
      description: |
        Rate limit exceeded: **30 requests per minute per key**. Back off and retry
        after about 60 seconds. Higher limits are available on request.

  schemas:
    Error:
      type: object
      properties:
        status: { type: integer }
        message: { type: string }
        data: { type: object }

    RecordList:
      type: object
      required: [page, perPage, totalItems, totalPages, items]
      properties:
        page: { type: integer, example: 1 }
        perPage: { type: integer, example: 2 }
        totalItems:
          type: integer
          description: Total matching records (`-1` with `skipTotal=true`).
          example: 56942
        totalPages:
          type: integer
          description: Total pages (`-1` with `skipTotal=true`).
          example: 28471
        items:
          type: array
          items: { $ref: "#/components/schemas/Record" }

    Record:
      type: object
      description: |
        A feed record. Empty strings / `0` mean "not observed / not retrievable",
        not a real value.
      properties:
        id:
          type: string
          description: Record ID.
          example: 6wt5fl4nyzq8n1u
        collectionId:
          type: string
          description: Internal collection ID (constant).
        collectionName:
          type: string
          description: Always `Telegram`.
          example: Telegram

        bot_token:
          type: string
          description: |
            Observed bot API token, stored as `bot<bot_id>:<secret>`. The numeric
            `bot_id` before the colon is stable for a bot even if the operator
            rotates the secret — use it as the bot's join key.
          example: "bot8122935411:AAH…"
        bot_name:
          type: string
          description: |
            Bot username from `getMe`. **`PRIVATE_BOT` means the token was already
            invalid (HTTP 401) when we first validated it**, so no username could be
            retrieved.
          example: anuZSteel_bot
        private:
          type: boolean
          description: |
            **`true` = the token is dead / revoked**: Telegram answered `getMe` with
            HTTP 401 at validation time. `false` = the token was valid at that time.
            This is **not** the bot's privacy mode — that is in `permissions`.
        permissions:
          type: string
          description: |
            The bot's own `getMe` flags, verbatim:
            `can_read_all_group_messages=<true|false> can_join_groups=<true|false>`.
            `can_read_all_group_messages=true` means privacy mode is **off**.
            `unknown` when the token was already dead.
          example: can_read_all_group_messages=false can_join_groups=true
        api_methods:
          type: string
          description: |
            Space-separated Bot API methods the sample actually calls, e.g.
            `sendDocument sendMessage` — indicates exfiltration style / C2 capability.
          example: sendDocument sendMessage

        malware_file_hash:
          type: string
          description: SHA-256 of the malware sample containing the token.
          example: e636c2bcfe5215b07ac6bbd83e8292c62fbf1e36354f57645278ddc040a15de7
        first_seen:
          type: string
          format: date-time
          description: |
            First submission of the **sample** to VirusTotal (its age, UTC) — **not**
            the date we discovered it (that is `created`).
          example: "2025-05-10 20:58:16.000Z"
        families:
          type: string
          description: Suggested malware family label from VirusTotal, e.g. `trojan.msil/asyncrat`. Empty if VT has no consensus label.
          example: trojan.msil/asyncrat
        threat_categories:
          type: string
          description: Comma-separated VirusTotal threat categories, e.g. `trojan, stealer`.
          example: trojan
        triage:
          type: string
          description: |
            URL of a [tria.ge](https://tria.ge) analysis of this sample, matched by
            hash. Empty if the sample is not on tria.ge.
          example: https://tria.ge/260824-3lmc7szzdz

        source_chat_id:
          type: string
          description: |
            Chat / channel / user ID the bot exfiltrates to, as found in the sample
            (normalized). Empty if no chat ID was observed. It always stays the ID
            from the sample — if the group was later migrated to a supergroup, the
            chat metadata (`chat_name`, `admins`, …) reflects the current chat.
          example: "5283662956"
        source_chat_id_raw:
          type: string
          description: |
            Original chat-ID string from the sample **before** normalization (e.g.
            `5825611283%20`). Only set where normalization changed the value.
        chat_name:
          type: string
          description: Chat title (or first name for private chats) from `getChat`. Only where the bot could still query the chat.
        user_count:
          type: integer
          description: |
            Member count from `getChatMemberCount`. **`0` means "could not be
            retrieved"** (bot no longer in the chat, chat deleted, API error) — not
            zero members.
        admins:
          type: string
          description: |
            Space-separated `user_id:role` pairs from `getChatAdministrators`, e.g.
            `7862389560:administrator 6394819451:creator`. The `creator` ID is the
            strongest operator-attribution key.
          example: 7862389560:administrator 6394819451:creator
        pinned_message:
          type: string
          description: Text of the pinned message in the exfiltration chat, when retrievable. Often contains operator handles or service ads.
        commands:
          type: string
          description: Registered slash-commands from `getMyCommands` — often the C2 verb list of the malware panel.
          example: /start /logs /panel
        bot_description:
          type: string
          description: The bot's About text from `getMyDescription`. Often a service ad, seller handle or MaaS template.
        webhook:
          type: string
          description: |
            Delivery URL from `getWebhookInfo` if the bot uses webhook mode — a
            second piece of attacker infrastructure. Note that some are generic
            services (webhook.site, pipedream, bot builders).
        menu_webapp_url:
          type: string
          description: WebApp URL of the bot's menu button, when set — treat as an IOC.

        relay:
          type: string
          description: |
            Host name of a **Cloudflare Worker relay** the sample uses instead of
            calling `api.telegram.org` directly (e.g.
            `proxy.example.workers.dev`). Empty for direct connections.
          example: proxy.long7aa1.workers.dev
        relay_account:
          type: string
          description: Cloudflare Workers account sub-domain the relay belongs to (e.g. `long7aa1.workers.dev`) — groups relays of one operator.
          example: long7aa1.workers.dev

        investigation_name:
          type: string
          deprecated: true
          description: |
            Deprecated since 2026-12-03 and always empty. Use `investigation_url`.
          example: ""
        investigation_url:
          type: string
          description: |
            Link(s) to the public report(s) or investigation(s) about the **bot** of
            this record, separated by ` | ` if there is more than one. Stored per bot
            (see `/v1/bots`), so every sample of that bot carries it — including
            samples found later. Set only where a bot, chat or token match ties the
            bot to that report — never by malware family alone, and never for weekly
            roundups or IOC dumps. Empty for most records.
          example: https://www.group-ib.com/blog/heavygram-handala-hack-telegram-c2/

        created:
          type: string
          format: date-time
          description: When the record entered this feed (UTC). Use for incremental sync.
          example: "2026-11-10 17:22:48.510Z"
        updated:
          type: string
          format: date-time
          description: When the record was last changed (UTC) — enrichment runs update it.
          example: "2026-11-11 07:19:49.312Z"

    Page:
      type: object
      properties:
        page: { type: integer, example: 1 }
        perPage: { type: integer, example: 30 }
        totalItems: { type: integer, description: "Total matching entries (-1 with skipTotal=true)." }
        totalPages: { type: integer, description: "Total pages (-1 with skipTotal=true)." }

    Sample:
      type: object
      properties:
        id: { type: string, example: 8v2kq1x9zt4m0ab }
        sha256:
          type: string
          description: SHA-256 of the malware sample (= `malware_file_hash` in records).
          example: e636c2bcfe5215b07ac6bbd83e8292c62fbf1e36354f57645278ddc040a15de7
        first_seen:
          type: string
          format: date-time
          description: First submission to VirusTotal (sample age, UTC).
          example: "2025-05-10 20:58:16.000Z"
        families: { type: string, description: "VirusTotal suggested family label; empty if none.", example: trojan.msil/asyncrat }
        threat_categories: { type: string, description: "Comma-separated VirusTotal threat categories.", example: "trojan, stealer" }
        triage: { type: string, description: "tria.ge analysis of this sample (matched by hash); empty if none.", example: "https://tria.ge/260824-3lmc7szzdz" }
        created:
          type: string
          format: date-time
          description: When this entry was first added (UTC).
        updated:
          type: string
          format: date-time
          description: When this entry last changed (UTC).

    Bot:
      type: object
      properties:
        id: { type: string, example: q7t2m9x4k1zb3ce }
        bot_id:
          type: string
          description: Numeric bot ID (the part before `:` in the token). Stable across token rotation.
          example: "8122935411"
        bot_name: { type: string, description: "Current username (last successful getMe). Empty if no token of this bot was ever valid.", example: anuZSteel_bot }
        permissions: { type: string, description: "Current getMe flags, verbatim.", example: "can_read_all_group_messages=false can_join_groups=true" }
        bot_description: { type: string, description: "Current About text (getMyDescription)." }
        commands: { type: string, description: "Current slash-commands (getMyCommands).", example: "/start /logs" }
        webhook: { type: string, description: "Current webhook URL; empty = long-polling or removed. Earlier values are in bot-history." }
        menu_webapp_url: { type: string, description: "Current menu-button WebApp URL." }
        investigation_url:
          type: string
          description: Link(s) to public reports or investigations about this bot (bot, chat or token match only), separated by ` | `. Empty for most bots.
          example: https://www.group-ib.com/blog/heavygram-handala-hack-telegram-c2/
        created:
          type: string
          format: date-time
          description: When this entry was first added (UTC).
        updated:
          type: string
          format: date-time
          description: When this entry last changed (UTC).

    Token:
      type: object
      properties:
        id: { type: string, example: h3k9p2w7x0zq5ma }
        token: { type: string, description: "Token as observed, `bot<bot_id>:<secret>` (= `bot_token` in records).", example: "bot8122935411:AAH…" }
        bot_id: { type: string, description: "Bot this token belongs to.", example: "8122935411" }
        status:
          type: string
          enum: [unknown, ok, unauthorized, not_found, rate_limited, error]
          description: |
            Result of the latest getMe check (re-checked daily). `ok` = token valid,
            `unauthorized` / `not_found` = token dead or revoked.
        first_checked_alive: { type: string, format: date-time, description: "First check that found the token valid." }
        last_checked_alive: { type: string, format: date-time, description: "Last check that found the token valid." }
        first_checked_dead: { type: string, format: date-time, description: "First check that found the token dead (empty if never)." }
        last_checked: { type: string, format: date-time, description: "Latest check of any result." }
        checks_total: { type: integer, description: "Number of checks so far." }
        checks_alive: { type: integer, description: "Number of checks that found the token valid." }
        created:
          type: string
          format: date-time
          description: When this entry was first added (UTC).
        updated:
          type: string
          format: date-time
          description: When this entry last changed (UTC).

    Chat:
      type: object
      properties:
        id: { type: string, example: c4n8r1v6y2xq0tb }
        chat_id: { type: string, description: "Telegram chat ID (= `source_chat_id` in records).", example: "-1001614217318" }
        chat_type: { type: string, enum: [unknown, private, group, supergroup, channel] }
        chat_name: { type: string, description: "Current title (first name for private chats).", example: MeteorStealerTeam }
        chat_description: { type: string, description: "Current chat description / bio." }
        pinned_message: { type: string, description: "Current pinned message text." }
        admins: { type: string, description: "Current admins as `user_id:role` pairs.", example: "1965881969:creator" }
        admins_detail:
          type: [array, "null"]
          description: Current admins with Telegram profile data (null if never retrieved).
          items:
            type: object
            properties:
              user_id: { type: integer, example: 1965881969 }
              role: { type: string, enum: [creator, administrator] }
              username: { type: [string, "null"], example: nocta221 }
              first_name: { type: [string, "null"] }
              last_name: { type: [string, "null"] }
              is_bot: { type: boolean }
        user_count: { type: integer, description: "Member count; 0 = could not be retrieved." }
        last_status:
          type: string
          enum: [unknown, ok, chat_gone, forbidden, unauthorized, error, invalid_format]
          description: Result of the latest daily chat check.
        last_checked: { type: string, format: date-time, description: "Latest chat check." }
        last_diff_at: { type: string, format: date-time, description: "Latest check that detected a change." }
        created:
          type: string
          format: date-time
          description: When this entry was first added (UTC).
        updated:
          type: string
          format: date-time
          description: When this entry last changed (UTC).

    BotHistoryEvent:
      type: object
      properties:
        id: { type: string }
        bot_id: { type: string, example: "8122935411" }
        event_type: { type: string, enum: [username_changed, description_changed, commands_changed, webhook_changed, menu_url_changed] }
        old_value: { type: string, description: "Value before the change.", example: "https://perehodnik.click/managed/4e30…" }
        new_value: { type: string, description: "Value after the change (empty = removed).", example: "https://factorkz.com/managed/4e30…" }
        detected_at: { type: string, format: date-time, description: "When the change was detected (UTC)." }

    ChatHistoryEvent:
      type: object
      properties:
        id: { type: string }
        chat_id: { type: string, example: "-1001614217318" }
        event_type:
          type: string
          enum: [title_changed, description_changed, photo_changed, pinned_changed, admins_changed,
                 admin_added, admin_removed, admin_role_changed, chat_migrated, chat_rotated,
                 chat_gone, chat_restored]
        user_id: { type: string, description: "Affected user for admin_added / admin_removed / admin_role_changed." }
        old_value: { type: string, description: "Value before (for chat_migrated: the old chat ID)." }
        new_value: { type: string, description: "Value after (for chat_migrated: the new supergroup ID)." }
        detected_at: { type: string, format: date-time, description: "When the event was detected (UTC)." }

  examples:
    RecordListExample:
      value:
        page: 1
        perPage: 1
        totalItems: 56942
        totalPages: 56942
        items:
          - id: 6wt5fl4nyzq8n1u
            collectionName: Telegram
            bot_token: "bot8122935411:AAH…"
            bot_name: anuZSteel_bot
            private: false
            permissions: can_read_all_group_messages=false can_join_groups=true
            api_methods: sendDocument sendMessage
            malware_file_hash: "…"
            first_seen: "2025-05-10 20:58:16.000Z"
            families: trojan.msil/asyncrat
            threat_categories: trojan
            source_chat_id: "6835822112"
            user_count: 0
            created: "2025-12-03 08:23:00.696Z"
            updated: "2026-10-27 17:34:07.394Z"
