---
# System prepended metadata

title: Untitled

---

**Verify API**
----
  To update user's status.

* **URL**

  Staging: https://mega1-point-kyc-service-dev.yeah1group.com/v1/hd/verify

* **Method:**
  
  `POST`
  
* **Data Params**

   **Required:**
 
  `phone_number=[string]`

  _User's phone number_

  `timestamp=[number]`

  _Unix timestamp to check signature expiration, a request will be expires in 5 minutes_

  `token=[string]`

  _HD bank token_

  `status=[SUCCEEDED | FAILED]`

  _User's status need to be update_

   **Optional:**
 
   `failure_causes=[string]`

   _If status = "FAILED", you can add this param to let's we know why it's failed_

* **Success Response:**
  
  Each successful request will be push to task queues, then execute sequentially.

  * **HTTP status:** 200 OK <br />
    **Content:** `{ "code": 2000, "data" : { "job_id" : "3d7f270fe937b18a21a9ddf3" } }`
 
* **Error Response:**
  
  * **HTTP status:** 200 OK <br />
    **Content:** `{ "code": 4220, "message" : "phone_number is required" }`

    **Content:** `{ "code": 4221, "message" : "status is required" }`

    **Content:** `{ "code": 4222, "message" : "timestamp is required" }`

    **Content:** `{ "code": 4223, "message" : "token is required" }`

    **Content:** `{ "code": 4224, "message" : "invalid status" }`
    
    **Content:** `{ "code": 4225, "message" : "invalid phone" }`

    **Content:** `{ "code": 4227, "message" : "invalid timestamp" }`

    **Content:** `{ "code": 4018, "message" : "get signature from header failed" }`

    **Content:** `{ "code": 4011, "message" : "request has expired" }`

    **Content:** `{ "code": 4031, "message" : "Forbidden" }` (Check encrypt algorithm with provided secret key or IP whitelisting)

    **Content:** `{ "code": 4290, "message" : "Too Many Requests" }`

    **Content:** `{ "code": 4040, "message" : "cannot find user's phone: 123" }`

* **Sample Call:**

  ```bash
  curl --location --request POST 'https://mega1-point-kyc-service-dev.yeah1group.com/v1/hd/verify' \
  --header 'signature: vwzqZzEAqlbMOYpIeygw6TixfGlHyHYKLKzXa/6qyIU=' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "phone_number": "0700000567",
      "status": "SUCCEEDED",
      "timestamp": 1626764851 ,
      "token": "123"
  }'
  ```

* **Encrypt signature**
  
  To get signature attached to header, use HMAC-SHA256 algorithm to encrypt raw body, then encode with Base64.

  Javascript sample:
  ```Javascript
    function generateSignature() {
      const rawBody = '{}' // Body will be post
      const secretKey = '123' // Provided secret key

      const sign = CryptoJS.HmacSHA256(rawBody, secretKey)
      const signature = CryptoJS.enc.Base64.stringify(sign)
      return signature
    }
  ```