> ## 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 pages

<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_pages
Summary: Search pages

Required Headers:
- Authorization: Bearer <YOUR_API_KEY>

Parameters:
- query (Required): No description. Example: facebook
- cursor (Optional): No description.
- location_uid (Optional): No description.

## 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_pages
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_pages:
    get:
      tags:
        - Search
      summary: Search pages
      parameters:
        - name: query
          in: query
          description: ''
          required: true
          example: facebook
          schema:
            type: string
            example: facebook
        - name: cursor
          in: query
          description: ''
          required: false
          schema:
            type: string
        - name: location_uid
          in: query
          description: ''
          required: false
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                code: 0
                message: success
                data:
                  results:
                    - type: page
                      profile_url: https://www.facebook.com/people/Facebook/61594152238736/
                      url: https://www.facebook.com/people/Facebook/61594152238736/
                      image:
                        uri: >-
                          https://scontent-mia3-1.xx.fbcdn.net/v/t1.30497-1/453178253_471506465671661_2781666950760530985_n.png?stp=dst-png_s120x120&_nc_cat=110&ccb=1-7&_nc_sid=3e70f4&_nc_ohc=EgFnToEjFPcQ7kNvwHrX4lI&_nc_oc=AdpVhwm4AW-VRf1mACMUo5w11xYcqmGctOK6EMA3jwOUKTbStARymfVb0fGfk1yiwjE&_nc_zt=24&_nc_ht=scontent-mia3-1.xx&_nc_ss=73289&oh=00_AQJW6Xg8SEYHOg5xc3CuME5jNFmhi1MCZSIui24uxqB4yw&oe=6AD996FA
                        width: 120
                        height: 120
                        scale: 2
                      name: Facebook
                      facebook_id: '61594152238736'
                      is_verified: false
                    - type: page
                      profile_url: >-
                        https://www.facebook.com/people/%F0%9D%90%B9%F0%9D%92%B6%F0%9D%92%B8%F0%9D%91%92%F0%9D%92%B7%F0%9D%91%9C%F0%9D%91%9C%F0%9D%93%80-%F0%9D%90%BF%F0%9D%91%9C%F0%9D%93%8B%F0%9D%91%92%F0%9D%93%87/61592674572833/
                      url: >-
                        https://www.facebook.com/people/%F0%9D%90%B9%F0%9D%92%B6%F0%9D%92%B8%F0%9D%91%92%F0%9D%92%B7%F0%9D%91%9C%F0%9D%91%9C%F0%9D%93%80-%F0%9D%90%BF%F0%9D%91%9C%F0%9D%93%8B%F0%9D%91%92%F0%9D%93%87/61592674572833/
                      image:
                        uri: >-
                          https://scontent-mia3-2.xx.fbcdn.net/v/t39.30808-1/767603062_122103421947422485_1199556424671905788_n.jpg?stp=c0.0.719.719a_dst-jpg_s120x120_tt6&_nc_cat=105&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=onNA0-BZMmQQ7kNvwFJrgr-&_nc_oc=AdrcU76PgXx0yXFO9hwoRNXaD3tu9Rjk4Vyp8026y2kFNRMdO-MIX0xYLOTnWm5YMKM&_nc_zt=24&_nc_ht=scontent-mia3-2.xx&_nc_gid=dW_xSBURUyhpEYhPszs8NQ&_nc_ss=73289&oh=00_AQK3yLRpZpnk_t6NvkzVsbVVrat7OMil22VGsQIZjWG76g&oe=6AB81CA0
                        width: 120
                        height: 120
                        scale: 2
                      name: 𝐹𝒶𝒸𝑒𝒷𝑜𝑜𝓀 𝐿𝑜𝓋𝑒𝓇
                      facebook_id: '61592674572833'
                      is_verified: false
                    - type: page
                      profile_url: >-
                        https://www.facebook.com/people/F-a-c-e-b-o-o-k/61555870374226/
                      url: >-
                        https://www.facebook.com/people/F-a-c-e-b-o-o-k/61555870374226/
                      image:
                        uri: >-
                          https://scontent-mia3-1.xx.fbcdn.net/v/t39.30808-1/420398111_122095078970195679_7038680117015095570_n.png?stp=dst-png_s120x120&_nc_cat=110&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=S5GgBABBWj0Q7kNvwF0GTNn&_nc_oc=Ado06fxb14rDiSwhLlkmATcXoRU69swP8eGZkhvjs-4DZCgd4fd2ZkLbJtMdvQnwLKc&_nc_zt=24&_nc_ht=scontent-mia3-1.xx&_nc_gid=dW_xSBURUyhpEYhPszs8NQ&_nc_ss=73289&oh=00_AQKYeSBb6UBW39ddUIHvXT34SwiyP73X4wi2j5sbsspqlw&oe=6AB8238C
                        width: 120
                        height: 120
                        scale: 2
                      name: F a c e b o o k
                      facebook_id: '61555870374226'
                      is_verified: false
                    - type: page
                      profile_url: >-
                        https://www.facebook.com/people/F-a-c-e-b-o-o-k/61555332772608/
                      url: >-
                        https://www.facebook.com/people/F-a-c-e-b-o-o-k/61555332772608/
                      image:
                        uri: >-
                          https://scontent-mia5-2.xx.fbcdn.net/v/t39.30808-1/415995452_122094116210177759_8955115038966892288_n.png?stp=dst-png_s120x120&_nc_cat=100&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=JbAnmH4uDMoQ7kNvwGUmeey&_nc_oc=AdoeCwwOcy-_yjbkjD6HfGVMUTMl9WhBDaaQ8CBN2dc7-UO1BI4pnujA5KiH33ALOJc&_nc_zt=24&_nc_ht=scontent-mia5-2.xx&_nc_gid=dW_xSBURUyhpEYhPszs8NQ&_nc_ss=73289&oh=00_AQIq_ik3oR3x5VOizT38db8LoMUnM09cOkETxIajy9kt6A&oe=6AB81108
                        width: 120
                        height: 120
                        scale: 2
                      name: 'F a c e b o o k '
                      facebook_id: '61555332772608'
                      is_verified: false
                    - type: page
                      profile_url: >-
                        https://www.facebook.com/people/Facebook/100091293341964/
                      url: >-
                        https://www.facebook.com/people/Facebook/100091293341964/
                      image:
                        uri: >-
                          https://scontent-mia3-1.xx.fbcdn.net/v/t1.30497-1/453178253_471506465671661_2781666950760530985_n.png?stp=dst-png_s120x120&_nc_cat=110&ccb=1-7&_nc_sid=3e70f4&_nc_ohc=EgFnToEjFPcQ7kNvwHrX4lI&_nc_oc=AdpVhwm4AW-VRf1mACMUo5w11xYcqmGctOK6EMA3jwOUKTbStARymfVb0fGfk1yiwjE&_nc_zt=24&_nc_ht=scontent-mia3-1.xx&_nc_ss=73289&oh=00_AQJW6Xg8SEYHOg5xc3CuME5jNFmhi1MCZSIui24uxqB4yw&oe=6AD996FA
                        width: 120
                        height: 120
                        scale: 2
                      name: Facebook
                      facebook_id: '100091293341964'
                      is_verified: false
                    - type: page
                      profile_url: https://www.facebook.com/FacebookforCreators
                      url: https://www.facebook.com/FacebookforCreators
                      image:
                        uri: >-
                          https://scontent-mia3-2.xx.fbcdn.net/v/t39.30808-1/622918217_1462163141940777_8542731204936976900_n.jpg?stp=dst-jpg_s120x120_tt6&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=ukjzhERL8MwQ7kNvwH5IWK9&_nc_oc=Adpvb3zfLITY79LZ9OCGi5JNwNi0MYBSu11jy2U0n8ll7NY646VO1Hp7SgEMWXi677U&_nc_zt=24&_nc_ht=scontent-mia3-2.xx&_nc_gid=dW_xSBURUyhpEYhPszs8NQ&_nc_ss=73289&oh=00_AQJjphV_f3E4mIdic2d4rGJ9V5MmzsuzLzpWBYIwuMag9A&oe=6AB826C7
                        width: 120
                        height: 120
                        scale: 2
                      name: Facebook for Creators
                      facebook_id: '100044413150303'
                      is_verified: true
                    - type: page
                      profile_url: >-
                        https://www.facebook.com/people/facebook-%E1%9E%85%E1%9E%B6%E1%9E%9F%E1%9F%8B/61593573414089/
                      url: >-
                        https://www.facebook.com/people/facebook-%E1%9E%85%E1%9E%B6%E1%9E%9F%E1%9F%8B/61593573414089/
                      image:
                        uri: >-
                          https://scontent-mia3-3.xx.fbcdn.net/v/t39.30808-1/777851662_122094595353452447_4760697879615142630_n.jpg?stp=dst-jpg_s120x120_tt6&_nc_cat=108&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=4-yTwVZUbScQ7kNvwFENH-0&_nc_oc=AdoUbPwkGwS2s0vaRMg42MAXomxCadnNRznhVujco4_JfBq2NVtTxBSVzXhjagACsRA&_nc_zt=24&_nc_ht=scontent-mia3-3.xx&_nc_gid=dW_xSBURUyhpEYhPszs8NQ&_nc_ss=73289&oh=00_AQLcqoOxGjEi0Jl5qfq4MS-O0I1niMNzAcCgQsSit7gmCA&oe=6AB81EEE
                        width: 120
                        height: 120
                        scale: 2
                      name: facebook ចាស់
                      facebook_id: '61593573414089'
                      is_verified: false
                  cursor: >-
                    {"page_number": 0, "flow_cursors_serialized":
                    {"INTERNAL_DEBUG_MODULE": "{}", "SEARCH_CONTROLS_INTERCEPT":
                    "{}", "INTEGRITY":
                    "{\"has_more_results\":false,\"processed_unicorn_ids\":[],\"is_end_of_serp\":false}",
                    "SPELLER": "{}", "PAGES_TAB": "{\"has_more_results\": true,
                    \"browse_cursor_serialized\":
                    \"AbpAZC2rR3XdaxYJc_qo-gXQkncEz7Ni1M3v7TpP5iR59KkTTxuvgyTGjtYwkoU-aR-UXDH34WDJvZgn7fBw1VxQHjBfj47PS--jyqOxanLJ6rhWfertx2oLhwt3LxE-B8534BuntRjvBm-3xAWq6EaSqJ_6H4xBJLsHWQ7D65csxu_JP3iCX6TAp4alZAkxCdHMoekOkIgJjFkVAcInNK6K2M5wufsfauzq2HlJ891-etwJEF6fOA6mYE3a0KvSsTPukOwS9GacgnssTDPRtmoCuHgw9NNiLRRc3pmjT4e4iIVbn2zpO46ddu3xPtwqXQwFzRQTbWhimprWxd4rA_LPJORI9kgj1Lpmp0w53oDTAYajdQ8yLmZWDtEWIkV55bRdf7eDbUsK-OqA72HSJzu0Jlr1a25nHzRs-FdTSGfDTabJGIqSzft_TU8gA8DW-Pt9Onz4N6EdCSLzA8utdv_tk0erGAh1_7AXvFCvkI74rybadHX4fmX9iLUMpp5AeCN6zXYUNbmYP66U_38hMZvT2xtabRdclY_6vh4Y_od-EA\",
                    \"processed_unicorn_ids\": [], \"is_end_of_serp\": false}"},
                    "result_ids_shown": [], "unit_id_logging_fields":
                    {"num_total_modules": 1, "num_total_results": 7,
                    "num_total_vertical_results": 7},
                    "entity_ids_shown_by_type": {}, "processed_unicorn_ids": [],
                    "completed_flows": ["INTERNAL_DEBUG_MODULE",
                    "SEARCH_CONTROLS_INTERCEPT", "INTEGRITY", "SPELLER"]}
                requestId: c66119ca-eaf4-4d9a-87a2-bd158fc55aef
          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).

````