Create user
What is a user?
When creating a user through the Original API, you are essentially creating a unique user in our system to which will be attached one or more wallets (depending on the number of blockchain your app is operating on).
For more information about wallets, refer to the section wallets and security.
Create a user
Important:
Request headers are required. See API basics introduction for more information.
Endpoint
POST /user
- Creates a new
user
associated with the given app (set by the X-API-KEY). - Returns a new
user
(user uid
) associated with the given app.
Note:
The request is asynchronous. This means that the
user uid
will be immediately returned. The wallet will be created asynchronously later on the first on-chain usage (mint or deposit).
- To know if a user has a wallet you can poll any Get user details endpoint. A user not having wallet does not stop you from minting an asset for a newly created
user uid
.- To know when a user wallet has been created, you can also subscribe to the Webhook events Wallet created
If you send a
create asset
request while the a user has no wallet yet, the request will be handled asynchronously once the wallet creation process is complete. Therefore, you don't need to poll or wait for the wallet - you can start sending thecreate asset
request immediately after receiving theuser uid
.
Request body
Request body fields | Type | Description | Required/Optional |
---|---|---|---|
user_external_id | String | The unique ID by which you identify this user in your system. It can be explicitly null. | Optional |
email | String (URL) | The unique email address by which you identify this user in your system. It can be explicitly null. | Optional |
Tips
In the context of Creating a user:
user_external_id
refers to your own unique identifier in your system to identify the user. This can be their social ID or any other identifier that you use to identify a user in your app.
Request example
Sample: request body
{
"user_external_id": "user_external_id_1",
"email": "[email protected]"
}
Note: Both user_external_id and email are optional so you can send one or the other, both, or an empty request body
Response
Response example
Sample: 201 Created Response
You will receive a uid
which refers to the user's uid:
{
"success": true,
"data": {
"uid": "452711987655", // (user uid)
}
}
You can use this uid
to call the other User endpoints. For example, GET /user/{uid}
with this uid
will return the user's details.
This is the same uid
that will be seen on the developer console under App > Users.
Example
The following example creates a user for your app with user_external_id your-id-12 and email [email protected].
# API_KEY is your api key
# TOKEN is the access token generated with your api key secret
curl -i \
-X POST \
-d "{\"user_external_id\":\"your-id-12\",\"email\":\"[email protected]\"}" \
-H "Content-Type: application/json" \
-H "X-Api-Key: API_KEY" \
-H "Authorization: Bearer TOKEN" \
"https://api.getoriginal.com/v1/user"
Updated 3 months ago