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

# Get Post by ID

Overview

* Returns a single post by its id.
* Helpful to demonstrate path parameters and error handling for missing resources.

Path parameter

* id (number): The post id to fetch.

Example usage

```api theme={null}
- name: Get post 1
  method: GET
  path: /posts/1
  headers:
    Accept: application/json
```

Response notes

* Status 200: A Post object with id, userId, title, body.
* Status 404: Not found (JSONPlaceholder returns an empty object for some endpoints; behavior may vary across resources).

Tips

* Chain this with GET /comments?postId=1 to show related data fetching.


## OpenAPI

````yaml GET /posts/{id}
openapi: 3.1.0
info:
  title: JSONPlaceholder Demo API
  description: >-
    Demo OpenAPI spec wired to JSONPlaceholder
    (https://jsonplaceholder.typicode.com) to showcase Mintlify 'Try it out'.
  version: 1.0.0
servers:
  - url: https://jsonplaceholder.typicode.com
security: []
paths:
  /posts/{id}:
    get:
      summary: Get post by ID
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Post
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Post'
        '404':
          description: Not found
components:
  schemas:
    Post:
      type: object
      properties:
        userId:
          type: integer
        id:
          type: integer
        title:
          type: string
        body:
          type: string

````