Skip to main content
Python

Prepare the request

The script reads your API token from the LUMOS_API_TOKEN environment variable, so the token never appears in the code. Create the token as a user with the Admin role, as Before you start explains. The script uses Python 3 and the requests library (pip install requests).
call() sends each request and handles one failure itself. When a response is a 429, meaning you’re over the rate limit, it waits the number of seconds in the Retry-After header, then tries again. Any other error raises and stops the script.

Choose the app and the group

Set APP_ID to the app’s id from List Apps. The app must already be in the AppStore, because an entitlement has AppStore settings only while its app is in the AppStore. Set up an app in the AppStore covers adding it. Set GROUP_ID to the group’s Lumos id, not its ID in the app it comes from. Find a Group by Name prints both. If you have only the group’s ID from Okta or Google Workspace, find the group with the integration_specific_id filter on List Groups.

Check the step

The steps a workflow can use differ from app to app. The script first reads the app’s catalog with List Workflow Steps. With type set to entitlement-provisioning, the catalog lists only the steps that type of workflow accepts. Each entry’s input_schema describes the inputs its step takes.

Create the entitlement

Create Entitlement creates the entitlement visible in the AppStore. Anyone allowed to request the app could then request it before it has a provisioning workflow. The script hides it right away with Update Entitlement AppStore Settings, and shows it again in the last step. The entitlement uses the app’s approval workflow. To give it different approvers, set an override with Set Entitlement Approval Workflow Override.

Bind the provisioning workflow

Create Workflow stores the workflow, and Set Entitlement Provisioning Workflow binds it to the entitlement. Lumos runs the workflow when it grants the entitlement to someone. The Workflow object covers workflow types and steps. To take people out of the group when their access ends, also bind a deprovisioning workflow with Set Entitlement Deprovisioning Workflow. List Workflow Steps with type set to entitlement-deprovisioning shows the steps your app offers for it.