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

# Search global

<div className="inline-flex items-center gap-2 px-4 py-2 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg">
  <span className="text-base">🪙</span>
  <span className="text-sm font-medium text-yellow-900 dark:text-yellow-100"><span className="font-semibold">4 credits</span><span className="text-yellow-700 dark:text-yellow-300 ml-1">per request</span></span>
</div>

## Copy for AI

<div className="my-6 rounded-xl border border-gray-200 bg-gray-50 p-5 dark:border-gray-800 dark:bg-gray-900/40">
  <div className="min-w-0">
    <p className="text-base font-semibold text-gray-900 dark:text-gray-100">🤖 Why Code When AI Can Do It For You?</p>
    <p className="mt-1 text-sm text-gray-700 dark:text-gray-300">Stop writing code like it's 1970! Let AI do the heavy lifting - click the sparkles to copy a perfectly formatted prompt for ChatGPT, Claude, or your favorite AI assistant.</p>
  </div>

  <div className="mt-4">
    <button
      type="button"
      className="inline-flex items-center gap-2 rounded-md border border-emerald-300 bg-emerald-50 px-3 py-2 text-sm font-medium text-emerald-800 hover:bg-emerald-100 dark:border-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-100 dark:hover:bg-emerald-900/50"
      onClick={() => navigator.clipboard.writeText(`I need to call the following KeyAPI endpoint. Please generate a complete and directly runnable Python example based on the API information provided below.

## API Information

Endpoint: GET https://api.keyapi.ai/v1/facebook/search_global
Summary: Search global

Required Headers:
- Authorization: Bearer <YOUR_API_KEY>

Parameters:
- query (Required): No description. Example: facebook
- cursor (Optional): No description.
- recent_posts (Optional): No description. Example: true
- location_uid (Optional): No description.
- start_date (Optional): Date (yyyy-mm-dd).
- end_date (Optional): Date (yyyy-mm-dd).

## Code Requirements

- Use the Python \`requests\` library
- Provide a complete and directly runnable example
- Handle HTTP request errors, timeouts, and non-2xx responses
- Handle JSON parsing errors
- Prefer the Example values provided in the API information for sample parameters
- Keep the code simple and avoid unnecessary abstractions or complexity`)}
    >
      <span>✨</span>
      <span>Copy for AI</span>
    </button>
  </div>
</div>


## OpenAPI

````yaml /en/facebook.openapi.json get /v1/facebook/search_global
openapi: 3.0.1
info:
  title: Facebook API English documentation
  description: >-
    The english reference documentation of the Facebook API includes the
    interface's purpose, parameter description, response status, and sample
    structure.
  version: 1.0.0
servers:
  - url: https://api.keyapi.ai
    description: Production-KeyAPI
security:
  - JWT Bearer: []
tags:
  - name: Pages
  - name: Prefiles
  - name: Groups
  - name: Posts and comments
  - name: Evebts
  - name: Ads Library
  - name: Search
  - name: Marketplace
  - name: Games
paths:
  /v1/facebook/search_global:
    get:
      tags:
        - Search
      summary: Search global
      parameters:
        - name: query
          in: query
          description: ''
          required: true
          example: facebook
          schema:
            type: string
            example: facebook
        - name: cursor
          in: query
          description: ''
          required: false
          example: ''
          schema:
            type: string
            example: >-
              {"page_number": 0, "flow_cursors_serialized":
              {"INTERNAL_DEBUG_MODULE": "{}", "SEARCH_CONTROLS_INTERCEPT": "{}",
              "INTEGRITY": "{}", "META_AI": "{}", "SHORTCUTS": "{}",
              "HASHTAG_HEADER": "{}", "SHORTCUT_DEEP_DIVE": "{}",
              "HIGH_CONFIDENCE_TA": "{}", "HIGH_CONFIDENCE_DYNAMIC": "{}",
              "HIGH_CONFIDENCE_AUDIO": "{}", "SPELLER": "{}", "SOCIAL_RAG":
              "{}", "TA_PAGE_CACHED_CONTENT": "{}", "GROUPS_STS_CONTENT": "{}",
              "HIGH_CONFIDENCE_CONTENT": "{}", "ENTITIES": "{}", "ENTITY_POSTS":
              "{}", "PEOPLE_L2_POSTS": "{}", "SEARCH_ADS_TOP_POSITION": "{}",
              "CONTENT": "{\"has_more_results\": true,
              \"browse_cursor_serialized\":
              \"AbrFIXBQw4ML5S364JoIVl_3McxnJfsKRZVKLC71VkAudCevOm-0ashIkbE4xXkQZwgabcMUjx5HtF5D_aipjqtj4VKRbpJkEiuhSDirA13Xp6NuewXUcKfuuOAXPBoGm27QO35j8b2vBzSXZQvk_XWe77uKRQ6CmyowDdPk_s7cCSZCv8oKC4yPvL9x979uOd9R6b-Qsh0_iWGpRZB_22hIdaTnWaLA-8FWBYbjONorWGeODWDFmXr2tXimKPHJOFK5mC1hMfkM_Mijkoo_7UyQ6Wf2FLRVPAgvo6VOdXF0EyOBBBt2Dz0Byj533XJzgWk8fRJ6aEb6gPXF9PbbcZurIyIhOPvhLLR9hPVAx-JXmgIlCZxb1TuZ-53c1jJpJ0gQajb0pBHkOKxqPD5ohAU1HBX_wlNLBTkPEdDxeWbnCD_yz8c6ioCrmDyTxjOftEPy1kOJb4PJfsKUVjtsXKyqpus4Iac-4JDChHQqje_6XmzhqeeRQQX5ywYtdtTglaY3kLc8lL5atUY9sybB7e3_WEePbIP2UoWXtWZMF9dW73R3SYe40PYxMKGbKtKrPXtP15Y2pjzbGunvOC0jsrYqkECeOATHCnS7RWGkz8Oulw\",
              \"processed_unicorn_ids\": [], \"is_end_of_serp\": false}",
              "PARALLEL_FETCH_NOOP": "{}"}, "result_ids_shown": [],
              "unit_id_logging_fields": {"num_total_modules": 5,
              "num_total_results": 5, "num_total_vertical_results": 5,
              "processed_roles": {"PUBLIC_POSTS": 5}},
              "entity_ids_shown_by_type": {"browse_type_group": [],
              "browse_type_page": [], "browse_type_search_query": []},
              "processed_unicorn_ids": [], "completed_flows":
              ["INTERNAL_DEBUG_MODULE", "SEARCH_CONTROLS_INTERCEPT",
              "INTEGRITY", "META_AI", "SHORTCUTS", "SHORTCUT_DEEP_DIVE",
              "HASHTAG_HEADER", "HIGH_CONFIDENCE_TA", "HIGH_CONFIDENCE_DYNAMIC",
              "HIGH_CONFIDENCE_AUDIO", "SPELLER", "SOCIAL_RAG",
              "TA_PAGE_CACHED_CONTENT", "GROUPS_STS_CONTENT",
              "HIGH_CONFIDENCE_CONTENT", "ENTITIES", "ENTITY_POSTS",
              "PEOPLE_L2_POSTS", "SEARCH_ADS_TOP_POSITION"]}
        - name: recent_posts
          in: query
          description: ''
          required: false
          example: 'true'
          schema:
            type: boolean
            default: true
        - name: location_uid
          in: query
          description: ''
          required: false
          example: ''
          schema:
            type: string
        - name: start_date
          in: query
          description: Date (yyyy-mm-dd)
          required: false
          example: ''
          schema:
            type: string
        - name: end_date
          in: query
          description: Date (yyyy-mm-dd)
          required: false
          example: ''
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '402':
          $ref: '#/components/responses/402'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
      deprecated: false
      security:
        - JWT Bearer: []
components:
  responses:
    '400':
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            example:
              code: 400
              data: null
              message: 'Missing required parameter: handle'
    '401':
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            example:
              code: 401
              data: null
              message: apiKey is null
    '402':
      description: Payment Required
      content:
        application/json:
          schema:
            type: object
            example:
              code: 402
              data: null
              message: apiKey quota is not enough
    '429':
      description: Too Many Requests
      content:
        application/json:
          schema:
            type: object
            example:
              code: 429
              data: null
              message: qps limit exceeded
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            example:
              code: 500
              data: null
              message: Internal server error
  securitySchemes:
    JWT Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |-
        API key for authentication. Format: `sk_live_xxxxxxxxxxxxx`
        Get your API key from the [Dashboard](http://keyapi.ai/app/dashboard).

````