Delivery Token

View as Markdown

Delivery Token

Delivery Tokens are tokens that provide you with read-only access to the associated environments. It is a credential used along with the stack API key to make authorized Content Delivery API requests for retrieving the published content of an environment.

create

The create method allows you to create a new delivery token in the stack.

NameTypeDescription
data (required)Dict

Data you want to send in the request body

"token":{
           "name":"Test",
           "description":"This is a demo token.",
           "scope":[
               {
                   "module":"environment",
                   "environments":[
                       "production"
                   ],
                   "acl":{
                       "read":true
                   }
               },
               {
                   "module":"branch",
                   "branches":[
                       "main",
                       "development"
                   ],
                   "acl":{
                       "read":true
                   }
               },
               {
                   "module":"branch_alias",
                   "branch_aliases":[
                       "deploy",
                       "release"
                   ],
                   "acl":{
                       "read":true
                   }
               }
           ]
       }
   }
import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').delivery_token().create(data).json()

delete

The delete method removes the existing delivery token from the stack.

NameTypeDescription
delivery_token_uid (required)str

UID of the delivery token

import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').delivery_token('delivery_token_uid').delete().json()

fetch

The fetch method retrieves the details of a specific delivery token from the stack.

NameTypeDescription
delivery_token_uid (required)str

UID of the delivery token

import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').delivery_token('delivery_token_uid').fetch().json()

find

The find method retrieves the details of all the delivery tokens created in the stack.

import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack("api_key").delivery_token().find().json()

update

The update method allows you to make changes in the existing delivery token in the stack.

NameTypeDescription
data (required)Dict

The updated information for the delivery token

data = {
       "token":{
           "name":"Test",
           "description":"This is a updated token.",
           "scope":[
               {
                   "module":"environment",
                   "environments":[
                       "production"
                   ],
                   "acl":{
                       "read":true
                   }
               },
               {
                   "module":"branch",
                   "branches":[
                       "main",
                       "development"
                   ],
                   "acl":{
                       "read":true
                   }
               },
               {
                   "module":"branch_alias",
                   "branch_aliases":[
                       "deploy"
                   ],
                   "acl":{
                       "read":true
                   }
               }
           ]
       }
   }
import contentstack_management
client = contentstack_management.Client(authtoken='your_authtoken')
result = client.stack('api_key').delivery_token("delivery_token_uid").update(data).json()