# Blog

In addition to an online storefront, Shopify shops come with a built-in blogging engine, allowing a shop to have one or more blogs.

{{ '/api/reference/blog.png' | image }}

Shop owners are encouraged to use blogs to:

Shopify blogs are like most other blogs: a content management system for articles posted in reverse chronological order. Articles can be posted under one or more user-defined categories and tagged with one or more user-defined tags, with an option to allow readers to post comments to articles. An Atom feed is automatically generated for each blog, allowing for syndication. The search functionality built into every shop also searches the text in blog articles.

Blogs are meant to be used as a type of magazine or newsletter for the shop, with content that changes over time. If your shop needs a static page (such as an "About Us" page), we recommend that you use a Page instead.

Also see the Article resource for managing blog articles.

## Resource Properties ### Blog * commentable:

Indicates whether readers can post comments to the blog and if comments are moderated or not. Possible values are:

* Type: x-string * Example: "no" * created_at: The date and time when the blog was created. The API returns this value in ISO 8601 format. * Type: x-string * Example: "2012-03-13T16:09:54-04:00" * feedburner: FeedBurner is a web feed management provider and can be enabled to provide custom RSS feeds for Shopify bloggers. Google has stopped supporting FeedBurner, and new or existing blogs that are not already integrated with FeedBurner can't use the service. This property will default to blank unless FeedBurner is enabled. * Type: x-string * Example: nil * feedburner_location: The URL that points to the FeedBurner location for blogs that have FeedBurner enabled. Google has stopped supporting FeedBurner, and new or existing blogs that are not already integrated with FeedBurner can't use the service. This property will default to blank unless FeedBurner is enabled * Type: x-string * Example: nil * handle: A human-friendly unique string that is automatically generated from the title if no handle is sent during the creation of a blog. Duplicate handles are appended with an incremental number, for example, `blog-2`. The handle is customizable and is used by the Liquid templating language to refer to the blog. If you change the handle of a blog, then it can negatively affect the SEO of the shop. We recommend that you create a URL redirect to avoid any SEO issues. * Type: x-string * Example: "apple-blog" * id: A unique numeric identifier for the blog. * Type: x-string * Example: 241253187 * metafields:

Attaches additional metadata to a store's resources:

For more information on attaching metadata to Shopify resources, see the Metafield resource.

* Type: array * Example: [{"key"=>"sponsor", "value"=>"Shopify", "value_type"=>"string", "namespace"=>"global", "description"=>"The blog sponsor"}] * tags: A list of tags associated with the 200 most recent blog articles. Tags are additional short descriptors formatted as a string of comma-separated values. For example, if an article has three tags: tag1, tag2, tag3. Tags are limited to 255 characters. * Type: x-string * Example: "tagged" * template_suffix: States the name of the template a blog is using if it is using an alternate template. If a blog is using the default blog.liquid template, the value returned is "null". * Type: x-string * Example: nil * title: The title of the blog. * Type: x-string * Example: "My Blog" * updated_at: The date and time when changes were last made to the blog's properties. Note that this is not updated when creating, modifying or deleting articles in the blog. The API returns this value in ISO 8601 format. * Type: x-string * Example: "2021-12-01T14:52:12-04:00" * admin_graphql_api_id: The GraphQL GID of the blog. * Type: x-string * Example: "gid://shopify/OnlineStoreBlog/241253187" ## Retrieve a list of all blogs Retrieve a list of all blogs. Note: This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to Make paginated requests to the REST Admin API. ### Endpoint /admin/api/#{api_version}/blogs.json (GET) ### Parameters * api_version (required): * fields: comma-separated list of fields to include in the response * handle: Filter by blog handle * limit: The maximum number of results to retrieve. * since_id: Restrict results to after the specified ID ### Responses #### 200 Retrieve a list of all blogs Examples: ##### Get all blogs for a shop Request: ``` GET /admin/api/unstable/blogs.json ``` Response: ``` HTTP/1.1 200 OK {"blogs":[{"id":382285388,"handle":"banana-blog","title":"A Gnu Blog","updated_at":"2006-02-02T19:00:00-05:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:13:29-04:00","template_suffix":null,"tags":"","admin_graphql_api_id":"gid://shopify/Blog/382285388"},{"id":241253187,"handle":"apple-blog","title":"Mah Blog","updated_at":"2006-02-01T19:00:00-05:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:13:29-04:00","template_suffix":null,"tags":"Announcing, Mystery","admin_graphql_api_id":"gid://shopify/Blog/241253187"}]} ``` ##### Get all blogs for a shop after a specified ID Request: ``` GET /admin/api/unstable/blogs.json ``` Response: ``` HTTP/1.1 200 OK {"blogs":[{"id":382285388,"handle":"banana-blog","title":"A Gnu Blog","updated_at":"2006-02-02T19:00:00-05:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:13:29-04:00","template_suffix":null,"tags":"","admin_graphql_api_id":"gid://shopify/Blog/382285388"},{"id":1008414249,"handle":"apple-main-blog","title":"Apple main blog","updated_at":"2024-09-30T11:15:38-04:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:15:38-04:00","template_suffix":null,"tags":"","admin_graphql_api_id":"gid://shopify/Blog/1008414249"}]} ``` ## Create a new Blog Create a new blog ### Endpoint /admin/api/#{api_version}/blogs.json (POST) ### Parameters * api_version (required): * title (required): The title of the blog. Maximum length: 255 characters. ### Responses #### 201 Create a new Blog Examples: ##### Create a new empty blog Request: ``` POST /admin/api/unstable/blogs.json {"blog":{"title":"Apple main blog"}} ``` Response: ``` HTTP/1.1 201 Created {"blog":{"id":1008414251,"handle":"apple-main-blog","title":"Apple main blog","updated_at":"2024-09-30T11:15:40-04:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:15:40-04:00","template_suffix":null,"tags":"","admin_graphql_api_id":"gid://shopify/Blog/1008414251"}} ``` ##### Create a new empty blog with a metafield Request: ``` POST /admin/api/unstable/blogs.json {"blog":{"title":"Apple main blog","metafields":[{"key":"sponsor","value":"Shopify","type":"single_line_text_field","namespace":"global"}]}} ``` Response: ``` HTTP/1.1 201 Created {"blog":{"id":1008414250,"handle":"apple-main-blog","title":"Apple main blog","updated_at":"2024-09-30T11:15:39-04:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:15:39-04:00","template_suffix":null,"tags":"","admin_graphql_api_id":"gid://shopify/Blog/1008414250"}} ``` #### 422 Create a new Blog Examples: ##### Trying to create a blog without a title will return an error Request: ``` POST /admin/api/unstable/blogs.json {"blog":{"body":"foobar"}} ``` Response: ``` HTTP/1.1 422 Unprocessable Entity {"errors":{"title":["can't be blank"]}} ``` ## Receive a count of all Blogs Get a count of all blogs ### Endpoint /admin/api/#{api_version}/blogs/count.json (GET) ### Parameters * api_version (required): ### Responses #### 200 Receive a count of all Blogs Examples: ##### Get the blogs count for a shop Request: ``` GET /admin/api/unstable/blogs/count.json ``` Response: ``` HTTP/1.1 200 OK {"count":2} ``` ## Receive a single Blog Get a single blog by its ID ### Endpoint /admin/api/#{api_version}/blogs/{blog_id}.json (GET) ### Parameters * api_version (required): * blog_id (required): * fields: comma-separated list of fields to include in the response ### Responses #### 200 Receive a single Blog Examples: ##### Get a single blog Request: ``` GET /admin/api/unstable/blogs/241253187.json ``` Response: ``` HTTP/1.1 200 OK {"blog":{"id":241253187,"handle":"apple-blog","title":"Mah Blog","updated_at":"2006-02-01T19:00:00-05:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:13:29-04:00","template_suffix":null,"tags":"Announcing, Mystery","admin_graphql_api_id":"gid://shopify/Blog/241253187"}} ``` ##### Get the id and title of a single blog Request: ``` GET /admin/api/unstable/blogs/241253187.json ``` Response: ``` HTTP/1.1 200 OK {"blog":{"id":241253187,"title":"Mah Blog"}} ``` ## Modify an existing Blog Update a blog ### Endpoint /admin/api/#{api_version}/blogs/{blog_id}.json (PUT) ### Parameters * api_version (required): * blog_id (required): ### Responses #### 200 Modify an existing Blog Examples: ##### Add a metafield to an existing blog Request: ``` PUT /admin/api/unstable/blogs/241253187.json {"blog":{"id":241253187,"metafields":[{"key":"sponsor","value":"Shopify","type":"single_line_text_field","namespace":"global"}]}} ``` Response: ``` HTTP/1.1 200 OK {"blog":{"title":"Mah Blog","handle":"apple-blog","id":241253187,"updated_at":"2006-02-01T19:00:00-05:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:13:29-04:00","template_suffix":null,"tags":"Announcing, Mystery","admin_graphql_api_id":"gid://shopify/Blog/241253187"}} ``` ##### Update an existing blog title Request: ``` PUT /admin/api/unstable/blogs/241253187.json {"blog":{"id":241253187,"title":"IPod Updates"}} ``` Response: ``` HTTP/1.1 200 OK {"blog":{"title":"IPod Updates","handle":"apple-blog","id":241253187,"updated_at":"2024-09-30T11:15:43-04:00","commentable":"no","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:13:29-04:00","template_suffix":null,"tags":"Announcing, Mystery","admin_graphql_api_id":"gid://shopify/Blog/241253187"}} ``` ##### Update an existing blog title and handle and also activate comments Request: ``` PUT /admin/api/unstable/blogs/241253187.json {"blog":{"id":241253187,"title":"IPod Updates","handle":"ipod-updates","commentable":"moderate"}} ``` Response: ``` HTTP/1.1 200 OK {"blog":{"title":"IPod Updates","handle":"ipod-updates","commentable":"moderate","id":241253187,"updated_at":"2024-09-30T11:15:32-04:00","feedburner":null,"feedburner_location":null,"created_at":"2024-09-30T11:13:29-04:00","template_suffix":null,"tags":"Announcing, Mystery","admin_graphql_api_id":"gid://shopify/Blog/241253187"}} ``` ## Remove an existing Blog Delete a blog ### Endpoint /admin/api/#{api_version}/blogs/{blog_id}.json (DELETE) ### Parameters * api_version (required): * blog_id (required): ### Responses #### 200 Remove an existing Blog Examples: ##### Remove an existing blog from a shop Request: ``` DELETE /admin/api/unstable/blogs/241253187.json ``` Response: ``` HTTP/1.1 200 OK {} ```