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

# Create Stream Monitor

> Create a new stream monitor to track one or more Twitter accounts in real time. New tweets from monitored accounts are delivered via WebSocket and optionally via webhook. Each monitored account consumes credits per day based on volume pricing.



## OpenAPI

````yaml post /v1/twitter/stream/monitors
openapi: 3.1.0
info:
  title: ScrapeBadger Twitter API
  description: >-
    The ScrapeBadger Twitter API provides programmatic access to Twitter/X data
    through a simple REST interface. Retrieve tweets, user profiles, followers,
    lists, communities, trends, and geographic data — all with a single API key.


    All endpoints require authentication via the `x-api-key` header. Each
    request consumes credits from your account balance. Paginated endpoints
    return a `next_cursor` field that you can pass to subsequent requests to
    retrieve additional pages of results.


    **Base URL:** `https://scrapebadger.com/v1/twitter`


    **Rate Limits:** Requests are rate-limited per API key. If you exceed your
    limit, you will receive a `429` response. Implement exponential backoff and
    retry logic for production use.


    **Credits:** Each successful API call deducts credits from your balance. If
    your balance reaches zero, subsequent requests will return `402 Payment
    Required`.
  version: 1.0.0
  contact:
    name: ScrapeBadger Support
    url: https://scrapebadger.com
    email: support@scrapebadger.com
servers:
  - url: https://scrapebadger.com
    description: Production
security:
  - apiKey: []
tags:
  - name: Tweets
    description: >-
      Retrieve tweets, search tweets, and access tweet metadata including
      replies, quotes, retweeters, favoriters, edit history, and community
      notes.
  - name: Users
    description: >-
      Retrieve user profiles, followers, following lists, mentions,
      subscriptions, and search for users.
  - name: Lists
    description: Access Twitter list details, list tweets, and search within lists.
  - name: Communities
    description: Retrieve community details, community tweets, and search for communities.
  - name: Trends
    description: Get trending topics globally or by location.
  - name: Geo
    description: Search for geographic places and retrieve place details.
  - name: Spaces
    description: Access Twitter Spaces and live broadcast details.
  - name: Stream Monitors
    description: >-
      Create and manage real-time stream monitors that track Twitter accounts
      and deliver new tweets via WebSocket or webhook.
  - name: Stream Webhooks
    description: >-
      Manage webhook endpoints for stream monitor delivery. Webhooks receive
      HMAC-SHA256 signed payloads when new tweets are detected.
  - name: Stream Logs
    description: >-
      Access delivery logs and billing logs for stream monitors. Track tweet
      detection latency, webhook delivery status, and credit consumption.
  - name: Filter Rules
    description: >-
      Create and manage filter rules that monitor Twitter using Advanced Search
      queries at configurable intervals. Delivered via WebSocket or webhook.
paths:
  /v1/twitter/stream/monitors:
    post:
      tags:
        - Stream Monitors
      summary: Create stream monitor
      description: >-
        Create a new stream monitor to track one or more Twitter accounts in
        real time. New tweets from monitored accounts are delivered via
        WebSocket and optionally via webhook. Each monitored account consumes
        credits per day based on volume pricing.
      operationId: createStreamMonitor
      requestBody:
        required: true
        description: Stream monitor configuration.
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - usernames
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: Human-readable name for the stream monitor.
                  example: Tech Leaders Monitor
                usernames:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  maxItems: 100
                  description: List of Twitter usernames to monitor (without @ symbol).
                  example:
                    - elonmusk
                    - sama
                webhook_url:
                  type:
                    - string
                    - 'null'
                  description: HTTPS URL to receive webhook deliveries. Must use HTTPS.
                  example: https://example.com/webhooks/twitter
                webhook_secret:
                  type:
                    - string
                    - 'null'
                  description: Secret used to sign webhook payloads with HMAC-SHA256.
                filter_types:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
                    enum:
                      - original
                      - reply
                      - retweet
                      - quote
                  description: >-
                    Filter which tweet types to deliver. Null or omitted means
                    all types.
      responses:
        '201':
          description: Stream monitor created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StreamMonitorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
components:
  schemas:
    StreamMonitorResponse:
      type: object
      description: Stream monitor configuration and status.
      required:
        - id
        - name
        - usernames
        - status
        - created_at
        - updated_at
      properties:
        id:
          type: string
          description: Unique stream monitor identifier.
        name:
          type: string
          description: Human-readable name of the monitor.
          example: Tech Leaders Monitor
        usernames:
          type: array
          items:
            type: string
          description: List of monitored Twitter usernames.
          example:
            - elonmusk
            - sama
        status:
          type: string
          enum:
            - active
            - paused
            - suspended
          description: >-
            Current status of the monitor. Suspended indicates the monitor was
            auto-paused due to insufficient credits.
        status_reason:
          type:
            - string
            - 'null'
          description: >-
            Reason for the current status, if applicable (e.g.,
            "insufficient_credits").
        webhook_url:
          type:
            - string
            - 'null'
          description: HTTPS URL receiving webhook deliveries.
        webhook_secret_set:
          type: boolean
          description: >-
            Whether a webhook secret is configured. The actual secret is never
            returned.
        filter_types:
          type:
            - array
            - 'null'
          items:
            type: string
            enum:
              - original
              - reply
              - retweet
              - quote
          description: Tweet types being delivered. Null means all types.
        credits_per_account_per_day:
          type: number
          description: Credit cost per monitored account per day.
        estimated_credits_per_day:
          type: number
          description: Estimated total credit cost per day based on current account count.
        pricing_tier:
          type: string
          description: Current pricing tier label.
          example: Standard
        created_at:
          type: string
          format: date-time
          description: Timestamp when the monitor was created.
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the monitor was last updated.
    ErrorResponse:
      type: object
      description: Error response returned for failed requests.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message describing what went wrong.
  responses:
    Unauthorized:
      description: Authentication failed. The API key is missing, invalid, or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Invalid or missing API key
    PaymentRequired:
      description: >-
        Insufficient credits. Your account balance has been exhausted. Purchase
        more credits at https://scrapebadger.com/dashboard/billing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Insufficient credits
    RateLimitExceeded:
      description: >-
        Rate limit exceeded. Too many requests in a given time period. Implement
        exponential backoff and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Rate limit exceeded. Please retry after a short delay.
  securitySchemes:
    apiKey:
      type: apiKey
      name: x-api-key
      in: header
      description: >-
        Your ScrapeBadger API key. You can find this in your dashboard at
        https://scrapebadger.com/dashboard/api-keys.

````