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

# Update Blog

> Update an existing blog

# Update Blog

Updates an existing blog. Only provided fields will be updated.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.launchmystore.io/api/v1/blogs/blog_abc123.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "title": "Latest News",
      "handle": "news"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/blogs/blog_abc123.json', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      title: 'Latest News',
      handle: 'news'
    })
  });
  ```
</CodeGroup>

## Path Parameters

<ParamField path="id" type="string" required>
  The unique blog ID to update
</ParamField>

## Body Parameters

All parameters are optional. Only provided fields will be updated.

<ParamField body="name" type="string">
  Internal name of the blog
</ParamField>

<ParamField body="title" type="string">
  The blog title
</ParamField>

<ParamField body="handle" type="string">
  URL-safe handle
</ParamField>

<ParamField body="templateSuffix" type="string">
  Custom template suffix
</ParamField>

<ParamField body="seoTitle" type="string">
  SEO meta title
</ParamField>

<ParamField body="seoDesc" type="string">
  SEO meta description
</ParamField>

<ParamField body="seoImage" type="string">
  SEO/social share image URL
</ParamField>

## Response

Returns the standard response envelope with the updated blog under `data.blog`.

<ResponseField name="status" type="integer">
  HTTP status code
</ResponseField>

<ResponseField name="state" type="string">
  Result state, e.g. `success`
</ResponseField>

<ResponseField name="message" type="string">
  Human-readable message (may be `null`)
</ResponseField>

<ResponseField name="data" type="object">
  Wrapper containing the updated `blog`
</ResponseField>

## Example Response

```json theme={null}
{
  "status": 200,
  "state": "success",
  "message": null,
  "data": {
    "blog": {
      "blogsPageId": "blog_abc123",
      "id": "482913",
      "name": "Latest News",
      "title": "Latest News",
      "handle": "news",
      "templateSuffix": null,
      "seoTitle": null,
      "seoDesc": null,
      "seoImage": null,
      "storeId": "store_abc123",
      "createdAt": "2024-01-01T10:00:00.000Z",
      "updatedAt": "2024-03-20T15:30:00.000Z"
    }
  }
}
```

## Notes

* Changing the handle will break existing links to the blog

## Errors

On failure the same envelope is returned with `state: "error"` and a `message`:

```json theme={null}
{
  "status": 404,
  "state": "error",
  "message": "Blog not found",
  "data": null
}
```

| Status | Condition                                 |
| ------ | ----------------------------------------- |
| `401`  | Invalid or missing access token           |
| `403`  | App doesn't have `write_content` scope    |
| `404`  | Blog with the specified ID does not exist |
