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

# Search tweets with X advanced-search operators



## OpenAPI

````yaml /openapi.json post /x/search
openapi: 3.1.0
info:
  title: Bridgly API
  description: >-
    Web scraping API for LinkedIn, X (Twitter) and Reddit. Authenticated
    endpoints accept a Bridgly API key (`bgly_…`) via `Authorization: Bearer
    <token>`.
  version: 1.0.0
servers:
  - url: https://api.bridgly.app
    description: Production
  - url: http://localhost:4000
    description: Local
security: []
tags:
  - name: LinkedIn
    description: Scrape LinkedIn profiles, companies, posts, and search.
  - name: Reddit
    description: Scrape Reddit posts, subreddits, users, and search.
  - name: X (Twitter)
    description: Scrape tweets and search X.
paths:
  /x/search:
    post:
      tags:
        - X (Twitter)
      summary: Search tweets with X advanced-search operators
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  description: >-
                    Raw search query — supports all X advanced-search operators,
                    e.g. "openai lang:en".
                withinHours:
                  description: Only return tweets newer than this many hours.
                  type: number
                  exclusiveMinimum: 0
                count:
                  description: Number of results to request from X (default 40, max ~100).
                  type: integer
                  minimum: 1
                  maximum: 9007199254740991
                sortOrder:
                  type: string
                  enum:
                    - Latest
                    - Top
                  description: >-
                    Result ordering: "Latest" = chronological newest-first
                    (default), "Top" = X's engagement ranking.
                lang:
                  description: BCP-47 language filter e.g. "en", "ja" (maps to `lang:XX`).
                  type: string
                accountId:
                  description: Pin to a specific account instead of LRU rotation.
                  type: string
              required:
                - query
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  timeMs:
                    type: number
                    description: >-
                      Wall-clock time the request took to complete, in
                      milliseconds.
                  creditsCost:
                    type: number
                    description: Number of account credits this request consumed.
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Numeric tweet ID e.g. "1234567890123456789"
                        url:
                          type: string
                          description: Canonical tweet URL
                        text:
                          type: string
                          description: Full tweet text
                        authorHandle:
                          type: string
                          description: Author username without @
                        authorName:
                          type: string
                          description: Author display name
                        createdAt:
                          description: When the tweet was posted
                          type: string
                          format: date-time
                        likeCount:
                          type: number
                          description: Number of likes
                        replyCount:
                          type: number
                          description: Number of replies
                        retweetCount:
                          type: number
                          description: Number of retweets
                        viewCount:
                          anyOf:
                            - type: number
                            - type: 'null'
                          description: View count, null if unavailable
                      required:
                        - id
                        - url
                        - text
                        - authorHandle
                        - authorName
                        - createdAt
                        - likeCount
                        - replyCount
                        - retweetCount
                        - viewCount
                      additionalProperties: false
                required:
                  - timeMs
                  - creditsCost
                  - data
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '402':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A Bridgly API key (`bgly_…`). Metered endpoints deduct credits from the
        resolved account.

````