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

# Get pages posts(from recent)

<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/page_posts
Summary: Get pages posts(from recent)

Required Headers:
- Authorization: Bearer <YOUR_API_KEY>

Parameters:
- page_id (Required): No description. Example: 100064860875397
- cursor (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/page_posts
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/page_posts:
    get:
      tags:
        - Pages
      summary: Get pages posts(from recent)
      parameters:
        - name: page_id
          in: query
          description: ''
          required: true
          example: '100064860875397'
          schema:
            type: string
            example: '100064860875397'
        - name: cursor
          in: query
          description: ''
          required: false
          schema:
            type: string
        - name: start_date
          in: query
          description: Date (yyyy-mm-dd).
          required: false
          schema:
            type: string
        - name: end_date
          in: query
          description: Date (yyyy-mm-dd).
          required: false
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                code: 0
                message: success
                data:
                  results:
                    - post_id: '1652265463612134'
                      type: post
                      url: >-
                        https://www.facebook.com/facebook/posts/pfbid02K5AWusXqAHtiojuDz1mAya3dGf3JephjH26sbxyKYW9ANQRc4w8bA6bJpBxWWeF6l
                      message: >-
                        Me with A LOT of questions 🤝 Facebook Groups with the
                        answers
                      message_rich: >-
                        Me with A LOT of questions 🤝 Facebook Groups with the
                        answers
                      timestamp: 1789744028
                      comments_count: 4378
                      reactions_count: 21050
                      reshare_count: 792
                      reactions:
                        angry: 35
                        care: 401
                        haha: 1730
                        like: 16629
                        love: 2174
                        sad: 19
                        wow: 62
                      author:
                        id: '100064860875397'
                        name: Facebook
                        url: https://www.facebook.com/facebook
                        profile_picture_url: >-
                          https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s40x40&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHE3HQ4&_nc_oc=Adp-aOaPZ2zyNyloEVm0qVgyPB45V44fbt-nM6JewnO2X4gqWY8FW9Bt-IO201YdQOg&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQIpIJpRr2VG2rOUh0oDLCFd0YG7YhFY6G52sHFoSyPPYg&oe=6AB8080E
                        delegate_page_id: '20531316728'
                      authors:
                        - id: '100064860875397'
                          name: Facebook
                          url: https://www.facebook.com/facebook
                          profile_picture_url: >-
                            https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s40x40&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHE3HQ4&_nc_oc=Adp-aOaPZ2zyNyloEVm0qVgyPB45V44fbt-nM6JewnO2X4gqWY8FW9Bt-IO201YdQOg&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQIpIJpRr2VG2rOUh0oDLCFd0YG7YhFY6G52sHFoSyPPYg&oe=6AB8080E
                          delegate_page_id: '20531316728'
                      author_title: null
                      image: null
                      video: null
                      video_view_count: null
                      album_preview: null
                      video_files: null
                      video_thumbnail: null
                      external_url: null
                      attached_event: null
                      attached_group: null
                      attached_post: null
                      attached_post_url: null
                      text_format_metadata: null
                      comments_id: '1652265463612134'
                      shares_id: '1652265463612134'
                      associated_group_id: null
                      associated_group: null
                      images_count: null
                      top_comments:
                        - type: top_comment
                          id: >-
                            Y29tbWVudDoxNjUyMjY1NDYzNjEyMTM0XzIxNTE3MTAyNjIwNTE3MDQ=
                          legacy_fb_id: '2151710262051704'
                          text: >-
                            Me at 3AM with 100 random questions 🤝 Facebook
                            Groups with 101 answers 😂
                          author:
                            id: '61581817928470'
                            name: Amir Baloch
                            url: https://www.facebook.com/61581817928470
                            gender: FEMALE
                            profile_image_url: >-
                              https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/673756704_122127845217060597_3774723488621255912_n.jpg?stp=c0.27.810.810a_cp0_dst-jpg_tt6&cstp=mx810x810&ctp=s32x32&_nc_cat=111&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=Y46FspnLmogQ7kNvwFtSdXe&_nc_oc=AdrN0ectfJW5UwWEoVfI_mdGILHHCmFP8MRicP7bcc8i73to7GkBsG8w_SYFP-kOMLI&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQJ5yqC4w-CGUf-toqiKB1wMauAarW-53hZ4mn2bpAD3Eg&oe=6AB80912
                          created_time: 1789744289
                    - post_id: '1651207227051291'
                      type: post
                      url: >-
                        https://www.facebook.com/facebook/posts/pfbid023Y59PfDPBeEHnvzDFn74EbETtzKKThqfeZ7UjK1h6TijSD9zcNyvXBHo4Ng49r5Al
                      message: >-
                        Shoutout to the people who put us on to new music with
                        their Stories soundtrack 🫡🎶 We'd be lost without you.
                      message_rich: >-
                        Shoutout to the people who put us on to new music with
                        their Stories soundtrack 🫡🎶 We'd be lost without you.
                      timestamp: 1789656968
                      comments_count: 3212
                      reactions_count: 16848
                      reshare_count: 478
                      reactions:
                        angry: 13
                        care: 357
                        haha: 85
                        like: 13502
                        love: 2834
                        sad: 14
                        wow: 43
                      author:
                        id: '100064860875397'
                        name: Facebook
                        url: https://www.facebook.com/facebook
                        profile_picture_url: >-
                          https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s40x40&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHE3HQ4&_nc_oc=Adp-aOaPZ2zyNyloEVm0qVgyPB45V44fbt-nM6JewnO2X4gqWY8FW9Bt-IO201YdQOg&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQIpIJpRr2VG2rOUh0oDLCFd0YG7YhFY6G52sHFoSyPPYg&oe=6AB8080E
                        delegate_page_id: '20531316728'
                      authors:
                        - id: '100064860875397'
                          name: Facebook
                          url: https://www.facebook.com/facebook
                          profile_picture_url: >-
                            https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s40x40&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHE3HQ4&_nc_oc=Adp-aOaPZ2zyNyloEVm0qVgyPB45V44fbt-nM6JewnO2X4gqWY8FW9Bt-IO201YdQOg&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQIpIJpRr2VG2rOUh0oDLCFd0YG7YhFY6G52sHFoSyPPYg&oe=6AB8080E
                          delegate_page_id: '20531316728'
                      author_title: null
                      image: null
                      video: null
                      video_view_count: null
                      album_preview: null
                      video_files: null
                      video_thumbnail: null
                      external_url: null
                      attached_event: null
                      attached_group: null
                      attached_post: null
                      attached_post_url: null
                      text_format_metadata: null
                      comments_id: '1651207227051291'
                      shares_id: '1651207227051291'
                      associated_group_id: null
                      associated_group: null
                      images_count: null
                      top_comments: []
                    - post_id: '1649751863863494'
                      type: post
                      url: >-
                        https://www.facebook.com/facebook/posts/pfbid02RmJDQ9rrazmaTDPgiyqQqMdg2N63Hzh8kziKzJa3Q4v6DFSGmqvqt7UwF4bRVkCyl
                      message: big fan of friends who reply to every single story
                      message_rich: big fan of friends who reply to every single story
                      timestamp: 1789565287
                      comments_count: 6434
                      reactions_count: 46846
                      reshare_count: 1269
                      reactions:
                        angry: 20
                        care: 1041
                        haha: 318
                        like: 36636
                        love: 8713
                        sad: 25
                        wow: 93
                      author:
                        id: '100064860875397'
                        name: Facebook
                        url: https://www.facebook.com/facebook
                        profile_picture_url: >-
                          https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s40x40&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHE3HQ4&_nc_oc=Adp-aOaPZ2zyNyloEVm0qVgyPB45V44fbt-nM6JewnO2X4gqWY8FW9Bt-IO201YdQOg&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQIpIJpRr2VG2rOUh0oDLCFd0YG7YhFY6G52sHFoSyPPYg&oe=6AB8080E
                        delegate_page_id: '20531316728'
                      authors:
                        - id: '100064860875397'
                          name: Facebook
                          url: https://www.facebook.com/facebook
                          profile_picture_url: >-
                            https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s40x40&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHE3HQ4&_nc_oc=Adp-aOaPZ2zyNyloEVm0qVgyPB45V44fbt-nM6JewnO2X4gqWY8FW9Bt-IO201YdQOg&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQIpIJpRr2VG2rOUh0oDLCFd0YG7YhFY6G52sHFoSyPPYg&oe=6AB8080E
                          delegate_page_id: '20531316728'
                      author_title: null
                      image: null
                      video: null
                      video_view_count: null
                      album_preview: null
                      video_files: null
                      video_thumbnail: null
                      external_url: null
                      attached_event: null
                      attached_group: null
                      attached_post: null
                      attached_post_url: null
                      text_format_metadata: null
                      comments_id: '1649751863863494'
                      shares_id: '1649751863863494'
                      associated_group_id: null
                      associated_group: null
                      images_count: null
                      top_comments:
                        - type: top_comment
                          id: >-
                            Y29tbWVudDoxNjQ5NzUxODYzODYzNDk0XzEyNjYwNjMxMTIyNzg0Mzg=
                          legacy_fb_id: '1266063112278438'
                          text: 'We call those friends: faithful friends.'
                          author:
                            id: '61590659100595'
                            name: Drawing Pencil Beginner
                            url: https://www.facebook.com/61590659100595
                            gender: UNKNOWN
                            profile_image_url: >-
                              https://scontent-phx1-1.xx.fbcdn.net/v/t39.30808-1/715098628_10164697176768205_1703609012737018041_n.jpg?stp=c0.0.1536.1536a_cp0_dst-jpg_tt6&cstp=mx1536x1536&ctp=s32x32&_nc_cat=111&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=LB34cHgdw6cQ7kNvwG9wLlx&_nc_oc=AdoLbJ9WP9-yV957G8icjTAdJJVhAwCHYARVasfl2SghQQWbbf9Brn4viSfPMQspbgk&_nc_zt=24&_nc_ht=scontent-phx1-1.xx&_nc_gid=OU8X8mlOSbeIej4Pi9R31g&_nc_ss=7d289&oh=00_AQKNYkKfZbJDgtKbYp617rYtnTowhpUOsixURYoNySnaXg&oe=6AB83805
                          created_time: 1789565462
                  cursor: >-
                    Cg8Ob3JnYW5pY19jdXJzb3IJAAACmkFRSFRFbURYWlpMSlJ6Tlpabm16X3YxRlNld1RWMFVpTm9FdnE3ZjA1eGlKeW5sQUlmN1pUdnpsRVA3RzVfX01VLUtINHRsWldWZEVubXF4NHhNYjd5S1lKSE9ONW5zdk1ZUWkxczRYMHZ5RndOcHFHQlVMZGo0ZTZUazBVUmFhaF9odjNEU3pmWFEtbkhmMVU4ZXFjZlg4bER6SnZhNk9pR24yRUdUMU5BRTBRd3JvOG5OYzc2UUN5UEhZMVdYZHJ4SlFMMXJ2SEowY29LY3FTRGZLSF82WE5nMWlKV3FBbmRIRVNzSlE5dWpYSEFZUGx3VGxEeGtLVGthVnNXYlcwMldJUHNTeEdFd1hMa0R1VFpvZ2dkeHRzTG5NOS0xU0RjN2dTUXNrN0lkdlF1YXRmRFVrYUhObUFyVUw3MW9MeTViak4wV1JDWE5yVXUzbVY5ek1jT2hxcUNfWDhnczJFaXdpUFlvdER1RTg2OXRpc2IxWWRTYzJTYS1laC1BY0lVODMyREt6TVd6RGQ5bHVTQmQtZWlDNlk2bGJXS3lkYWl1OUxQMk9sMzBpU0ozcnBnbFRtLVlCQjdXTlZ3WVM3Ny1HaTJGNEJqcFFhalZzWDlsczRsR2licy1mSkIzUThWZGFqSExkeFVxRFZhRzZoa18zd1FCTUd2TzdCVHNQcmNrTHd3NVZPSUxVQy1ucGF0QmZ0UFgxeEwyeTB3M3FMRFQzRVB0MDdLNU0zRFpwWGFNZ0h4dVhWSmkzOVVMbm94ZjBLN21DamMwbFFkaFdrYzlFOHNXeU9LczJiV0RoWmw2RGRaY1N0MzJrNnVheFN1dEhzTmtDTE0xVFJxTFNUNmsyUjNCemNxa29jLTd1emhKU3hzRGFhdw8JYWRfY3Vyc29yDg8PZ2xvYmFsX3Bvc2l0aW9uAgAPBm9mZnNldAIADxBsYXN0X2FkX3Bvc2l0aW9uAv8B
                requestId: 87d229ca-0726-4696-a73b-16ad66960937
          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).

````