# Account Activation

This is the first section and covers how to activate a users wallet.

Before starting a user needs to accept the Terms of service ( /profile/tos )

Then the user's phone number and email will need to be provided. ( /activate/request )

A one-time password is sent to the user by SMS which they need to send back through the App. ( /activate/otp/verify )

When these steps are complete the user's wallet will be created.

Users can set a password during the activation process, although it is not mandatory. ( /profile/update )

## Flow <a href="#activation-flow" id="activation-flow"></a>

![](/files/-MjTVh5pCacP4Jm3YJJK)

## /profile/tos

<mark style="color:green;">`POST`</mark> `https://sandbox.walletengine.io/api/profile/tos`

Terms of service retrieval and acceptance. To retrieve the terms of service for your app, you need to supply your AppID to the following URL.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name    | Type   | Description                                                 |
| ------- | ------ | ----------------------------------------------------------- |
| app\_id | string | This is the unique App ID assigned to you by Wallet Engine. |

{% tabs %}
{% tab title="200 " %}

```
{
  "tos": {
    "last_updated": "2021-09-15",
    "meta_text": "html string",
    "link": [
      "https://www.walletengine.io/tos"
    ]
  }
}
```

{% endtab %}

{% tab title="500 " %}

```
{
    "code": 500,
    "error": "invalid_arguments",
    "message": "The method was called with invalid arguments."
}
```

{% endtab %}
{% endtabs %}

**Errors**\
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing.

| **Error**           | **Description**                                                                                       |
| ------------------- | ----------------------------------------------------------------------------------------------------- |
| `invalid_arguments` | The method was called with invalid arguments.                                                         |
| `invalid_arg_name`  | The method was passed an argument whose name falls outside the bounds of accepted or expected values. |

## /api/activate/request

<mark style="color:green;">`POST`</mark> `https://sandbox.walletengine.io/api/activate/request`

You need to provide Wallet Engine with basic user information so that the users account can be created. The information below should be harvested from your customer and sent to Wallet Engine using the following API.

#### Path Parameters

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name                | Type   | Description                                                    |
| ------------------- | ------ | -------------------------------------------------------------- |
| app\_id             | string | This is the unique App ID assigned to you by Wallet Engine.    |
| country\_dial\_code | number | The country code of the user's phone number.                   |
| phone\_number       | number | The phone number to send the verification code.                |
| email\_address      | string | Email to send KYC link.                                        |
| nickname            | string | Name for in app display.                                       |
| tos\_accepted       | string | Time and date stamp of when the user clicked accept of the TOS |

{% tabs %}
{% tab title="200 Successfully." %}

```
{
  "valid": true,
  "request_id": "string"
}
```

{% endtab %}

{% tab title="500 The method was called with invalid arguments." %}

```
{
    "code": 500,
    "error": "invalid_arguments",
    "message": "The method was called with invalid arguments."
}
```

{% endtab %}
{% endtabs %}

**Example Request**

```
{
  "app_id": "5db2a50be7626",
  "country_dial_code": "65",
  "phone_number": "909099999",
  "email_address": "username@email.com",
  "nickname": "FooB",
  "tos_accepted": "2021-09-20 10:50:59"
}
```

**Errors**\
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing.

| **Error**                    | **Description**                                                                                                               |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `invalid_arguments`          | The method was called with invalid arguments.                                                                                 |
| `invalid_arg_name`           | The method was passed an argument whose name falls outside the bounds of accepted or expected values.                         |
| `fatal_error`                | The server could not complete your operation(s) without encountering a catastrophic error.                                    |
| `invalid_country_code`       | Invalid country code. <https://countrycode.org/>                                                                              |
| `invalid_app_id`             | App ID does not exist, blocked, out of service…                                                                               |
| `age_verification_fail`      | The DOB supplied 18+. Users must be over 18 years old.                                                                        |
| `nat_country_not_allowed`    | Citizenship from this country is not allowed. (country\_nat\_code)                                                            |
| `res_country_not_allowed`    | Residents of this country are not allowed. (country\_res\_code)                                                               |
| `country_is_restricted`      | Clients from this country cannot create a wallet. Country code unknown. The country is not configured in WE.                  |
| `phone_number_is_registered` | The phone number already exists with this App ID.                                                                             |
| `phone_number_has_desisted`  | The phone number verification has to be reinitiated. It was not possible to send an OTP message to the phone number provided. |

## /api/activate/otp/verify

<mark style="color:green;">`POST`</mark> `https://sandbox.walletengine.io/api/activate/otp/verify`

Wallet Engine will send a One Time Passcode by SMS to the mobile number of the user. The user enters the passcode in the App to verify themselves. Once the passcode has been successfully verified then a wallet account is set up for the user and the details of the users new wallet account are returned.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name        | Type   | Description                                                       |
| ----------- | ------ | ----------------------------------------------------------------- |
| app\_id     | string | This is the unique App ID provided by Wallet Engine for your App. |
| request\_id | string | The Request Id is generated by WE Gateway.                        |
| passcode    | number | The passcode sent to the phone number in the previous step.       |

{% tabs %}
{% tab title="200 Successfully." %}

```
{
  "profile": {
    "kyc_level": 0,
    "kyc_status": "OK",
    "client_id": "931917458",
    // ...
  },
  "accounts": [
    {
      "account_id": "EWCV144",
      "account_state": "approved",
      "currency_code": "SGD",
      "available_balance": 0,
      // ...
    }
  ]
  "token": "string"
}
```

{% endtab %}

{% tab title="500 The method was called with invalid arguments." %}

```
{
    "code": 500,
    "error": "invalid_arguments",
    "message": "The method was called with invalid arguments."
}
```

{% endtab %}
{% endtabs %}

**Errors**\
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing.

| **Error**                   | **Description**                                                                                                               |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `invalid_arguments`         | The method was called with invalid arguments.                                                                                 |
| `invalid_arg_name`          | The method was passed an argument whose name falls outside the bounds of accepted or expected values.                         |
| `invalid_request_id`        | The Request Id is expired or invalid.                                                                                         |
| `invalid_passcode`          | The passcode is expired or invalid.                                                                                           |
| `phone_number_has_desisted` | The phone number verification has to be reinitiated. It was not possible to send an OTP message to the phone number provided. |

## /api/profile/update

<mark style="color:green;">`POST`</mark> `https://sandbox.walletengine.io/api/profile/update`

Users can define a password for their account during the activation process. We recommend the Customer App hash the password before send to WE Gateway.

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer {{token}} |
| Content-Type  | string | application/json |

#### Request Body

| Name     | Type   | Description                                                                                                                                                                                                                      |
| -------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app\_id  | string | This is the unique App ID assigned to you by Wallet Engine.                                                                                                                                                                      |
| password | string | <p>The user’s password. Password is not required for access via an App, but will be used in the future for portal access.<br>We recommend the Customer App hash the password before send to WE Gateway.<br>Ex: md5(password)</p> |

{% tabs %}
{% tab title="200 Successfully." %}

```
{
  "valid": true
}
```

{% endtab %}

{% tab title="500 The method was called with invalid arguments." %}

```
{
    "code": 500,
    "error": "invalid_arguments",
    "message": "The method was called with invalid arguments."
}
```

{% endtab %}
{% endtabs %}

**Example Request**

```
{
    "app_id": "5db2a50be7626",
    "password": "*** ***"
}
```

**Errors**\
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing.

| **Error**                | **Description**                                                                                       |
| ------------------------ | ----------------------------------------------------------------------------------------------------- |
| `invalid_arguments`      | The method was called with invalid arguments.                                                         |
| `invalid_arg_name`       | The method was passed an argument whose name falls outside the bounds of accepted or expected values. |
| `invalid_user_authorize` | WE Gateway can not authorize the user. Invalid App User Token.                                        |
| `fatal_error`            | The server could not complete your operation(s) without encountering a catastrophic error.            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.walletengine.io/account-activation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
