Skip to main content

Indent Python Quickstart

Learn how to submit your first approval request using the Indent Python SDK.


1. Install

Start by installing the Indent Python SDK:

pip install approvals

# or for direct API usage
pip install indentapi

2. Get your API Key

First, you'll need an Indent space and API token which you can find here:

Current User
Sign in to get API key
  • Can take actions on your behalf
  • Appears in audit log as you
Indent Space
Access Token
Note: this token is short lived and will expire soon

The INDENT_SPACE is the Indent account you want to use for requests and an INDENT_API_TOKEN which is used for authentication. There are two kinds of API tokens: short-lived user access tokens and long-lived service account tokens. Read more about API authentication.

3. Add await approval

Next, let's take a simple but sensitive workflow like user password reset. This workflow will be used to request approval for a user to reset their password.
import os
from approvals import approval

async def reset_password(userId, reason):
await approval({
"reason": reason,
"resources": [
"kind": "action",
"id": f"reset-password:{userId}"
"displayName": f"Reset Password (user:{userId})"

# by default, wait up to 10 seconds for approval
# 95% of approvals take less than 10 seconds

# -> do something to reset the user's password
print f"done: password reset user:{userId}"

reset_password(os.getenv('USER'), os.getenv('REASON'))

Configure the following environment variables:

INDENT_API_TOKEN=s38...65e # Copy from

3. Try it for yourself

Once you run the script with python and the environment variables for user ID and reason, you'll see the following output:

$ USER=123 REASON="to recover account" python

⏵ Requested approval #acmecorp/aec1b116-42b3-11ee-824e-42010aac000d
↳ Waiting for approval... (2s elapsed)
↳ Waiting for approval... (4s elapsed)
↳ Waiting for approval... (8s elapsed)
✅ Granted

done: password reset user:123

Remember that your API key is a secret!

Do not share it with others or expose it in any client-side code (browsers, native apps). Production requests must be routed through your own backend server where your API key can be securely loaded from an environment variable or key management service

4. Use the full Indent API

Install indentapi for access to the full Indent API to list resources, create petitions, and more.

pip install indentapi

Here's an example of how to use the Python bindings to list resources and create a petition:
import os
from indentapi import IndentAPI

indent = IndentAPI(
space_name=os.getenv('INDENT_SPACE'), # default
api_token=os.getenv('INDENT_API_TOKEN'), # from

resources = indent.resource.list(view='requestable')

pet = indent.petition.create(
reason='to debug production',
resources=[r for r in resources if r['displayName'] == 'Production'],

$ python