Tutorial: User accounts overview

The tutorials in this section demonstrate user account activities in Tilia services. They also initialize the environment variables for the tutorials that demonstrate other aspects of Tilia services.


You must run the tutorials in this section before running requests in other Tilia demonstration collections or tutorials. These tutorials prepare the environment variables used by the other tutorials.

Review the next section to find the path through these tutorials that best fits your situation.

Choose your path through the tutorials

The following table shows two paths that you can take through these tutorials:

  • If this is your first time running the tutorials, follow the sequence in the Create new users column. These tutorials demonstrate common user account tasks and create the user accounts that are used by other tutorials.
  • If you've run these tutorials before and:
    • You want to use existing user accounts or repeat a tutorial, follow the sequence in the Recall existing users .
    • You want to create new users, follow the sequence in the Create new users column with new usernames.
Create new users Recall existing users
1. Get an access token 1. Get an access token
2. Create new users 2. Recall existing users
3. Buy tokens 3. Get wallet info, if not already set in the environment variables
4. Get wallet info 4. View wallet balances
5. View wallet balances 5. Buy tokens, if necessary
6. Manage user account TOS and KYC, run all except the reset requests 6. Manage user account TOS and KYC skip, if already set

You can always create new user accounts, if that's what you need to learn or study. However, when using existing user accounts, some of the steps are optional. This can save you some time by skipping unnecessary initialization steps.

API operations in the user account tutorials

Tutorial Tilia APIs demonstrated Environment variables initialized
Manage new user accounts Register account
Search by username
Buy tokens Get payment methods
Initiate token purchase
Execute token purchase
View user account wallets Get wallets by account
Get wallets balances
Manage user account TOS and KYC TOS and KYC N/A

Get an access token

Get an access token for the requests in the _Manage user accounts collection.

Each request requires an authentication header with a valid access token that has the necessary scope for the request.

This request obtains an access token with the scopes required by the tutorials in the _Manage user accounts collection. After you've requested an access token, Postman adds the required authentication header to the subsequent requests in the collection.

For more information about access tokens, visit Request access token.

To get your access token for this collection, in Postman:

  1. Near the top right of the request, above the request URL, choose the Tilia Client Info environment.
  2. In the _Manage user accounts collection, in the Start here folder, open the Get an access token request, and then choose the Body tab.
  3. In the Body tab, notice that the client_id and client_secret properties use the environment variables that you assigned in Get started with the tutorials .
  4. Choose Send (to the right of the request's URL field) to request the access token.
  5. If the request was successful:
    1. The access_token value is saved in the last_tilia_access_token collection variable.
    2. Review the response body.
    3. Review the Collection variables to confirm that the Current value of last_tilia_access_token also has the token value.
  6. If the request returns an error, review the response body for more information about the problem. Also, check that the correct environment is selected and that there are no errors in your Tilia developer credential values.

A typical response body looks like the following.


With that, you're ready to run the rest of the requests in the collection.

Your access token is only good for an hour

In the response body of the Get an access token request, notice the value of the expires_in property. That value is the duration, in seconds, that the token is valid. In this case, the token is valid for 3,600 seconds, which is one hour. After an hour, the requests you make return a response body like the following.

    "status": "Failure", 
    "message": [],
    "codes": [],
    "payload": { 
        "error": "token is expired"

If you get this response body later, return to the collection's Start here folder, open the Get access token request, and then send it again to get a new token for the collection.

Next steps

Create or recall your user accounts in Manage new user accounts.