> ## 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 post details by url or post id

> Get post details by url or post id. If both are set, post id is used.

<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/post_details
Summary: Get post details by url or post id

Required Headers:
- Authorization: Bearer <YOUR_API_KEY>

Parameters:
- post_id (Optional): Provide either \`post_id\` or \`post_url\`. Example: pfbid04KTWEM9Rri6Wg3oLRBF5FUUvfPebQ6ZJRwVivymc8e8KWvy3RsnpUXyppjEZqkwZl
- post_url (Optional): Provide either \`post_id\` or \`post_url\`.

## 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/post_details
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/post_details:
    get:
      tags:
        - Posts and comments
      summary: Get post details by url or post id
      description: Get post details by url or post id. If both are set, post id is used.
      parameters:
        - name: post_id
          in: query
          description: Provide either `post_id` or `post_url`.
          required: false
          example: >-
            pfbid04KTWEM9Rri6Wg3oLRBF5FUUvfPebQ6ZJRwVivymc8e8KWvy3RsnpUXyppjEZqkwZl
          schema:
            type: string
            example: >-
              pfbid04KTWEM9Rri6Wg3oLRBF5FUUvfPebQ6ZJRwVivymc8e8KWvy3RsnpUXyppjEZqkwZl
        - name: post_url
          in: query
          description: Provide either `post_id` or `post_url`.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                code: 0
                message: success
                data:
                  results:
                    post_id: '1017566160415404'
                    type: post
                    url: >-
                      https://www.facebook.com/facebook/posts/pfbid04LGZncNDK9chi72WkGExZyxmsxhbczdieGpVPJT4Hp2izvkEeWNxeWacs7fu1SGxl
                    message: Nothing works when your ponytail is too tight.
                    message_rich: Nothing works when your ponytail is too tight.
                    timestamp: 1731700941
                    comments_count: 3117
                    reactions_count: 10000
                    reshare_count: 1745
                    reactions:
                      angry: 19
                      care: 48
                      haha: 4276
                      like: 5329
                      love: 258
                      sad: 10
                      wow: 60
                    author:
                      id: '100064860875397'
                      name: Facebook
                      url: https://www.facebook.com/facebook
                      profile_picture_url: >-
                        https://scontent.ffcm1-2.fna.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s80x80&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHS9chZ&_nc_oc=AdoB8Wx9Knq8G8_QHEK-A-4UnKvF5cWLS2Y2LQxXIaFwhUb628R1tuFoiRxiJe_MyUs&_nc_zt=24&_nc_ht=scontent.ffcm1-2.fna&_nc_gid=eYGCK7Ajif54qPTodleSmQ&_nc_ss=7d289&oh=00_AQIEK16F6VKwmSUDVxWwtQ7pnzAauQItrnv67AQAdhMFbg&oe=6AB8080E
                      delegate_page_id: '20531316728'
                    authors:
                      - id: '100064860875397'
                        name: Facebook
                        url: https://www.facebook.com/facebook
                        profile_picture_url: >-
                          https://scontent.ffcm1-2.fna.fbcdn.net/v/t39.30808-1/380700650_10162533193146729_2379134611963304810_n.jpg?stp=cp0_dst-jpg_tt6&cstp=mx2048x2048&ctp=s80x80&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=v825A_xemiwQ7kNvwHS9chZ&_nc_oc=AdoB8Wx9Knq8G8_QHEK-A-4UnKvF5cWLS2Y2LQxXIaFwhUb628R1tuFoiRxiJe_MyUs&_nc_zt=24&_nc_ht=scontent.ffcm1-2.fna&_nc_gid=eYGCK7Ajif54qPTodleSmQ&_nc_ss=7d289&oh=00_AQIEK16F6VKwmSUDVxWwtQ7pnzAauQItrnv67AQAdhMFbg&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: '1017566160415404'
                    shares_id: '1017566160415404'
                    associated_group_id: null
                    associated_group: null
                    images_count: null
                    top_comments:
                      - type: top_comment
                        id: >-
                          Y29tbWVudDoxMDE3NTY2MTYwNDE1NDA0XzE4ODU3ODQxMjIxOTQ0MDQ=
                        legacy_fb_id: '1885784122194404'
                        text: Loosen the ponytail and enjoy life!☺️
                        author:
                          id: '100051456016380'
                          name: Bigyan Mudbari
                          url: https://www.facebook.com/100051456016380
                          gender: null
                          profile_image_url: null
                        created_time: 1731701033
                      - type: top_comment
                        id: >-
                          Y29tbWVudDoxMDE3NTY2MTYwNDE1NDA0XzE1NjkxNzU4MzM3OTkwNDQ=
                        legacy_fb_id: '1569175833799044'
                        text: Honestly i cant breath with tight ponytail
                        author:
                          id: '100004257521394'
                          name: Winfred Bauer
                          url: https://www.facebook.com/100004257521394
                          gender: null
                          profile_image_url: null
                        created_time: 1731701783
                      - type: top_comment
                        id: >-
                          Y29tbWVudDoxMDE3NTY2MTYwNDE1NDA0XzEwODE0Mzk5NzcwMjQ3NDI=
                        legacy_fb_id: '1081439977024742'
                        text: Loosen the ponytail and enjoy life!☺️
                        author:
                          id: '100044169247872'
                          name: Kurian Presenter
                          url: https://www.facebook.com/100044169247872
                          gender: null
                          profile_image_url: null
                        created_time: 1731701883
                      - type: top_comment
                        id: >-
                          Y29tbWVudDoxMDE3NTY2MTYwNDE1NDA0XzEwNzMxNTM3OTA3NjI5NDk=
                        legacy_fb_id: '1073153790762949'
                        text: Headache and everything.👍🏻🤣
                        author:
                          id: >-
                            pfbid0Wjirrd1oqqijsiDo8GPsogJzyRtma5JLd3zvhbDEzNGymX7cXgVbHdXavpmN8bEbl
                          name: Denisse Cafengiu
                          url: >-
                            https://www.facebook.com/pfbid0Wjirrd1oqqijsiDo8GPsogJzyRtma5JLd3zvhbDEzNGymX7cXgVbHdXavpmN8bEbl
                          gender: null
                          profile_image_url: null
                        created_time: 1731701961
                      - type: top_comment
                        id: >-
                          Y29tbWVudDoxMDE3NTY2MTYwNDE1NDA0XzIyMDA1OTAwNTcwMDI4NDY=
                        legacy_fb_id: '2200590057002846'
                        text: Nothing works if my ponytail is too LOOSE
                        author:
                          id: >-
                            pfbid0yUqJq7WqUPy2tVe8qbrQVKSuF3DrV6u3aQ2FyScUyifhk2J91kYvTnycLd6Qjwmnl
                          name: Cara Stone
                          url: >-
                            https://www.facebook.com/pfbid0yUqJq7WqUPy2tVe8qbrQVKSuF3DrV6u3aQ2FyScUyifhk2J91kYvTnycLd6Qjwmnl
                          gender: null
                          profile_image_url: null
                        created_time: 1731702332
                requestId: 6ba4a46f-74bb-4584-9728-e06c901ba8d7
          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).

````