Skip to main content
An access request moves through approval, provisioning and, for time-based access, removal. Where a step needs a person, Lumos creates a task and assigns it. This guide follows a request through those steps and builds a bot that approves requests from code. The Access Request object and the Task object list every field.

How a request moves

Filing a request starts its approval workflow. From there:
  • Approval. Each approval stage creates an access-request-approval task for the stage’s approvers. A request that needs no approval moves directly to approved.
  • Provisioning. When Lumos can grant the access itself, for example through the app’s integration, provisioning runs automatically. Otherwise Lumos creates a task, such as manual-provisioning or account-creation, for someone to grant it by hand. The app’s admins get that task unless the workflow names someone else.
  • Removal. When time-based access ends, Lumos removes it automatically or creates a deprovisioning task, such as manual-deprovisioning or account-deprovisioning, for someone to remove it by hand.
Statuses describes every status, and which ones you can cancel from.

File a request and follow it

The code on this page uses Python 3 and the requests library. It reads your API token from the LUMOS_API_TOKEN environment variable, as Authentication describes, and stops on any error, including a 429. Rate limits explains how to wait and retry instead. Create Access Request takes the app, the entitlements you want on it, and a business justification:
File a request
entitlement_ids takes entitlement IDs, as List Entitlements returns them. Omit it to request the app itself. Filing a request covers the other fields and the errors each can return, and Time-based access covers access_length. The API doesn’t send an event when a request changes status or when Lumos creates a task. To follow a request, poll it. Each poll counts against your rate limit, so increase the wait after each poll:
Follow a request
follow() returns when the request reaches a status that isn’t cancellable, such as completed, denied, expired, or cancelled. A request for time-based access moves back to an in-progress status when its access ends. A request can wait on a person for days, so follow() raises TimeoutError if the request is still in progress after max_wait seconds.

The tasks on a request

Two calls return a request’s tasks:
  • Get Access Request with expand=tasks returns them in any status.
  • List Tasks with access_request_id returns the open ones, unless you pass status.
Both return only the tasks you can see, as Which tasks you can see describes. A requester who follows their own request usually sees no tasks at all, because approval tasks go to the approvers. A provisioning or deprovisioning task for one requested entitlement carries that entitlement’s ID, as Entitlement IDs on tasks describes.

An approval bot

An approval bot finds its tasks with List Tasks and approves them with Perform Task Action. A token acts as its user, so a bot sees and acts on the same tasks its user can. Which tasks you can see lists the rules for each role and kind of assignment. A bot running as the current approver can read the request with Get Access Request, using the task’s access_request_id. Once the request no longer waits on the bot, the bot needs another way to see it, as Who can see a request describes. This script approves requests for a list of apps and leaves every other request for a person:
Approval bot
Run it with the token in the environment:
A misspelled filter returns 400 rather than a wider list, as Filtering the list describes. The bot checks each task’s type and status before it acts. Manager approvals are access-request-approval tasks too. Some older manager approvals that are still open have the type manager-approval instead. List that type as well if the bot should handle them.