Automations - Introduction

View as Markdown

Base URL

  • AWS North America (AWS NA): https://automations-api.contentstack.com/
  • AWS Europe (AWS EU): https://eu-prod-automations-api.contentstack.com
  • AWS Australia (AWS AU): https://au-prod-automations-api.contentstack.com
  • Azure North America (Azure NA): https://azure-na-automations-api.contentstack.com
  • Azure Europe (Azure EU): https://azure-eu-automations-api.contentstack.com
  • GCP North America (GCP NA): https://gcp-na-automations-api.contentstack.com
  • GCP Europe (GCP EU): https://gcp-eu-automations-api.contentstack.com

Overview

Contentstack is a headless, API-first content management system (CMS) that provides everything you need to power your web or mobile properties. To learn more about Contentstack, visit our website or refer to our documentation site to understand what we do.

This document is a detailed reference to Contentstack’s Automations Management API.

The Automations Management API is used to manage your projects and automations present in an organization. This includes creation, updation, deletion, and fetching requests.

To use the Automations Management API, you need to authenticate yourself with an Authtoken. Read more about it in Authentication.

Note The initial release of the Automations Management API currently does not include support for Management token for authentication. However, this feature is scheduled to be introduced in upcoming releases.

Authentication

Contentstack provides token-based authentication that allows you to create, update, delete, and fetch the content of your Contentstack account. You can use the user Authtoken, to make Automations Management API requests.

Authtokens are user-specific tokens generated when a user logs into Contentstack. Read more about the different types of tokens.

For API Key and Authtoken-based authentication

  • Pass the user Authtoken against the authtoken parameter as header.
  • Pass the Organization ID against the organization_uid parameter as header.

How to Get Authtoken

To retrieve the authtoken, log into your Contentstack account by using the “Log into your account” request under “User Session.” This request will return the authtoken in the response body.

You can generate multiple authtokens by executing the “Log into your account” request multiple times. These tokens do not have an expiration limit. However, currently, there is a maximum limit of 20 valid tokens that a user can use per account at a time to execute the CMA requests.

Note If you already have valid 20 tokens, creating a new authtoken will automatically expire the oldest authtoken without warning.

For SSO-enabled organizations, the “Log in to your account” request will not return the user authtoken for users who access the organization through Identity Provider login credentials. Consequently, any requests that require a user authtoken will not work. The owner and users of the organization who have permission to access the organization without SSO can use the Content Management APIs. Learn more about REST API Usage.

Rate limiting

Rate limit is the maximum number of requests you can make using Contentstack’s API in a given time period.

By default, the Automations Management API enforces the following rate limits:

  • Read (GET) and Write (POST/PUT/DELETE) requests: 10 requests per second per organization

Your application will receive the HTTP 429 response code if the requests for a given time period exceed the defined rate limits.

The aforementioned limits are configurable depending on your plan. For more information, contact our Support team.

API Conventions

  • The base URL for Automations Management API for different regions can be found in the Base URL section.
  • The API version can be found in the URL, e.g. automations-api.contentstack.com/v1/endpoint.
  • Automations Management API supports GET/POST/PUT/DELETE verbs or methods.
  • URL paths are written in lower case.
  • Query parameters and JSON fields use lower case, with underscores (_) separating words.
  • The success/failure status of an operation is determined by the HTTP status it returns. Additional information is included in the HTTP response body.
  • The JSON number type is bounded to a signed 32-bit integer.

Errors

If there is something wrong with the API request, Automations returns an error.

Automations uses conventional, standard HTTP status codes for errors, and returns a JSON body containing details about the error. In general, codes in the 2xx range signify success. The codes in the 4xx range indicate error, mainly due to information provided (for example, a required parameter or field was omitted). Lastly, codes in the 5xx range mean that there is something wrong with Automation's servers; it is very rare though.

Let’s look at the error code and their meanings.

HTTP Status CodeDescription
400 Bad RequestThe request was incorrect or corrupted.
401 Access DeniedThe login credentials are invalid.
403 Forbidden ErrorThe page or resource that is being accessed is forbidden.
404 Not FoundThe requested page or resource could not be found.
412 Precondition FailedThe entered API key is invalid.
422 Unprocessable Entity (also includes Validation Error and Unknown FieldThe request is syntactically correct but contains semantic errors.
429 Rate Limit ExceededThe number of requests exceeds the allowed limit for the given time period.
500 Internal Server ErrorThe server is malfunctioning and is not specific about what the problem is.
502 Bad Gateway ErrorA server received an invalid response from another server.
504 Gateway Timeout ErrorA server did not receive a timely response from another server it was accessing while attempting to load the web page or fulfill another request.

NoteThe error codes that we get in the JSON response are not HTTP error codes but are custom Automations error codes that are used for internal purposes.

Using Postman Collection

Contentstack offers you a Postman Collection that helps you try out our Automations Management API. You can download this collection, connect to your Contentstack account, and try out the Automations Management API with ease.

Learn more about how to get started with using the Postman Collection for Automations Management API.