SecureAuth Workforce Authority

Object Management API

This API is a RESTful API using OAuth for authentication and OAuth scopes for authorization. To call it, you need an application in Workforce Authority that is granted the necessary OAuth scopes.

Authenticating to the API

Every request carries a bearer access token. Get an access token explains how to create an application and request one from your tenant's token endpoint. Each section below names the scope its endpoints require; request those scopes and add them to the application's Access Token Scopes.

Response overview

HTTP status codes

The HTTP status of the response will indicate the general disposition of the request:

Code Meaning
200, 201 The request succeeded. Any requested data is in the content field
400 A parameter is missing or malformed. response_code is invalid_parameter, or invalid for an out-of-range page_size; check the message field
401 The access token is missing or invalid. The response carries a WWW-Authenticate: Token challenge header and no JSON body
403 The access token lacks the required scope, or comes from the global issuer and your tenant has disabled global providers. The body is empty
404 The user, role or role assignment does not exist. response_code is not_found; check the message field. A disabled tenant's tokens get 401, except a token without a tenant in its audience, such as a legacy /oauth/token token, which gets 404 with Tenant not found or you don't have access to it
422 We were unable to process the given data. response_code is invalid with an errors field (Invite's email check returns only message), or failure with a message (Offboard)
429 Too many requests. See Rate limits
500 An unexpected error occurred, or next_token could not be decoded. response_code is server_error; check the message field
503 The rate limit could not be checked, and your deployment refuses requests it can't count. See Rate limits

Response body

The body of the response is a JSON object containing the following keys:

Field Type Description
response_code String A code indicating the general nature of the response (e.g. success)
content JSON The output data from a successful request. Will only be present if response_code is success
errors JSON A mapping of fields to their error messages (e.g. { "email": ["can't be blank"] }). Only present when response_code is invalid
message String An informative message describing the error
next_token String On list endpoints, the token for the next page. Absent on the last page
links JSON On list endpoints, links.next holds the full URL of the next page. Absent on the last page

Add response_format=jwt to a request to receive the body as a JWT instead, signed by our private key and carrying the same keys:

{
   "content": "<JWT>"
}

The 401, 403, 429 and 503 responses are never wrapped, nor is the 404 a token without a tenant in its audience gets when your tenant is disabled.

Pagination

The list endpoints return one page of results at a time, ordered by id. They accept two optional parameters:

Key Value Type Description
page_size optional Integer (1–1000, default 100) Query The number of records per page
next_token optional String Query The next_token from the previous page

When more records remain, the response carries next_token and links.next. Request the next page by passing next_token together with any filter, such as role_name. links.next keeps response_format but drops other query parameters, so follow it only on an unfiltered list. A page_size outside 1–1000 returns HTTP 400:

HTTP/1.1 400 Bad Request

{
   "response_code": "invalid",
   "message": "Page size must be between 1 and 1000 (inclusive)"
}

Rate limits

Unless rate limiting is disabled, responses that pass the scope, tenant and response_format checks carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the window resets) headers. When rate limiting is enforced, a request over the limit returns HTTP 429 with a Retry-After header and this body:

{
   "error": "Rate limit exceeded"
}

If the rate limit can't be checked, the request goes through without these headers. A deployment can instead be configured to refuse such requests while rate limiting is enforced. It then returns HTTP 503 with no Retry-After header and this body:

{
   "error": "Rate limit check unavailable"
}

User Management

User management requires the admin_own_users OAuth scope on the access token.

The user object

User endpoints return users with these keys:

Key Value Description
id Integer The unique identifier for the user
username String The user's username
email String The user's primary email address
first_name String The user's given name
last_name String The user's surname
mobile_phone_number String The mobile phone number for use by SMS, in E.164 International Standard Format
confirmed_phone Boolean Whether the mobile phone number is confirmed. Only confirmed numbers can be used for SMS and voice authentication
locale String Language code for the user
directory_fields JSON User attributes. Returned by the single-user endpoints (get, create, update) only, not by list endpoints
created_at DateTime When the user was first created, in ISO-8601 format
updated_at DateTime When the user was last updated, in ISO-8601 format
last_login_at DateTime The time of the user's last successful login, in ISO-8601 format
locked Boolean Whether the user's account is locked which prevents logging in

List Users

Returns the users in your organization, one page at a time. See Pagination.

Users whose status is pending or invalid, such as directory-synced users missing required fields, are not returned by List Users, and Get, Update and Offboard report them as not found; in Offboard that fails the whole request. Creating a user with such a user's username, or with only an email equal to it, fails with 500.

Request

Method URL
GET /api/integration/v2/users
Key Value Type Description
role_name optional String Query Return only users assigned this role
page_size optional Integer Query The number of users per page
next_token optional String Query The token for the next page

Response

Successful response

An array of user objects, without directory_fields.

Successful response example
HTTP/1.1 200 OK

{
   "response_code": "success",
   "content": [
      {
         "id": 1,
         "username": "abe.lincoln@example.com",
         "email": "abe.lincoln@example.com",
         "first_name": "Abe",
         "last_name": "Lincoln",
         "mobile_phone_number": "+18005551212",
         "confirmed_phone": true,
         "locale": "en",
         "created_at": "2021-08-24T21:33:32.804Z",
         "updated_at": "2021-11-19T15:07:22.976Z",
         "last_login_at": "2021-11-19T15:07:21.223Z",
         "locked": false
      }
   ],
   "next_token": "VzN4Z1crbWZvaFNSNFRDS3JWWWZqcGhqY0EySnNqeWlhdklHeUNnZVlRdz0tLVZja1BYZGlleTVqczE0UFk0WUdDaUE9PQ",
   "links": {
      "next": "https://example.com/api/integration/v2/users?next_token=VzN4Z1crbWZvaFNSNFRDS3JWWWZqcGhqY0EySnNqeWlhdklHeUNnZVlRdz0tLVZja1BYZGlleTVqczE0UFk0WUdDaUE9PQ&response_format=json"
   }
}
Unsuccessful response

Not Found: HTTP 404

Returned when role_name names no role in your organization.

HTTP/1.1 404 Not Found

{
   "response_code": "not_found",
   "message": "Could not find the specified role"
}

Get User Info

Returns the user information for the specified user id.

Request

Method URL
GET /api/integration/v2/users/{id}
Field Value Type Description
id Integer URL The id of the user to fetch

Response

Successful response

A user object.

Successful response example
HTTP/1.1 200 OK

{
   "response_code": "success",
   "content": {
      "id": 1,
      "username": "abe.lincoln@example.com",
      "email": "abe.lincoln@example.com",
      "first_name": "Abe",
      "last_name": "Lincoln",
      "mobile_phone_number": "+18005551212",
      "confirmed_phone": true,
      "locale": "en",
      "directory_fields": {
         "userPrincipalName": "abe.lincoln@example.com"
      },
      "created_at": "2021-08-24T21:33:32.804Z",
      "updated_at": "2021-11-19T15:07:22.976Z",
      "last_login_at": "2021-11-19T15:07:21.223Z",
      "locked": false
   }
}
Unsuccessful response

Not Found: HTTP 404

Key Value Description
response_code String not_found
message String More information about the response
HTTP/1.1 404 Not Found

{
   "response_code": "not_found",
   "message": "Could not find the specified user"
}

Invalid Parameter: HTTP 400

Key Value Description
response_code String invalid_parameter
message String Informative message describing the error

Create New User

Request

Method URL
POST /api/integration/v2/users

Provide username, email, or both. When username is omitted, email becomes the username.

Key Value Type Description
username String Body The user's username. Required when email is omitted
email String Body The primary email address for the user. Required when username is omitted
first_name optional String Body The user's given name
last_name optional String Body The user's surname
mobile_phone_number optional String (E.164 International Standard Format) Body The user's mobile phone number for SMS MFA
confirmed_phone optional true / false Body Whether the mobile phone number is confirmed
locale optional String (ISO 639-1 code) Body Language code for the user
locked optional true / false (default false) Body Whether the user's account is locked which prevents logging in
directory_fields optional JSON Body User attributes. userPrincipalName and sAMAccountName cannot be set; sending either returns 422
Sample request
{
   "email": "abe.lincoln@example.com",
   "first_name": "Abe",
   "last_name": "Lincoln",
   "mobile_phone_number": "+18005551212"
}

Response

Successful response

On success HTTP status 201 (Created) is returned with the new user object in content, including its id.

Successful response sample
HTTP/1.1 201 Created

{
   "response_code": "success",
   "content": {
      "id": 1,
      "username": "abe.lincoln@example.com",
      "email": "abe.lincoln@example.com",
      "first_name": "Abe",
      "last_name": "Lincoln",
      "mobile_phone_number": "+18005551212",
      "confirmed_phone": false,
      "locale": null,
      "directory_fields": {},
      "created_at": "2021-08-24T21:33:32.804Z",
      "updated_at": "2021-08-24T21:33:32.804Z",
      "last_login_at": null,
      "locked": false
   }
}
Unsuccessful response

Invalid Data: HTTP 422

Key Value Description
response_code String invalid
errors JSON Map giving the values that had errors and what those errors were.
message optional String Present when the user was created but its primary email could not be set

Invalid Parameter: HTTP 400

Returned when both username and email are missing, or email is not a valid address, or confirmed_phone is not a boolean.

Key Value Description
response_code String invalid_parameter
message String Informative message describing the error

Server Error: HTTP 500

Returned when the new user's username (email, when username is omitted) belongs to a user whose status is pending or invalid.

Key Value Description
response_code String server_error
message String The database error text

Update Existing User

Updates an existing user by the given id. Omitted fields keep their current values, except within directory_fields, which is replaced as a whole.

Request

Method URL
PATCH or PUT /api/integration/v2/users/{id}
Key Value Type Description
id Integer URL The id of the user to update
email optional String Body The primary email address for the user
first_name optional String Body The user's given name
last_name optional String Body The user's surname
mobile_phone_number optional String (E.164 International Standard Format) Body The user's mobile phone number for SMS MFA
confirmed_phone optional true / false Body Whether the mobile phone number is confirmed
locale optional String (ISO 639-1 code) Body Language code for the user
locked optional true / false Body Whether the user's account is locked which prevents logging in. Unchanged when omitted
directory_fields optional JSON Body The user's full attribute set. It replaces the stored object, so keys you leave out are removed. userPrincipalName and sAMAccountName are read-only: changing or removing them returns 422
Sample request
{
   "mobile_phone_number": "+18885559999"
}

Response

On success, this returns the updated user object.

Successful response
HTTP/1.1 200 OK

{
   "response_code": "success",
   "content": {
      "id": 1,
      "username": "abe.lincoln@example.com",
      "email": "abe.lincoln@example.com",
      "first_name": "Abe",
      "last_name": "Lincoln",
      "mobile_phone_number": "+18885559999",
      "confirmed_phone": true,
      "locale": "en",
      "directory_fields": {
         "userPrincipalName": "abe.lincoln@example.com"
      },
      "created_at": "2021-08-24T21:33:32.804Z",
      "updated_at": "2022-01-14T19:47:22.976Z",
      "last_login_at": "2021-11-19T15:07:21.223Z",
      "locked": false
   }
}
Unsuccessful response

Not Found: HTTP 404

Key Value Description
response_code String not_found
message String More information about the response
HTTP/1.1 404 Not Found

{
   "response_code": "not_found",
   "message": "Could not find the specified user"
}

Invalid Data: HTTP 422

Key Value Description
response_code String invalid
errors JSON Map giving the values that had errors and what those errors were.

Invalid Parameter: HTTP 400

Key Value Description
response_code String invalid_parameter
message String Informative message describing the error

Invite User

Generates an invitation to pair a mobile device. Once the user pairs, they join your organization.

Request

Method URL
POST /api/integration/v2/users/invite
Key Value Type Description
username String Body The unique identifier for the user. Required when email is omitted
email optional String Body Deprecated; use username
first_name optional String Body The user's given name
last_name optional String Body The user's surname
mobile_phone_number optional String Body The user's mobile phone number
send_email_invite optional true / false (default true) Body Whether to email the user an invitation with a QR code. Must be false when username is not an email address
Sample request
{
   "username": "abe.lincoln@example.com",
   "first_name": "Abe",
   "last_name": "Lincoln"
}

Response

Successful response
Key Value Description
invite_token String Base64-encoded pairing token, suitable for a QR code
invite_universal_link String Universal link for pairing from a mobile device: https://, the platform's universal-link host (which can differ from the API host), the invitation path, then ? and the invite_token value
invite_custom_schema_pairing_link String Deep link that opens the tenant's preferred authenticator app
invite_pairing_app_name String Display name of the tenant's preferred authenticator app
invite_expiry Integer When the invitation expires, as a Unix timestamp
HTTP/1.1 200 OK

{
   "response_code": "success",
   "content": {
      "invite_token": "eyJpbnZpdGF0aW9uX3Rva2VuIjoi...",
      "invite_universal_link": "https://UNIVERSAL_LINK_HOST/.../invitation?eyJpbnZpdGF0aW9uX3Rva2VuIjoi...",
      "invite_custom_schema_pairing_link": "example-app://invitation/eyJpbnZpdGF0aW9uX3Rva2VuIjoi...",
      "invite_pairing_app_name": "Example Authenticator",
      "invite_expiry": 1666031367
   }
}
Unsuccessful response

Invalid Data: HTTP 422

Returned with message "Invalid email address format." when send_email_invite is true and username is not an email address, or with errors when the invitation fails validation.

Key Value Description
response_code String invalid
message String Informative message describing the error
errors JSON Map giving the values that had errors and what those errors were.

Invalid Parameter: HTTP 400

Returned when both username and email are missing, or send_email_invite is not a boolean.

Key Value Description
response_code String invalid_parameter
message String Informative message describing the error

Offboard User

This endpoint allows for offboarding of one or more users. For each user to be offboarded, the following steps will be performed:

  1. Account lock. The user's Workforce Authority account will be locked, causing all authentications to be rejected. Even if the user's mobile device is re-paired, any attempt to re-pair a workstation from the mobile app will fail while the user's account is locked.

  2. Mobile device unpairing. All of the user's paired mobile devices will be immediately unpaired in Workforce Authority, and will no longer be available to the user for push-based authentications. If the mobile device is online at the time of offboarding, the Workforce Authority Mobile app returns to the initial pairing screen. If the mobile device is not online, this will happen when network connectivity resumes. The user will no longer have access to their TOTP offline codes, or use of their mobile device for push authentications. (Note: When a user is offboarded, the organization is expected to disable their email account to prevent the possibility of re-pairing.)

  3. Workstation unpairing. All of the user's paired workstations will be immediately unpaired in Workforce Authority. If the workstation is online at the time of offboarding, it immediately receives an unpair command. The user will be unable to log in again without re-pairing the workstation, which the mobile app refuses while the user's Workforce Authority account is locked. If the workstation is not online, it receives the command when network connectivity resumes.

  4. Agent revocation. Every agent registered to the user is revoked.

  5. Passkey and security key removal. All of the user's passkeys and security keys are deleted.

  6. Binary directory attribute removal. Stored binary attributes such as the user's photo are deleted. Unless the user's directory is the built-in Workforce Authority directory or an identity pool, the photo is fetched again the next time it is read.

If a user has been offboarded in this manner, they can be onboarded again with the following steps:

  1. Restore the user's access to email, if it was disabled.

  2. Use the Workforce Authority admin console to unlock the user's account. (This step needs permission to unlock users, which the organization admin role grants.)

  3. Ask the user to re-pair their mobile device.

  4. Ask the user to re-pair their workstation and log in.

  5. Ask the user to re-register their passkeys and security keys.

The offboard endpoint allows offboarding multiple users at once. However, note that each call to the endpoint is atomic -- if any failure occurs for any user, no offboarding steps will be performed for any user. A user whose status is pending or invalid is reported as not found, which fails the whole request.

Offboarded users can optionally be soft deleted in the same request. Soft deleting a user also performs every offboarding step above. It retains the user's record, history and audit logs while removing the account from the list of users. A new user account with the same email address may be onboarded, but will not retain the user's history. A soft deleted user account may only be restored by SecureAuth personnel.

Request

Method URL
POST /api/integration/v2/users/offboard

The request body should contain a JSON object with a single users key whose value is an array of objects used to identify a user. (The examples below should provide clarity.) Each user identification object should contain exactly one key used to identify the user – either email or id – but not both.

An additional field, delete, indicates that the user account should be soft deleted while retaining its record, history and audit logs.

Key Value Type Description
email optional String Body The user's username or any of their confirmed email addresses
id optional Integer Body The unique identifier for the user
delete optional Boolean Body Whether to soft delete the user (default false)
Sample requests

Offboarding a single user identified by email address:

{
    "users": [
        {
            "email": "abe.lincoln@example.com"
        }
    ]
}

Offboarding a single user identified by their unique Workforce Authority numeric identifier:

{
    "users": [
        {
            "id": 511940
        }
    ]
}

Offboarding multiple users and soft deleting one:

{
    "users": [
        {
            "email": "abe.lincoln@example.com"
        },
        {
            "email": "mark.twain@example.com",
            "delete": true
        }
    ]
}

Response

On success, this endpoint returns a JSON object with the response_code set to success.

Successful response
HTTP/1.1 200 OK

{
    "response_code": "success"
}
Unsuccessful response

Not Found: HTTP 404

Key Value Description
response_code String not_found
message String "Could not find a user with email abe.lincoln@example.com" or "Could not find a user with ID 511940"

Invalid Parameter: HTTP 400

Returned when the users array is missing or empty.

Key Value Description
response_code String invalid_parameter
message String An explanation of the problematic parameter.

Failure Response: HTTP 422

Returned when a user object carries both email and id, or neither.

Key Value Description
response_code String failure
message String Informative message describing the error

Role Management

Role management requires the admin_own_users OAuth scope on the access token.

List All Roles

Returns the roles available in your organization, one page at a time. See Pagination.

Request

Method URL
GET /api/integration/v2/roles

Response

Successful response

An array of Role objects:

Key Value Description
name String The unique identifier for the role.
Successful response example
HTTP/1.1 200 OK

{
   "response_code": "success",
   "content": [
      {
         "name": "org_admin"
      },
      {
         "name": "help_desk"
      }
   ]
}

List Roles Assigned to a User

Returns the roles assigned to a specific user that List All Roles also returns, one page at a time. Global roles, such as admin, are left out. See Pagination.

Request

Method URL
GET /api/integration/v2/users/{user_id}/roles
Key Value Type Description
user_id Integer URL The id of the user to list the assigned roles for

Response

Successful response

An array of Role objects:

Key Value Description
name String The unique identifier for the role.
Successful response example
HTTP/1.1 200 OK

{
   "response_code": "success",
   "content": [
      {
         "name": "help_desk"
      }
   ]
}
Unsuccessful response

Not Found: HTTP 404

Key Value Description
response_code String not_found
message String More information about the response
HTTP/1.1 404 Not Found

{
   "response_code": "not_found",
   "message": "Could not find the specified user"
}

List Users With an Assigned Role

Returns the users who have the specified role assigned to them, one page at a time. See Pagination.

Request

Method URL
GET /api/integration/v2/roles/{role_name}/users
Key Value Type Description
role_name String URL The role identifier to list the users assigned to that role

Response

An array of user objects, without directory_fields. See The user object.

Successful response example

HTTP/1.1 200 OK

{
   "response_code": "success",
   "content": [
      {
         "id": 1,
         "username": "abe.lincoln@example.com",
         "email": "abe.lincoln@example.com",
         "first_name": "Abe",
         "last_name": "Lincoln",
         "mobile_phone_number": "+18005551212",
         "confirmed_phone": true,
         "locale": "en",
         "created_at": "2021-08-24T21:33:32.804Z",
         "updated_at": "2021-11-19T15:07:22.976Z",
         "last_login_at": "2021-11-19T15:07:21.223Z",
         "locked": false
      },
      {
         "id": 2,
         "username": "user1@example.com",
         "email": "user1@example.com",
         "first_name": "user",
         "last_name": "one",
         "mobile_phone_number": "+12345678",
         "confirmed_phone": false,
         "locale": "en",
         "created_at": "2021-08-24T21:33:32.804Z",
         "updated_at": "2021-11-19T15:07:22.976Z",
         "last_login_at": "2021-11-19T15:07:21.223Z",
         "locked": false
      }
   ]
}

Unsuccessful response

Not Found: HTTP 404

Key Value Description
response_code String not_found
message String More information about the response
HTTP/1.1 404 Not Found

{
   "response_code": "not_found",
   "message": "Could not find the specified role"
}

Assign a Role to a User

Assigns the given role to the specified user.

Your application can assign any role that List All Roles returns. Only an application whose role can grant admin roles, as super admin does, can assign a global role such as admin, and only with its own client credentials token. Any other token gets 404 Could not find the specified role. No application can assign the user role.

Request

Method URL
POST /api/integration/v2/users/{user_id}/roles
Key Value Type Description
user_id Integer URL The user identifier
name String Body The role identifier

Sample request

{
   "name": "help_desk"
}

Response

On success, returns a success response code in the body with 201 (Created) HTTP status.

Successful response
HTTP/1.1 201 Created

{
    "response_code": "success"
}
Unsuccessful response

Not Found: HTTP 404

Key Value Description
response_code String not_found
message String "Could not find the specified user" or "Could not find the specified role"
HTTP/1.1 404 Not Found

{
   "response_code": "not_found",
   "message": "Could not find the specified role"
}

Invalid Data: HTTP 422

Key Value Description
response_code String invalid
errors JSON Map giving the values that had errors and what those errors were.

Unassign a Role from a User

Removes the given role from the specified user.

Only an application whose role can grant admin roles, as super admin does, can remove a role the user holds across all organizations, such as admin, and only with its own client credentials token. If the user holds the role both across all organizations and in yours, any other token removes only your organization's assignment: the call answers 200 and the role stays in the user's role list. No application can remove the user role.

Request

Method URL
DELETE /api/integration/v2/users/{user_id}/roles/{name}
Key Value Type Description
user_id Integer URL The user identifier
name String URL The role identifier

Response

On success, returns a success response code in the body with 200 (OK) HTTP status.

Successful response
HTTP/1.1 200 OK

{
    "response_code": "success"
}
Unsuccessful response

Not Found: HTTP 404

Key Value Description
response_code String not_found
message String "Could not find the specified user", "Could not find the specified role", or, when the user does not hold the role, "Could not find the specified role assignment"
HTTP/1.1 404 Not Found

{
   "response_code": "not_found",
   "message": "Could not find the specified role assignment"
}