> For the complete documentation index, see [llms.txt](https://switchng.gitbook.io/switch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://switchng.gitbook.io/switch/user.md).

# User

```
STAGING_URL: https://switchapi3.azurewebsites.net
LIVE_URL: https://switchapi.azurewebsites.net
```

## Get user info

<mark style="color:blue;">`GET`</mark> `https://switchapi3.azurewebsites.net/user`

This endpoint allows you to get user info

#### Headers

| Name          | Type   | Description                                                         |
| ------------- | ------ | ------------------------------------------------------------------- |
| Authorization | string | The format of \`**Authorization**\` is \`**Bearer token\_string\`** |

{% tabs %}
{% tab title="200 user successfully retrieved." %}

```javascript
{
  "message": "User retrieved successfully",
  "data": {
    "id": "11",
    "email": "beyonceknowles@gmail.com",
    "phone": "+2348154634619",
    "first_name": "Beyonce",
    "last_name": "Knowles",
    "date_of_birth": "1981-09-04",
    "photo_id_url": "+2348154634619_id_card_beyonce.jpg",
    "image_selfie_url": "+2348154634619_image_selfie_url_beyonce.jpg",
    "signature_url": null,
    "address": "19, Okotie Eboh",
    "is_verified": false,
    "gender": "female",
    "country": "NG",
    "blacklisted": false,
    "switch_id": 100111,
    "two_factor_authentication_enabled": true,
    "two_factor_authentication_type": "pin",
    "phone_verified": true,
    "pin_set": true,
    "payment_link_slug": "100111",
    "city": "Ikoyi",
    "state": "Lagos",
    "zipcode": "101233",
    "last_sign_in": "2019-02-11T13:21:59.409Z",
    "photo_id_issuer": null,
    "photo_id_number": null,
    "photo_id_expiry": null,
    "switch_bank_account_name": null,
    "switch_bank_account_number": null,
    "google_auth_set_up": false,
    "nigerian_contact_name": null,
    "nigerian_contact_phone": null,
    "nigerian_contact_address": null,
    "nigerian_contact_relationship": null,
    "switch_bank_customer_id": null,
    "disabled": false,
    "has_pending_disable_request": false,
    "has_pending_enable_request": false,
    "fraud_status": "whitelisted",
    "verified_at": null,
    "verification_requested": false,
    "bvn": null,
    "security_question_set": true,
    "is_diaspora": false,
    "has_wallet": true,
    "invite_link": "http://localhost:3000/register/100111"
  }
}
```

{% endtab %}
{% endtabs %}

## Get user balance

<mark style="color:blue;">`GET`</mark> `https://switchapi3.azurewebsites.net/user/balance`

This endpoint retrieves the user's balance.

#### Headers

| Name          | Type   | Description                                                          |
| ------------- | ------ | -------------------------------------------------------------------- |
| Authorization | string | The format for **Authorization** is ***Bearer*** ***token\_string*** |

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

```
#Unverified user
{
    "message": "User balance retrieved successfully",
    "data": {
        "wallet": {
            "main_balance": 2278497,
            "soft_balance": 2278497
        }
    }
}

#Verified user
{
    "message": "User balance retrieved successfully",
    "data": {
        "wallet": {
            "main_balance": 500000,
            "soft_balance": 500000
        },
        "account": {
            "main_balance": 13917367,
            "soft_balance": 13932617
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Change password

<mark style="color:green;">`POST`</mark> `https://switchapi3.azurewebsites.net/user/update_password`

Change user password

#### Headers

| Name        | Type   | Description                                               |
| ----------- | ------ | --------------------------------------------------------- |
| auth\_token | string | Format of ***auth\_token*** is ***Bearer token\_string*** |

#### Request Body

| Name                   | Type   | Description                 |
| ---------------------- | ------ | --------------------------- |
| password\_confirmation | string | password confirmation       |
| password               | string | The new password            |
| current\_password      | string | The user's current password |

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

```
{
    "message": "User password changed successfully",
    "data": {
        "id": 1,
        "email": "omitirand@gmail.com",
        "first_name": "Demilade",
        "last_name": "Omitiran",
        "phone": "+2348184392899",
        "date_of_birth": "1995-12-13",
        "gender": "male",
        "country": "Nigeria",
        "is_verified": false,
        "blacklisted": false,
        "pin_set": true,
        "phone_verified": true,
        "two_factor_authentication_enabled": true,
        "bvn": "22xxxxxx380",
        "address": "Alagomeji",
        "photo_id_url": "https://drive.google.com/open?id=1-RjU8CngD7dpnGMxaqFq1WIBPI9OIc6x",
        "image_selfie_url": "https://drive.google.com/open?id=1-RjU8CngD7dpnGMxaqFq1WIBPI9OIc6x",
        "signature_url": "https://drive.google.com/open?id=1-RjU8CngD7dpnGMxaqFq1WIBPI9OIc6x",
        "switch_id": 1,
        "payment_link_slug": "payment.link.com",
        "city": "Yaba",
        "state": "Lagos",
        "full_address": "Alagomeji Lagos Yaba 100001",
        "zipcode": "100001",
        "last_sign_in": "2019-02-20T10:04:05.281Z",
        "photo_id_expiry": "2020-04-01T00:00:00.000Z",
        "photo_id_issuer": "national_id_card",
        "photo_id_number": "11",
        "verification_requested": true,
        "wallet": {
            "wallet_balance": "0.0",
            "soft_balance": "0.0"
        },
        "authenticator_uri": "otpauth://totp/SWITCH:omitirand@gmail.com?secret=4do6n2znuburdnme&issuer=SWITCH",
        "two_factor_authentication_type": "pin",
        "security_question_set": true
    }
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "message": "Error occurred changing password",
    "errors": {
        "password": [
            "has been used previously. Please try a new password"
        ]
    }

```

{% endtab %}
{% endtabs %}

## Get Wallet Balance

<mark style="color:blue;">`GET`</mark> `https://switchapi3.azurewebsites.net/user/balance/wallet`

This endpoint retrieves wallet balance.

#### Headers

| Name          | Type   | Description                   |
| ------------- | ------ | ----------------------------- |
| SWI-CID       | string | Client ID                     |
| Authorization | string | Format is ***Bearer token***. |

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

```
{
    "message": "User wallet balance retrieved successfully",
    "data": {
        "main_balance": 3532000,
        "soft_balance": 4532000,
        "currency": "NGN"
    }
}
```

{% endtab %}
{% endtabs %}

## Get Savings Account Balance

<mark style="color:blue;">`GET`</mark> `https://switchapi3.azurewebsites.net/user/balance/account`

This endpoint retrieves the user's savings account balance.

#### Headers

| Name          | Type   | Description                  |
| ------------- | ------ | ---------------------------- |
| SWI-CID       | string | Client ID                    |
| Authorization | string | Format is ***Bearer token*** |

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

```
{
    "message": "User savings account balance retrieved successfully",
    "data": {
        "main_balance": 0,
        "soft_balance": 0,
        "account_number": "0072137711",
        "currency": "NGN"
    }
}
```

{% endtab %}
{% endtabs %}

## Get Dom Account Balance

<mark style="color:blue;">`GET`</mark> `https://switchapi3.azurewebsites.net/user/balance/dom_accounts`

This endpoint retrieves the balances of all the user's dom accounts.

#### Headers

| Name          | Type   | Description                   |
| ------------- | ------ | ----------------------------- |
| SWI-CID       | string | Client ID                     |
| Authorization | string | Format is ***Bearer token***. |

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

```
{
    "message": "User domiciliary account balance retrieved successfully",
    "data": [
        {
            "main_balance": 0,
            "soft_balance": 0,
            "account_number": "0072137711",
            "currency": "USD"
        }
    ]
}
```

{% endtab %}
{% endtabs %}
