Create a User
All requests to the /v2/users/*
endpoints must include both the client_id
and api_key
as detailed in the
Authentication document.
Create and verify a user to your application
.
Creating a Users
Creating users happens through the /v2/users endpoint. Once hit, a dots user will be created if one does not exist based on phone number. This user must then be verified through a one-time code sent over text-message. This code can be requested through the /v2/users//send-verification-token endpoint and then verified through the /v2/users//verify endpoint.
Method
Make a POST
request to the /v2/users endpoint
> curl https://pls.senddotssandbox.com/api/v2/users \
-X POST \
-u "CLIENT_ID:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "test@senddots.com",
"country_code": "1",
"phone_number": "1234567890",
"first_name": "Bob",
"last_name": "Loblaw",
"username": <Optional>
}'
> response = {
"id": "143c7e1c-2295-42c0-9fc9-23756ac26250",
"first_name": "Bob",
"last_name": "Loblaw",
"email": "test@senddots.com",
"phone_number": {
"country_code": "1",
"phone_number": "1234567890"
},
"wallet": {
"amount": 0,
"withdrawable_balance": 0,
"credit_balance": 0
},
"compliance": {
"tax_id_collected": false,
"address_collected": false,
"date_of_birth_collected": false,
"1099_collected": false,
"w8_ben_collected": false,
"flagged": false
}
}
Parameters
Name | Type | Required | Description |
---|---|---|---|
string | ✔️ | User’s email address | |
country_code | string | ✔️ | User’s phone number country code without the plus sign (‘1’ for the US) |
phone_number | string | ✔️ | User’s phone number as a string containing only digits |
first_name | string | ✔️ | User’s first name as a string |
last_name | string | ✔️ | User’s last name as a string |
username | string | User’s username on your platform. If the username is taken or left blank a random username will be generated | |
metadata | string/object/null | Optional metadata to be stored with the user |
Verifying the created User
Once a user is created, they must be verified through a one-time code sent over text-message. This process can be done using Flows or through the API.
Verify using a Flow
Dots’ pre built components can be used to verify the user. Information on flows can be found here.
Verify through the API
1. Send a verification token by making a POST
request to the /v2/users//send-verification-token endpoint
> curl https://pls.senddotssandbox.com/api/v2/users/{user_id}/send-verification-token \
-X POST \
-u "CLIENT_ID:API_KEY" \
3. Submit the verification token by calling the /v2/users//verify endpoint
curl https://pls.senddotssandbox.com/api/v2/users/{user_id}/verify \
-X POST \
-u "CLIENT_ID:API_KEY" \
-H "Content-Type: application/json" \
-d '{
"token": "123456"
}'
Parameters
Name | Type | Required | Description |
---|---|---|---|
token | string | ✔️ | Verification token sent to the user’s phone number |