Access tokens
This set of endpoints allows you to manage CMA tokens (Personal access tokens, CLI tokens, OAuth application tokens). These tokens provide you with access to the Content Management API (CMA) and are an alternative means of authentication to our existing OAuth 2.0 flow.
A CMA token inherits the same access rights as your Contentful account. In other words, if you have access to multiple spaces and organizations, your token will too.
Access tokens collection
Create a Personal access token
This endpoint allows you to create a Personal Access Token. When creating a token, you must specify at least one scope, which is used to limit a tokens access. The following scopes are supported:
content_management_read- Read-only accesscontent_management_manage- Read and write access
Since content_management_manage allows you to read and write, specifying
"scopes": ["content_management_manage"] is equivalent to:
"scopes": ["content_management_read", "content_management_manage"]
expiresIn – Time-to-live (TTL) of the token expressed in seconds. This is an optional field. If the field isn’t passed, then TTL is not set. Therefore, the token will not auto-expire.
token attribute, which contains your access token for the Content Management API. Please ensure you copy it and keep it in a safe place (e.g. outside of your source code repository, an environment variable on your server, …)This endpoint will return all active CMA tokens, including revoked tokens. The possible types of tokens are PersonalAccessToken, CLIToken and OAuthApplication.
The following table contains all the filters (query params) available for this endpoint:
More examples with date range filters:
?sys.expiresAt[gt]=${now_as_iso_date}&revokedAt=null – Returns all active tokens.
?sys.expiresAt[lt]=${now_as_iso_date}&revokedAt=null – Returns all expired tokens.
?revokedAt[lt]=${now_as_iso_date} – Returns all revoked tokens.
Access token
This endpoint returns details about an existing CMA token.
Token revoking
This endpoint allows you to revoke a CMA token. It will set revokedAt to the timestamp of when the request was received.
Admin view Access tokens collection
The endpoint should return redacted versions of all CMA tokens belonging to the users who are members of the given organization. This access is only available for admins and owners.
More examples with date range filters:
?sys.expiresAt[gt]=${now_as_iso_date}&revokedAt=null – Returns all active tokens.
?sys.expiresAt[lt]=${now_as_iso_date}&revokedAt=null – Returns all expired tokens.
?revokedAt[lt]=${now_as_iso_date} – Returns all revoked tokens.