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

# Create Article

> Create a new article in a blog

# Create Article

Creates a new article in the specified blog.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.launchmystore.io/api/v1/blogs/blog_abc123/articles.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Summer Product Launch",
      "title": "Summer Product Launch",
      "content": "<p>We are excited to announce our summer collection...</p>",
      "tags": ["summer", "announcements"],
      "image": "https://example.com/summer-launch.jpg"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/blogs/blog_abc123/articles.json', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Summer Product Launch',
      title: 'Summer Product Launch',
      content: '<p>We are excited to announce our summer collection...</p>',
      tags: ['summer', 'announcements'],
      image: 'https://example.com/summer-launch.jpg'
    })
  });
  ```
</CodeGroup>

## Path Parameters

<ParamField path="blog_id" type="string" required>
  The unique blog ID to create the article in
</ParamField>

## Body Parameters

Fields may be sent at the top level, or nested under an `article` object.

<ParamField body="name" type="string" required>
  Internal article name
</ParamField>

<ParamField body="title" type="string" required>
  The article title
</ParamField>

<ParamField body="content" type="string" required>
  Article body content (HTML)
</ParamField>

<ParamField body="handle" type="string">
  URL-safe handle. Auto-generated from the title if not provided.
</ParamField>

<ParamField body="tags" type="array">
  Array of tag strings (e.g., `["summer", "sale", "featured"]`)
</ParamField>

<ParamField body="image" type="string">
  Featured image URL
</ParamField>

<ParamField body="template_suffix" type="string">
  Custom template suffix (e.g., `featured` for `article.featured.liquid`)
</ParamField>

<ParamField body="seo_title" type="string">
  Custom page title for search engines
</ParamField>

<ParamField body="seo_desc" type="string">
  Meta description for search engines
</ParamField>

<ParamField body="seo_image" type="string">
  Social/share image URL for search engines
</ParamField>

## Response

The response uses the standard `{ status, state, message, data }` envelope.
On success `state` is `"success"` and the created article is returned under
`data.article`.

<ResponseField name="status" type="integer">
  HTTP status code (`201` on success)
</ResponseField>

<ResponseField name="state" type="string">
  `"success"` or `"error"`
</ResponseField>

<ResponseField name="data.article" type="object">
  The created article object
</ResponseField>

## Example Response

```json theme={null}
{
  "status": 201,
  "state": "success",
  "message": null,
  "data": {
    "article": {
      "blogId": "a1b2c3d4-5e6f-7890-abcd-ef1234567890",
      "id": "418273",
      "name": "Summer Product Launch",
      "title": "Summer Product Launch",
      "handle": "summer-product-launch",
      "content": "<p>We are excited to announce our summer collection...</p>",
      "image": "https://example.com/summer-launch.jpg",
      "tags": ["summer", "announcements"],
      "templateSuffix": null,
      "seoTitle": null,
      "seoDesc": null,
      "seoImage": null,
      "blogsPageId": "blog_abc123",
      "storeId": "f73049dc-b4d4-4f85-99c2-681a5e351a8a",
      "createdAt": "2024-03-20T10:00:00.000Z",
      "updatedAt": "2024-03-20T10:00:00.000Z"
    }
  },
  "count": null,
  "pagination": null
}
```

## Error Codes

Errors return the same envelope with `state: "error"` and a `message`.

| Status | `message`                                       | When                                       |
| ------ | ----------------------------------------------- | ------------------------------------------ |
| `400`  | `Missing required fields: name, title, content` | A required field is missing or blank       |
| `401`  | —                                               | Invalid or missing access token            |
| `403`  | —                                               | App doesn't have the `write_content` scope |
| `500`  | error detail                                    | Unexpected server error                    |
