# SIXR API

## /auth

<mark style="color:green;">`POST`</mark> `https://partnerapi.six.th/v1/auth`

This endpoint allows you to let user do authentications &#x20;

#### Headers

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| x-api-id  | string | An API id   |
| x-api-key | string | An API key  |

#### Request Body

| Name        | Type   | Description                                                                                                                                                                                                              |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| authrequest | object | <p><code>{</code><br>  <code>"phone\_number": "+66875556666"</code><br><code>}</code> <br><br><strong><code>phone\_number</code></strong> : Country code is needed to put at the beginning without ‘0’ leading. <br></p> |

{% tabs %}
{% tab title="200 Successful request, user will receive SMS with OTP" %}

```javascript
{
  "success": true,
  "data": {
    "ref_no": "GDDNE",
    "transaction_id": "07816604-9caf-45b6-ace2-e4e3565193dc"
  }
}
```

{% endtab %}

{% tab title="500 Fatal error, unexpected error." %}

```javascript
{
  "success": false,
  "message": "System error"
}
```

{% endtab %}
{% endtabs %}

## /auth

<mark style="color:orange;">`PUT`</mark> `https://partnerapi.six.th/v1/auth`

This endpoint allows you to let user do authentications

#### Headers

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| x-api-id  | string | An API id   |
| x-api-key | string | An API Key  |

#### Request Body

| Name        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| authrequest | object | <p><code>{</code><br>  <code>"ref\_no": "GDDNE",</code><br>  <code>"transaction\_id": "07816604-9caf-45b6-ace2-e4e3565193dc",</code><br>  <code>"confirm\_code": "554133"</code><br><code>}</code><br><br><strong><code>ref\_no</code></strong> : Random 5 alphabet character referenced to OTP code which will also be part of the SMS message.<br><br><strong><code>transaction\_id</code></strong> : Reference transaction id refer to generated OTP code. This code will not seen by the user.<br><br><strong><code>confirm\_code</code></strong> : 6--digits of number received via user’s SMS message.</p> |

{% tabs %}
{% tab title="200 Successful request, user will receive SMS with OTP" %}

```javascript
{
  "success": true,
  "data": {
    "ref_no": "GDDNE",
    "transaction_id": "07816604-9caf-45b6-ace2-e4e3565193dc",
    "user_id": "80a0e232-58b8-45f9-b1a7-c91bd97c7b2d",
    "username": "sixruser",
    "wallet_user": true
  }
}
```

{% endtab %}

{% tab title="400 Bad request with error code" %}

```javascript
{
  "success": true,
  "error_code": 50,
  "error_message": "No operation."
}

/*
About error_code
50  : No operation for the request
206 : Confirm code not matched
*/
```

{% endtab %}
{% endtabs %}

## /users

<mark style="color:green;">`POST`</mark> `https://partnerapi.six.th/v1/users`

#### Headers

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| x-api-id  | string | An API id   |
| x-api-key | string | An API KEY  |

#### Request Body

| Name              | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| createUserRequest | object | <p><code>{</code><br>  <code>"ref\_no": "GDDNE",</code><br>  <code>"transaction\_id": "07816604-9caf-45b6-ace2-e4e3565193dc",</code><br>  <code>"username": "foo"</code><br><code>}</code><br><br><br><strong><code>ref\_no</code></strong> : Ref No. of the OTP which has been already verified.<br><br><strong><code>transaction\_id</code></strong> : The transaction ID of the OTP which has been already verified.<br><br><strong><code>username</code></strong> : Decided username.</p> |

{% tabs %}
{% tab title="200 Successful request, user will receive SMS with OTP" %}

```javascript
{
  "user_id": "07816604-9caf-45b6-ace2-e4e3565193dc"
}
```

{% endtab %}

{% tab title="400 Bad request with error code" %}

```javascript
{
  "success": true,
  "error_code": 50,
  "error_message": "No operation."
}

/*
About error_code
50	: No operation for the request
120	: Verified OTP has expired
220	: Decided username already exists
*/
```

{% endtab %}

{% tab title="500 Fatal error, unexpected error." %}

```javascript
{
  "success": false,
  "message": "System error"
}
```

{% endtab %}
{% endtabs %}

## /transactions/reward-six

<mark style="color:green;">`POST`</mark> `https://partnerapi.six.th/v1/transactions/reward-six`

#### Headers

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| x-api-id  | string | An API id   |
| x-api-key | string | An API Key  |

#### Request Body

| Name            | Type   | Description                                                                                                                                                                                                                                                                                                     |
| --------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| rewardTxRequest | object | <p><code>{</code><br> <code>"user\_id": "07816604-9caf-45b6-ace2-e4e3565193dc",</code><br> <code>"sixr\_amount": 10</code><br><code>}</code><br><br><strong><code>user\_id</code></strong> : Generated user identifier<br><br><strong><code>sixr\_amount</code></strong> : Amount of SIXr to reward to user</p> |

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

```javascript
{
  "success": true,
  "data": {
    "tx_id": "a90b3dc20f28a861e687488eec68ca5a3af4165ca6930fb79e38011792b5da14"
  }
}
```

{% endtab %}

{% tab title="400 Bad request with error code" %}

```javascript
{
  "success": true,
  "error_code": 50,
  "error_message": "No operation."
}

/*
About error_code
50	: No operation for the request
210	: User not found
*/
```

{% endtab %}

{% tab title="500 Fatal error, unexpected error." %}

```javascript
{
  "success": false,
  "message": "System error"
}
```

{% endtab %}
{% endtabs %}

## /sixr/redeems/claims

<mark style="color:green;">`POST`</mark> `https://partnerapi.six.th/sixr/redeems/claims`

For claim SIXR

#### Request Body

| Name                | Type   | Description                                                                                                                                                                                                                                                 |
| ------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x-six-authorization | string | SIX Authorization                                                                                                                                                                                                                                           |
| claimRequest        | object | <p><code>{</code> <br>  <code>"reward\_id": "828",</code> <br>  <code>"qty": 5</code><br><code>}</code><br><br><br><strong><code>reward\_id</code></strong> : Known as product ID to be claimed<br><strong><code>qty</code></strong> : Claimed quantity</p> |

{% tabs %}
{% tab title="200 Successful request, client will receive status and transaction id" %}

```
{
  "status": 0,
  "message": "string",
  "body": {
    "id": "string",
    "event_type": "string",
    "model_type": "string",
    "timestamp": 0,
    "asset_type": "string",
    "asset_issuer": "string",
    "amount": 0,
    "amount_usd": 0,
    "amount_thb": 0,
    "memo": "string",
    "ref_code": "string",
    "tx_id": "string",
    "direction_type": "string",
    "from": {
      "wallet": {
        "model_type": "string",
        "id": "string",
        "type": "string",
        "asset_type": "string",
        "memo": "string",
        "address": "string",
        "balance": 0
      },
      "previous_balance": 0,
      "current_balance": 0
    },
    "to": {
      "wallet": {
        "model_type": "string",
        "id": "string",
        "type": "string",
        "asset_type": "string",
        "memo": "string",
        "address": "string",
        "balance": 0
      },
      "previous_balance": 0,
      "current_balance": 0
    }
  }
}
```

{% endtab %}

{% tab title="500 Fatal error, unexpected error." %}

```
{
  "success": false,
  "message": "System error"
}
```

{% endtab %}
{% endtabs %}

## /sixr/tx

<mark style="color:green;">`POST`</mark> `https://partnerapi.six.th/sixr/tx`

#### Request Body

| Name                | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x-six-authorization | string | SIX Authorization                                                                                                                                                                                                                                                                                                                                                                                                   |
| txRequest           | object | <p><code>{</code> <br>  <code>"type": "Payment",</code><br>  <code>"asset\_name": "SIXR",</code><br>  <code>"to\_username": "v"</code><br><code>}</code><br><br><br><strong><code>type</code></strong> : Tx type, for now it’s only Payment<br><strong><code>asset\_name</code></strong> :  Asset name, now there’s only SIXR<br><strong><code>to\_username</code></strong> :  Username of the destination user</p> |

{% tabs %}
{% tab title="200 Successful request, client will receive status and transaction id" %}

```
{
  "status": "Success",
  "tx_id": "e-fbeab1f3-5671-49ef-854c-1b8d993cb92c"
}

/*
tx_id : The returned transaction id.
*/
```

{% endtab %}

{% tab title="500 Fatal error, unexpected error." %}

```
{
  "success": false,
  "message": "System error"
}
```

{% endtab %}
{% endtabs %}
