You're reading "Content Management API"

Site

A site represents a specific DatoCMS administrative area

The Site object

A Site object is returned as part of the response body of each successful Show or Update API call. The following table contains the list of all its fields along with their type, description and example values.

Object fields:
deployableboolean

Specifies whether all the deploy informations are correctly setup or not

This attribute is required
domainstring

Administrative area custom domain

faviconstring

The upload id for the favicon

frontend_urlstring

Frontend website url

global_seoobject

Specifies default global settings

imgix_hoststring

Imgix host

internal_domainstring

DatoCMS internal domain for the administrative area

items_countinteger

Number of items present in the site

This attribute is required
last_data_change_atstring

Specifies the last time when a change of data occurred

last_dump_atstring

Specifies the last time an integration plugin called the API

localesarray

Available locales

This attribute is required
namestring

Site name

This attribute is required
no_indexboolean

Whether the website needs to be indexed by search engines or not

This attribute is required
require_2faboolean

Specifies whether all users of this site need to authenticate using two-factor authentication

This attribute is required
themeobject

Specifies the theme to use in administrative area

This attribute is required
theme_hueinteger

Specifies the hue to use primary color in Site backend

This attribute is required
timezonestring

Site default timezone

This attribute is required

Retrieve the site

To retrieve the site, send a GET request to the /site endpoint. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
GET https://site-api.datocms.com/site HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "site", "id": "155", "attributes": { "name": "My Awesome Website", "domain": "admin.my-awesome-website.com", "imgix_host": "www.datocms-assets.com", "internal_domain": "my-website.admin.datocms.com", "locales": [ "en" ], "timezone": "Europe/London", "items_count": 812, "no_index": true, "favicon": "123", "theme_hue": 167, "last_data_change_at": "2017-03-30T09:29:14.872Z", "last_dump_at": "2017-02-10T11:03:42.208Z", "deployable": true, "frontend_url": "https://www.mywebsite.com/", "require_2fa": false, "theme": { "primary_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "light_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "accent_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "dark_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "logo": "123" }, "global_seo": { "site_name": "My Awesome Website", "fallback_seo": { "title": "Default meta title", "description": "Default meta description", "image": "123", "twitter_card": "Large Image" }, "title_suffix": " - My Awesome Website", "facebook_page_url": "http://facebook.com/awesomewebsite", "twitter_account": "@awesomewebsite" } }, "relationships": { "account": { "data": { "type": "account", "id": "312" } }, "deployment_environments": { "data": [ { "type": "deployment_environment", "id": "1822" } ] }, "active_plan": { "data": { "type": "plan", "id": "124" } }, "menu_items": { "data": [ { "type": "menu_item", "id": "34" } ] }, "users": { "data": [ { "type": "user", "id": "312" } ] }, "item_types": { "data": [ { "type": "item_type", "id": "44" } ] }, "roles": { "data": [ { "type": "role", "id": "34" } ] } } }, "included": [ { "type": "menu_item", "id": "34", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null }, "children": { "data": [ { "type": "menu_item", "id": "34" } ] } } }, { "type": "user", "id": "312", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith", "state": "REGISTERED" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } }, { "type": "item_type", "id": "44", "attributes": { "name": "Blog post", "api_key": "post", "collection_appeareance": "compact", "singleton": false, "all_locales_required": false, "sortable": true, "modular_block": false, "draft_mode_active": false, "tree": false, "ordering_direction": null, "has_singleton_item": true }, "relationships": { "menu_item": { "data": null }, "singleton_item": { "data": null }, "fields": { "data": [ { "type": "field", "id": "124" } ] }, "title_field": { "data": null }, "ordering_field": { "data": null } } }, { "type": "role", "id": "34", "attributes": { "name": "Editor", "can_edit_favicon": true, "can_edit_site": true, "can_edit_schema": true, "can_manage_users": true, "can_manage_shared_filters": true, "can_manage_deployment_environments": true, "can_manage_webhooks": true, "can_manage_access_tokens": true, "can_perform_site_search": true, "positive_item_type_permissions": [ { "item_type": "44", "action": "all", "on_creator": "self" } ], "negative_item_type_permissions": [ { "item_type": "44", "action": "all", "on_creator": "self" } ], "positive_deployment_environment_permissions": [ { "deployment_environment": "1822" } ], "negative_deployment_environment_permissions": [ { "deployment_environment": "1822" } ] }, "relationships": { "deployment_environments": { "data": [ { "type": "deployment_environment", "id": "1822" } ] }, "parent": { "data": null }, "children": { "data": [ { "type": "menu_item", "id": "34" } ] } } }, { "type": "field", "id": "124", "attributes": { "label": "Title", "field_type": "string", "default_value": "some default value", "localized": true, "api_key": "title", "hint": "This field will be used as post title", "validators": { "required": {} }, "appeareance": { "editor": "single_line", "parameters": { "heading": false }, "addons": [] }, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } } } }, { "type": "upload", "id": "666", "attributes": { "size": 444, "width": 30, "height": 30, "path": "/45/1496845848-digital-cats.jpg", "url": "https://www.datocms-assets.com/45/1496845848-digital-cats.jpg", "format": "jpg", "alt": "Nyan the cat", "title": "My cat", "is_image": true, "created_at": null } } ] }

Update the site's settings

To update the site's settings, send a PUT request to the /site endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
PUT https://site-api.datocms.com/site HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "site", "id": "155", "attributes": { "no_index": true, "favicon": "123", "global_seo": { "site_name": "My Awesome Website", "fallback_seo": { "title": "Default meta title", "description": "Default meta description", "image": "123", "twitter_card": "Large Image" }, "title_suffix": " - My Awesome Website", "facebook_page_url": "http://facebook.com/awesomewebsite", "twitter_account": "@awesomewebsite" }, "name": "My Awesome Website", "theme": { "primary_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "light_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "accent_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "dark_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "logo": "123" }, "locales": [ "en" ], "timezone": "Europe/London", "require_2fa": false } } }
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "site", "id": "155", "attributes": { "name": "My Awesome Website", "domain": "admin.my-awesome-website.com", "imgix_host": "www.datocms-assets.com", "internal_domain": "my-website.admin.datocms.com", "locales": [ "en" ], "timezone": "Europe/London", "items_count": 812, "no_index": true, "favicon": "123", "theme_hue": 167, "last_data_change_at": "2017-03-30T09:29:14.872Z", "last_dump_at": "2017-02-10T11:03:42.208Z", "deployable": true, "frontend_url": "https://www.mywebsite.com/", "require_2fa": false, "theme": { "primary_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "light_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "accent_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "dark_color": { "red": 128, "green": 128, "blue": 128, "alpha": 128 }, "logo": "123" }, "global_seo": { "site_name": "My Awesome Website", "fallback_seo": { "title": "Default meta title", "description": "Default meta description", "image": "123", "twitter_card": "Large Image" }, "title_suffix": " - My Awesome Website", "facebook_page_url": "http://facebook.com/awesomewebsite", "twitter_account": "@awesomewebsite" } }, "relationships": { "account": { "data": { "type": "account", "id": "312" } }, "deployment_environments": { "data": [ { "type": "deployment_environment", "id": "1822" } ] }, "active_plan": { "data": { "type": "plan", "id": "124" } }, "menu_items": { "data": [ { "type": "menu_item", "id": "34" } ] }, "users": { "data": [ { "type": "user", "id": "312" } ] }, "item_types": { "data": [ { "type": "item_type", "id": "44" } ] }, "roles": { "data": [ { "type": "role", "id": "34" } ] } } } }