Knowledge API - Introduction

[API VERSION : 1.0.0]
View as Markdown

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 documentation provides information on endpoints, operations, parameters, and responses for the Knowledge Vault API. It includes ingesting, updating, deleting and getting usage from the Knowledge Vault.

The Knowledge Vault API requests acts as a central repository for brand-related data, offering content ingestion, usage tracking, updating, and deletion functionalities.

Base URL

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

Authentication

Knowledge Vault uses token-based authentication. You can use the Authtoken along with the Organization UID to make API requests. Read more about the different types of tokens.

For Authtoken-based authentication

  • Pass the user Authtoken against the authtoken parameter as header.
  • Pass the OAuth Token value against the authorization parameter as header.
  • Pass the Brand Kit UID against the brand_kit_uid parameter as header.

How to Get Authtoken

To retrieve the authtoken, log in to 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 time limit. However, currently, there is a maximum limit of 20 valid tokens that a user can use per account at a time, to execute CMA requests.

NoteIf you already have valid 20 tokens, creating a new authtoken will automatically cause the oldest authtoken to expire without warning.

For SSO-enabled organizations, the Log into 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. Only the owner of the organization and users with permission to access the Organization without SSO can use these APIs. Learn more about REST API Usage.

Rate Limiting

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

By default, the Knowledge Vault API enforces the following rate limits:

API RequestRate Limit

Knowledge Vault Write (POST) 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 Knowledge Vault API for different regions can be found in the Base URL section.
  • The API version can be found in the URL, e.g. brand-kits-api.contentstack.com/v1/brand-kits
  • Knowledge Vault 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, Contentstack returns an error.

Knowledge Vault 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 our 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 Unauthorized UserThe user is not authorized.
403 Forbidden ErrorThe page or resource that is being accessed is forbidden.
500 Internal Server ErrorThe server is malfunctioning and is not specific on 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 that it was accessing while attempting to load the web page or fill another request by the browser.

Using Postman Collection

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

Learn more about how to get started with using the Postman Collection for Knowledge Vault API.