Skip to main content

Create an access request

createRequest submits an access request for one beneficiary and one or more resources. It returns as soon as the request exists. Approval and fulfillment happen afterward, so the result tells you the request was accepted, not that anyone has the access yet.

mutation CreateRequest($requestData: RequestData!) {
createRequest(requestData: $requestData) {
id
request_number
}
}

Variables:

{
"requestData": {
"beneficiary_id": "019d1f36-b056-78ef-97dd-f6c707ac44be",
"justification": "Covering the quarter-end close for the finance team",
"request_resources": [
{
"id": "019d1f36-c27d-7276-b4f4-59953442554f",
"end_time": "2027-01-31T17:00:00.000Z"
}
]
}
}
{
"data": {
"createRequest": {
"id": "019d1f36-df55-70f4-84d0-9aa44f8f5524",
"request_number": 1203
}
}
}

The input​

FieldRequiredHolds
beneficiary_idyesThe id of the identity who receives the access.
justificationnoThe business reason, as free text. It is stored on the request.
request_resourcesyesOne entry for each resource requested.

Each entry in request_resources:

FieldRequiredHolds
idyesThe id of the resource to request (the id from List resources).
form_datanoThe answers to the resource's request form, keyed by field. Required when the resource has a form, and refused when it has none.
grantsnoSpecific Grants to request on the resource, each with kind and value, and qualifiers where the Grant kind has them. At most 100 an entry.
start_timenoWhen the access should start, for access scheduled ahead.
end_timenoWhen the access should end. It must be in the future and after start_time.
request_modenoSTANDARD (the default) or EMERGENCY.

The requester is always the caller: Owlie sets it from the API key's service account, and there is no field to set it. Configure request forms and access selections describes forms and Grant selection, Access windows and expiration the start and end times, and Provisional and emergency access the emergency mode.

Who may request for whom​

createRequest has no single permission. Owlie compares the caller with the beneficiary:

  • A caller can always request access for itself.
  • A caller can request for an active identity whose direct manager it is.
  • Requesting for anyone else needs the request.modify permission.

A service account that files requests on behalf of people therefore needs a role with request.modify. Without it the mutation fails with status 403.

Validation errors​

Owlie checks the whole request before creating it. If any entry fails, nothing is created and the mutation answers a ValidationError with status 400. The message says what failed, for example:

  • The resource does not exist in your organization, or is disabled.
  • The resource has no seats available.
  • The resource requires form data and none was sent, or a form answer is invalid.
  • Form data was sent for a resource that has no form, or is larger than 128 KB.
  • end_time is in the past or before start_time.
  • Emergency access is not allowed for this requester and beneficiary.

Check before you submit​

previewRequest takes the same RequestData and creates nothing. It reports, for each resource, whether the beneficiary is eligible and what would happen:

query PreviewRequest($requestData: RequestData!) {
previewRequest(requestData: $requestData) {
items {
resource_id
eligible
ineligibility_reason
already_assigned
capacity_ok
instant
}
}
}

eligible is false with an ineligibility_reason when the request would be refused. already_assigned says the beneficiary holds the resource already, capacity_ok that a seat is free, and instant that nothing stands between submitting and fulfillment: no person has to approve and no policy blocks it. A preview reports, and the same checks run again when you submit.

Follow the request​

Read the request by id or by requestNumber to see where it is:

query RequestProgress($id: ID) {
request(id: $id) {
request_number
status
outcome
requestResources {
status
error_message
resource {
name
}
}
}
}

Variables:

{ "id": "019d1f36-df55-70f4-84d0-9aa44f8f5524" }

The request's status is CREATED, IN_PROGRESS, COMPLETED, CANCELED or ERRORED. Each requested resource has its own status: PENDING_APPROVAL, PENDING_FULFILLMENT, COMPLETED, REJECTED, CANCELED, APPROVAL_ERROR or FULFILLMENT_ERROR. A request is finished when outcome is set: SUCCESS, PARTIAL, REJECTED, ERRORED or PARTIAL_ERRORED.

A caller can read a request it is involved in, such as one it submitted. Reading any request needs request.read. How a request reaches fulfillment explains each state.