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

# Get Blog posts by Blog ID

> The "Get Blog posts by Blog ID" API allows you get blog posts for any given blog site using blog ID.Please use blogs/posts.readonly

The "Get Blog posts by Blog ID" API allows you get blog posts for any given blog site using blog ID.Please use blogs/posts.readonly

```http theme={null}
GET https://services.leadconnectorhq.com/blogs/posts/all
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Query parameters

<ParamField query="locationId" type="string" required default="ve9EPM428h8vShlRW1KT" />

<ParamField query="blogId" type="string" required default="66f429b8afdce84227a4610d" />

<ParamField query="limit" type="number" required default="4" />

<ParamField query="offset" type="number" required />

<ParamField query="searchTerm" type="string" default="ai news">
  search for any post by name
</ParamField>

<ParamField query="status" type="string" default="PUBLISHED" />

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="blogs" type="object[]" required>
    Object containing response data of blog posts

    <Expandable title="cada item">
      <ResponseField name="categories" type="string[]" required>
        Array of category IDs associated with the blog post
      </ResponseField>

      <ResponseField name="tags" type="string[]">
        Array of tags associated with the blog post
      </ResponseField>

      <ResponseField name="archived" type="boolean" required default="False">
        Indicates whether the blog post is archived
      </ResponseField>

      <ResponseField name="_id" type="string" required default="66c381b38be80858b9af62b6">
        Unique identifier of the blog post
      </ResponseField>

      <ResponseField name="title" type="string" required default="Banana is good source of energy">
        Title of the blog post
      </ResponseField>

      <ResponseField name="description" type="string" required default="Description">
        Description of the blog post
      </ResponseField>

      <ResponseField name="imageUrl" type="string" required default="https://storage.googleapis.com/ghl-test/fACm0Ojm5oC70G3DcFmE/media/66b5aa3b1745b2713a8d033f.jpeg">
        URL of the image associated with the blog post
      </ResponseField>

      <ResponseField name="status" type="string" required default="PUBLISHED">
        Publication status of the blog post
      </ResponseField>

      <ResponseField name="imageAltText" type="string" required default="alt">
        Alternative text for the blog post image
      </ResponseField>

      <ResponseField name="urlSlug" type="string" required default="banana-good-energy">
        URL slug for the blog post
      </ResponseField>

      <ResponseField name="canonicalLink" type="string" default="https://blog.chatgpts.agency/post/test-8384">
        Canonical link of the blog post
      </ResponseField>

      <ResponseField name="author" type="string" default="659ec9634a3796e4e47cc360">
        Identifier of the author of the blog post
      </ResponseField>

      <ResponseField name="publishedAt" type="string" required default="2024-08-19T17:14:57.000Z">
        Timestamp when the blog post was published
      </ResponseField>

      <ResponseField name="updatedAt" type="string" required default="2024-08-19T17:32:36.182Z">
        Timestamp when the blog post was last updated
      </ResponseField>
    </Expandable>
  </ResponseField>

  ```json theme={null}
  {
    "blogs": [
      {
        "categories": [
          "659ecabc4a37969a2b7cc370",
          "6683abde331c041f32c07aee"
        ],
        "tags": [
          "Apple",
          "Banana"
        ],
        "archived": false,
        "_id": "66c381b38be80858b9af62b6",
        "title": "Banana is good source of energy",
        "description": "Description",
        "imageUrl": "https://storage.googleapis.com/ghl-test/fACm0Ojm5oC70G3DcFmE/media/66b5aa3b1745b2713a8d033f.jpeg",
        "status": "PUBLISHED",
        "imageAltText": "alt",
        "urlSlug": "banana-good-energy",
        "canonicalLink": "https://blog.chatgpts.agency/post/test-8384",
        "author": "659ec9634a3796e4e47cc360",
        "publishedAt": "2024-08-19T17:14:57.000Z",
        "updatedAt": "2024-08-19T17:32:36.182Z"
      }
    ]
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://services.leadconnectorhq.com/blogs/posts/all' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/blogs/posts/all', {
    method: 'GET',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
    },
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'GET',
      'https://services.leadconnectorhq.com/blogs/posts/all',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
      },
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/blogs/posts/all');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'GET',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
      ],
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
