Use this API to initiate enrollment for user with a given authentication factor. If the authentication factor requires confirmation to complete, then the device will have an status of pending otherwise it will have a status of accepted (corresponding to devices that are either pending confirmation or not)
To change the state of the device to be accepted, the registration id, and the `otp` would need to be sent to the Verify a Factor endpoint.
For OneLogin Voice, the end user must type the OTP code into the phone, and verification can be complted using this Verify a Factor endpoint.The API supports enrollment of support for SMS, Voice, Email, Google Authenticator, and OneLogin Protect. Other factors can be enrolled manually by the user.
Resource URL
https://<subdomain>.onelogin.com/api/2/mfa/users/<user_id>/registrationsHeader Parameter
Authorization required string | Set to Set The access token must have been generated using an API credential pair created using the scope required to call this API. This API can be called using the |
Resource Parameter
user_id required integer | Set to the If you don't know the user's |
Request Parameters
factor_id required integer | The identifier of the factor to enroll the user with. See Get Available Factors for a list of possible |
display_name required string | A name for the users device |
expires_in string | Defaults to 120. Valid values are: 120-900 seconds. |
verified boolean | Defaults to false. The following factors support verified = Factors such as |
redirect_to string | Optional. Only applies to Email MagicLink factor. Redirects MagicLink success page to specified URL after 2 seconds. Email must already be configured by the user. |
custom_message string | Optional. Only applies to SMS factor. A message template that will be sent via SMS. Max length of the message after template items are inserted is 160 characters including the OTP code. SMS must already be configured by the user. The following template variables can be included in the message.
|
Request Body
{
"factor_id": 58959,
"display_name": "OneLogin SMS"
}Sample Responses
OneLogin SMS
- 201 Created
- 401 Unauthorized
[
{
"id": "a89ea78d-59fd-4ec2-8b62-b6796ff9e7b3",
"status": "pending",
"auth_factor_name": "SMS",
"type_display_name": "OneLogin SMS",
"user_display_name": "OneLogin SMS",
"expires_at": "2020-07-21T17:27:34Z"
}
]{
"statusCode": 401,
"name": "InvalidCredentials",
"message": "Please provide valid credentials"
}
```json
</div>
</div>
### OneLogin Protect
<div class="code-tabs">
<ul class="tab-links" role="tablist">
<li class="t-link active" data-tab="1" role="tab" aria-selected="true" tabindex="0">200 OK</li>
<li class="t-link" data-tab="2" role="tab" aria-selected="false" tabindex="0">401 Unauthorized</li>
</ul>
<div class="tab-views">
```json
[
{
"id": "36c6cf4c-a315-46ce-81f9-a91a475488cf",
"status": "pending",
"auth_factor_name": "OneLogin",
"type_display_name": "OneLogin Protect",
"user_display_name": "OneLogin Protect",
"factor_data": {
"verification_token": "01-1912451",
"totp_url": "otpauth://totp/bsimons:brandon.simons%2Badmin%40onelogin.com?secret=01-1912451"
}
]{
"statusCode": 401,
"name": "InvalidCredentials",
"message": "Please provide valid credentials"
}
```json
</div>
</div>
### OneLogin Voice
<div class="code-tabs">
<ul class="tab-links" role="tablist">
<li class="t-link active" data-tab="1" role="tab" aria-selected="true" tabindex="0">200 OK</li>
<li class="t-link" data-tab="2" role="tab" aria-selected="false" tabindex="0">401 Unauthorized</li>
</ul>
<div class="tab-views">
```json
[
{
"id": "500b41d2-4c6d-4fb3-928b-44d8c0afa19b",
"status": "pending",
"auth_factor_name": "OneLogin Voice",
"type_display_name": "OneLogin Voice",
"user_display_name": "OneLogin Voice",
"expires_at": "2020-07-21T18:11:54Z",
"factor_data": {
"verification_token": "144613"
}
}
]{
"statusCode": 401,
"name": "InvalidCredentials",
"message": "Please provide valid credentials"
}
```json
</div>
</div>
### OneLogin Email
<div class="code-tabs">
<ul class="tab-links" role="tablist">
<li class="t-link active" data-tab="1" role="tab" aria-selected="true" tabindex="0">200 OK</li>
<li class="t-link" data-tab="2" role="tab" aria-selected="false" tabindex="0">401 Unauthorized</li>
</ul>
<div class="tab-views">
```json
[
{
"id": "83bf1253-2011-4f75-aa67-c100330156f5",
"status": "pending",
"auth_factor_name": "OneLogin Email",
"type_display_name": "OneLogin Email",
"user_display_name": "OneLogin Email",
"expires_at": "2020-07-21T18:14:09Z"
}
]{
"statusCode": 401,
"name": "InvalidCredentials",
"message": "Please provide valid credentials"
}
```json
</div>
</div>
### Authenticator
<div class="code-tabs">
<ul class="tab-links" role="tablist">
<li class="t-link active" data-tab="1" role="tab" aria-selected="true" tabindex="0">200 OK</li>
<li class="t-link" data-tab="2" role="tab" aria-selected="false" tabindex="0">401 Unauthorized</li>
</ul>
<div class="tab-views">
```json
[
{
"id": "922f6f3b-424a-43eb-aafb-3f45596f0fc5",
"status": "pending",
"auth_factor_name": "Google Authenticator",
"type_display_name": "Authenticator",
"user_display_name": "Authenticator",
"factor_data": {
"verification_token": "d5j3sck2s7hh3nxzkxj5p7nt5yk2a75d",
"totp_url": "otpauth://totp/brandon.simons%2Badmin%40onelogin.com?secret=d5j3sck2s7hh3nxzkxj5p7nt5yk2a75d&issuer=bsimons"
}
}
]{
"statusCode": 401,
"name": "InvalidCredentials",
"message": "Please provide valid credentials"
}
```json
</div>
</div>
<h2>Response Elements</h2>
<table width="86%" cellpadding="10">
<tbody>
<tr>
<td valign="top" style="text-align: right" >
<p><code>status</code></p>
</td>
<td valign="top">
<p><code>accepted</code> : factor has been verified. <code>pending</code>: registered but has not been verified.</p>
</td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>default</code></td>
<td valign="top"><code>True</code> = is user's default MFA device for OneLogin. </td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>expires_at</code></td>
<td valign="top">A short lived token that is required to <a href="/api-docs/2/multi-factor-authentication/verify-factor">Verify the Factor</a>. This token expires based on the <code>expires_in</code> parameter passed in.</td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>auth_factor_name</code></td>
<td valign="top">"Official" authentication factor name, as it appears to administrators in OneLogin. </td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>type_display_name</code></td>
<td valign="top">Authentication factor display name as it appears to users upon initial registration, as defined by admins at <em>Settings > Authentication Factors.</em></td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>user_display_name</code></td>
<td valign="top">Authentication factor display name assigned by users when they enroll the device<em>.</em></td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>id</code></td>
<td valign="top">MFA device identifier. </td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>factor_data</code></td>
<td valign="top">Array of factor specific properties. For example, the token or totp code for OneLogin Protect.</td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>verification_token</code></td>
<td valign="top">The token which can be used to verify the factor registration.</td>
</tr>
<tr>
<td valign="top" style="text-align: right"><code>totp_url</code></td>
<td valign="top">OTP Url that can be leveraged for any authenticator that supports the key uri format. Url can be used with client libraries to display QR Code for streamlined end-user registration.</td>
</tr>
</tbody>
</table>
<h2 id="postman-collection">Postman Collection</h2>
[<img src=https://run.pstmn.io/button.svg alt="Run In Postman" style="width: 128px; height: 32px;">](https://god.gw.postman.com/run-collection/2629710-07192ad9-633a-4583-a9d1-47bc89c8c91d?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D2629710-07192ad9-633a-4583-a9d1-47bc89c8c91d%26entityType%3Dcollection%26workspaceId%3D2a9bbc3a-4259-4faf-9f51-0b7ca1df3fd0)
<h2>Sample Code</h2>
<h3 id="sample-curl-request">cURL</h3>
<p>Replace sample values indicated by <code>< ></code> with your actual values.</p>
<pre><code class="prettyprint lang-c">curl 'https://<subdomain>.onelogin.com/api/2/mfa/users/<user_id>/registrations' \
-X POST \
-H "Authorization: bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"factor_id": 16282,
"display_name": "Rich's Phone"
}'</code>
</pre>Have a Question?
Found a problem or a bug? Submit a support ticket.
Looking for walkthroughs or how-to guides? Check out our Knowledge Base.
Have a product idea or request? Share it in our Ideas Portal.