Setka Content Cloud API
Last updated
Last updated
Setka Cloud API allows you to download HTML code and auxiliary data of posts saved in your Setka account.
To enable Cloud API, please contact support.
If Cloud API is active on your Setka account, you will see some new buttons that will help you operate with the posts.
If Cloud API is enabled, you will see the Publish / Unpublish button on the post badge in your Setka account. It determines the status of the post: published or draft, respectively:
The same buttons will appear in the post editor:
After the post is published, it can also be updated. Until then, its' status will stay as draft
. To update the post and make the new revision available as published
:
Make some changes in the published post and click Save draft.
Click Republish:
To fetch a complete list of posts from your Setka account, run the following request by adding a license key:
To get a specific post from your Setka account, you need to specify its ID:
Where POST_ID
is the post’s ID.
By default, API will only return published posts with no images or HubSpot data. To get draft posts, use the state:draft
or state:all
filters. To include HubSpot data and/or images in the results, add additional fields to the request.
Authorizing your identity in the Setka Cloud API is possible in two ways:
Add the authorization header to the request:
where YOUR_LICENSE_KEY
is your license key.
Add the token parameter to the request:
where YOUR_LICENSE_KEY
is your license key.
If the request is successful, you will receive a response consisting of an array of posts. The response will be paginated if the number of posts is large. Below is an example API request response:
Field | Description |
posts | Posts array. Contains all the posts from your Setka account. The selection can be limited using additional parameters. |
pagination | Pagination of search results. Contains information about the current page, the number of pages, the total number of posts, and the number of posts per page. |
Element | Description |
id | The post’s unique ID. |
title | The post’s title. |
style_name | The name of the style used in the post. |
layout_name | The name of the grid in which the post is laid out. |
reading_time | The estimated time to read the post (in seconds). |
preview_link | A link to the post’s preview in your Setka account. |
state | The post’s state (either |
created_at | The date and time of the post’s creation. |
updated_at | The date and time when the post was last updated. |
published_at | The date and time of the post’s publication. |
author | The post’s author, where — — |
body_html | The post’s full HTML code. |
assets | Any additional files in the posts (e.g., CSS, JavaScript, or images). |
hubspot_post | The post data exported to HubSpot, where: — — — Note: Getting the |
Assets element files
As mentioned above, the assets element contains links to other files and assets. The possible types of assets are:
File | URL | Description |
plugins | https://ceditor.setka.io/clients /js_plugins/5ca41dc7f0df3e3d6170901b627d32fc/public.js | The scripts to run interactive post elements (e.g., animations, galleries, or notes). |
styles | https://ceditor.setka.io/common_css /common_css_1565603693.css | The CSS files of post styles, including the common style file, the standalone style, and the layout grid file. |
images | https://ceditor.setka.io/clients /U8Cr2B1ZnJjyHr6e6xn_Qa7N1oqyj7cB/post_images/-tltJS8D79MI5Yltt37MCA.jpg | The images used in the post, where: — — — — |
Element | Description |
page | The current page number. |
limit | The maximum number of posts per page. |
page_count | The total number of pages. |
total_count | The total number of posts. |
Using additional request parameters with the Setka Cloud API is necessary to filter posts by features or to include or exclude certain data in the response.
You can filter posts by status and author, e.g.:
The available filters are:
author
— the post’s author. The filter works both by ID (i.e., author.id
) and by author name (author.name
).
state
— the post’s status, i.e., one of the following: draft
, published
, or all
(both draft
and published
).
You can also include additional fields in the API response with the include parameter and listing the fields separated by commas, e.g.:
The available fields are:
hubspot_post
— the data of a post exported to HubSpot.
images
— all images used in a post.
If you need to obtain individual fields from your Setka account (e.g., only identifiers and post names), use the select
parameter:
The available fields are:
id
— the post’s unique ID.
title
— the post’s title.
style_name
— the name of the style used in the post.
layout_name
— the name of the grid in which the post is laid out.
reading_time
— the estimated time to read the post (in seconds).
preview_link
— a link to the post’s preview in your Setka account.
state
— the post’s state (either draft
or published
).
created_at
— the date and time of the post’s creation.
updated_at
— the date and time when the post was last updated.
published_at
— the date and time of the post’s publication.
author
— the post’s author, where id is the author’s unique ID, and the name is the author’s name specified in your Setka account.
body_html
— the post’s full HTML code.
assets
— any additional files in the posts (e.g., CSS, JavaScript, or images).
hubspot_post
— the post data exported to HubSpot, where id
is the post’s unique ID; url
is the link to the post in HubSpot; blog_id
is the post’s ID in HubSpot.
When using the Setka Cloud API, you might encounter the following errors:
HTTP/1.1 401 Unauthorized
This error occurs when using an incorrect license key (token).
HTTP/1.1 404 Unauthorized
This error occurs when requesting a specific post if a post with this ID is not found.
If you need assistance with the Setka Cloud API, please contact support.
If you use Post API to fetch content from Setka Cloud, you will need to migrate all assets to your own infrastructure. Post API response contains links to all necessary assets (CSS, Fonts, Images etc).
Advice – store CSS files with the same path, that will simplify the update script.
For example: If CSS URL looks like: https://ceditor.setka.io/clients/123/example.css
you should store it in your infrastructure and make it accessible via the URL on your domain, for example like this: https://you-domain.com/clients/123/example.css
.
When all assets are downloaded and stored in your infrastructure, you need to replace all links used in the Post body and include CSS files in the Post Page. You will need a custom script tailored to your case.
Inside the Post body there might be images. If you created Posts inside Setka Cloud you’ll find srcset
generated for multiple image sizes. It’s a feature provided by Setka Cloud. Links to image variations are not provided. We suggest that you remove everything inside the srcset
HTML attribute for in <img tag>
and store the original image in your infrastructure.
Example:
You have the following piece of code:
You should pick the original size – https://img.setka.io/clients/AutWJxVDaz_R9_xWagHPL9nT4WVLIRNp/post_images/mufasa_headshot-2023012401152726.png
in src
attribute (you can find the same link inside Post API response) and make it accessible on the URL like https://your-domain.com/clients/AutWJxVDaz_R9_xWagHPL9nT4WVLIRNp/post_images/mufasa_headshot-2023012401152726.png
Then change the link inside Setka Post body and remove the srcset. The result will look like this: