SMS One-Time Password (OTP) set up request.

POST /api/v1/me/sms/setup

This endpoint is used to set up SMS OTP based two-factor authentication.

Upon receiving a valid mobile phone number (two_factor_mobile) it will send a verification code via SMS to the supplied mobile phone number and return a status code of 422 Unprocessable Entity.

You will then need to verify receipt of the code by submitting the code (two_factor_sms_token) AND the mobile phone number (two_factor_mobile) in a subsequent request to the endpoint.

If the submitted two_factor_sms_token is invalid we will return a status code of 422 Unprocessable Entity.

Upon receipt of a valid mobile phone number AND a verified code the endpoint will return a status code of 200 OK.

Headers

application/json

Body Required

  • two_factor_mobile string Required

    The mobile number that 2FA tokens should be sent to.
    Format defaults to GB (+447539995949).
    You can provide an array ["country" => "AU", "number" => "+61 2 3456 7890"] if you want to use a different format.

  • The 6-digit token/code that was present in the SMS sent to the mobile number.
    Required after a valid mobile number has been provided.

Responses

  • 422 application/json

    Initial request unsuccessful

    Hide response attributes Show response attributes object
  • 422 (1) application/json

    Initial request successful subsequent request required

    Hide response attributes Show response attributes object
  • 422 (2) application/json

    Subsequent request unsuccessful

    Hide response attributes Show response attributes object
  • 200 text/plain

    SMS setup successful

POST /api/v1/me/sms/setup
curl \
 -X POST https://api.plannrcrm.com/api/v1/me/sms/setup \
 -H "Authorization: Bearer {OAUTH_ACCESS_TOKEN or PERSONAL_ACCESS_TOKEN}" \
 -H "Content-Type: application/json" \
 -H "Accept: application/json" \
 -d '{"two_factor_mobile":"07539995949","two_factor_sms_token":"123789"}'
Request examples
# Headers
Authorization: Bearer {OAUTH_ACCESS_TOKEN or PERSONAL_ACCESS_TOKEN}
Content-Type: application/json
Accept: application/json

# Payload
{
  "two_factor_mobile": "07539995949",
  "two_factor_sms_token": "123789"
}
Response examples (422)
{
  "errors": {
    "two_factor_mobile": [
      "Please enter a valid mobile phone number. If there is no country specified, we will assume the phone number is a GB number."
    ]
  },
  "message": "Please enter a valid mobile phone number. If there is no country specified, we will assume the phone number is a GB number."
}
Response examples (422 (1))
{
  "errors": {
    "two_factor_sms_token": "Please enter the authentication code that we've sent to your mobile phone."
  },
  "message": "Please enter the authentication code that we've sent to your mobile phone."
}
Response examples (422 (2))
{
  "errors": {
    "two_factor_sms_token": "The authentication code is incorrect."
  },
  "message": "The authentication code is incorrect."
}
Response examples (200)
{"status":"SMS OTP setup complete using mobile phone number +447539995949."}}