VerifyPhoneNumber
Completes verification of the primary contact phone number for the specified
Amazon Web Services account by submitting the one-time passcode (OTP) that was delivered by
SendPhoneNumberVerification. You do not supply a phone number in the
request; the operation verifies the number that the code was sent to. To use this
operation, you must have the account:VerifyPhoneNumber IAM
permission.
If the primary contact phone number changes after you call SendPhoneNumberVerification, this operation returns a
ConflictException. Call SendPhoneNumberVerification
again to send a code to the current phone number. If the code is incorrect or has
expired, request a new code and try again.
For complete details about how to use the primary contact operations, see Update the primary contact for your Amazon Web Services account.
Request Syntax
POST /verifyPhoneNumber HTTP/1.1
Content-type: application/json
{
"AccountId": "string",
"Otp": "string"
}
URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- AccountId
-
Specifies the 12 digit account ID number of the Amazon account that you want to access or modify with this operation.
If you do not specify this parameter, it defaults to the Amazon account of the identity used to call the operation.
To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated administrator account assigned.
Note
The management account can't specify its own
AccountId; it must call the operation in standalone context by not including theAccountIdparameter.To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
Type: String
Pattern:
\d{12}Required: No
- Otp
-
The one-time passcode (OTP) that was sent by SMS to the account's primary contact phone number by a call to SendPhoneNumberVerification. The code expires 5 minutes after it is sent. If you call SendPhoneNumberVerification again, codes that were sent earlier no longer work.
Type: String
Pattern:
[a-zA-Z0-9]{6}Required: Yes
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"Status": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- Status
-
The verification status of the phone number. On a successful call, the value is
VERIFIED: the passcode matched and the account's primary contact phone number is now verified.Type: String
Valid Values:
PENDING | VERIFIED | UNVERIFIED | NOT_SUPPORTED
Errors
For information about the errors that are common to all actions, see Common Error Types.
- AccessDeniedException
-
The operation failed because the calling identity doesn't have the minimum required permissions.
- errorType
-
The value populated to the
x-amzn-ErrorTyperesponse header by API Gateway.
HTTP Status Code: 403
- ConflictException
-
The request could not be processed because of a conflict in the current status of the resource. For example, this happens if you try to enable a Region that is currently being disabled (in a status of DISABLING) or if you try to change an account’s Amazon Web Services email to an email address which is already in use.
- errorType
-
The value populated to the
x-amzn-ErrorTyperesponse header by API Gateway.
HTTP Status Code: 409
- InternalServerException
-
The operation failed because of an error internal to Amazon. Try your operation again later.
- errorType
-
The value populated to the
x-amzn-ErrorTyperesponse header by API Gateway.
HTTP Status Code: 500
- ResourceNotFoundException
-
The operation failed because it specified a resource that can't be found.
- errorType
-
The value populated to the
x-amzn-ErrorTyperesponse header by API Gateway.
HTTP Status Code: 404
- TooManyRequestsException
-
The operation failed because it was called too frequently and exceeded a throttle limit.
- errorType
-
The value populated to the
x-amzn-ErrorTyperesponse header by API Gateway.
HTTP Status Code: 429
- ValidationException
-
The operation failed because one of the input parameters was invalid.
- fieldList
-
The field where the invalid entry was detected.
- message
-
The message that informs you about what was invalid about the request.
- reason
-
The reason that validation failed.
HTTP Status Code: 400
Examples
Example 1
The following example verifies the primary contact phone number of the account whose credentials are used to call the operation.
Sample Request
POST / HTTP/1.1
X-Amz-Target: AWSAccountV20210201.VerifyPhoneNumber
{
"Otp": "123456"
}
Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"Status": "VERIFIED"
}
Example 2
The following example verifies the phone number for the specified member account in an organization. You must use credentials from either the organization's management account or from the Account Management service's delegated admin account.
Sample Request
POST / HTTP/1.1
X-Amz-Target: AWSAccountV20210201.VerifyPhoneNumber
{
"AccountId": "123456789012",
"Otp": "123456"
}
Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"Status": "VERIFIED"
}
See Also
For more information about using this API in one of the language-specific Amazon SDKs, see the following: