Skip to main content

User

Introduction

This page explains the functionalities such as user connection, disconnection, checking biometric status, connecting wallets, obtaining userId via email, redeeming discounts, saving products, deleting products and scan history records, retrieving and updating user information, as well as deleting user accounts. For testing, please insert "https://sandbox-staging-app.berify.io" into the {domain} section of the URL.

Check biometrics status

POST /user/{userId}/biometrics/status-check

Checks the status of the given user’s biometric authentication (e.g., NotSet, Match, NotMatch, etc) based on the userId.

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string

Request body:

  • publicKey: string

Example:

https://{domain}/api/user/{userId}/biometrics/status-check

Response:

  • status: string
  • error: string
{
"status": "NotSet" | "Match" | "NotMatch"
}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Connect wallet

POST /user/{userId}/wallet

Saves the wallet number to the specific user's data in the database, based on the given userId. If the update is successful, it means that the wallet has been successfully linked to the user's account.

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string

Request body:

  • address: string

Example:

https://{domain}/api/user/{userId}/wallet

Response:

  • userId: string
  • address: string
  • error: string
{
"userId": "c738ef3b-a882-40ef-a7e8-0474178f6631",
"address": "0x5890b********************888e479ab14ea52"
}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Get userId by email

GET /user/{userId}/getUserIdByEmail/{email}

Saves the wallet number to the specific user's data in the database, based on the given userId. If the update is successful, it means that the wallet has been successfully linked to the user's account.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string
  • email: string

Example:

https://{domain}/api/user/{userId}/getUserIdByEmail/{email}

Response:

  • user:
    • id: string
  • error: string
{
"user": {
"id": "c738ef3b-a882-40ef-a7e8-0474178f6631"
}
}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Save product

POST /user/{userId}/save-product/{batchId}

Adds product(s) to a user's following list (or cart) and saves it to the database.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string
  • batchId: string

Example:

 https://{domain}/api/user/{userId}/save-product/{batchId}

Response:

  • error: string
{}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Remove product

DELETE /user/{userId}/save-product/{batchId}

Removes product(s) to a user's following list (or cart) and removes it from the database.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string
  • batchId: string

Example:

https://{domain}/api/user/{userId}/save-product/{batchId}

Response:

  • error: string
{}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Remove scan history

DELETE /user/{userId}/scan-history/{id}

Deletes a user’s specific scanned tag record from the database based on the scanId of the given record.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string
  • id: number

Example:

https://{domain}/api/user/{userId}/scan-history/{id}

Response:

  • error: string
{}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Remove all scan history

DELETE /user/{userId}/scan-history

Deletes all of a given user's scanned tag records from the database.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string

Example:

https://{domain}/api/user/{userId}/scan-history

Response:

  • error: string
{}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Get user

GET /user/{userId}

Retrieves the user's account information, including firstName and lastName.

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Optional header:

  • Berify-App-User-Id: string

Request parameters:

  • userId: string

Example:

https://{domain}/api/user/{userId}

Response:

  • user:
    • email: string
    • phone: string
    • firstName: string
    • lastName: string
  • error: string
{
"user": {
"email": "test@gamil.com",
"phone": "+1-582***743",
"firstName": "Kevin",
"lastName": "Chen"
}
}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Update user

PUT /user/{userId}

Updates the user’s account information, which includes image, firstName, and lastName.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string

Request body:

  • image: string
  • firstName: string
  • lastName: string
  • username: string

Example:

https://{domain}/api/user/{userId}

Response:

  • user:
    • id: string
    • email: string
    • phone: string
    • image: string
    • firstName: string
    • lastName: string
  • error: string
{
"user": {
"id": "c738ef3b-a882-40ef-a7e8-0474178f6631",
"email": "test@gamil.com",
"phone": "+1-582***743",
"image": "https://textimage.image.com",
"firstName": "Kevin",
"lastName": "Chen"
}
}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Delete user

DELETE /user/{userId}

Deletes the user’s account.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string

Example:

https://{domain}/api/user/{userId}

Response:

  • user:
    • id: string
    • email: string
    • emailVerified: Date
    • phone: string
    • phoneVerified: Date
    • image: string
    • firstName: string
    • lastName: string
    • password: string
    • salt: string
    • biometricsKey: string
    • isDelete: boolean
    • isActive: boolean
    • isAdmin: boolean
  • error: string
{
"user": {
"id": "c738ef3b-a882-40ef-a7e8-0474178f6631",
"email": "test@gmail.com",
"emailVerified": "2024-03-14T09:28:26.770Z",
"phone": "+1-582***743",
"phoneVerified": "2024-03-14T09:28:26.770Z",
"image": "https://textimage.image.com",
"firstName": "Kevin",
"lastName": "Chen"
"password": "59bea5d30f920706a193d************************17ac1be88eb5bd85e1291840f3a6592a79776",
"salt": "'bae*****-****-****-****-*****c970a32'",
"biometricsKey": "MIIBIjANBgkqhkiG9**********CAQ8AMIIBCgKCAQEAudd/JHncJ/************************************************************/cpNj2nON44WsrI16IIQGiqnqtvk883CO3YcZ+5yYiO3u**********bhWkVYGT2F0hwSE/************************************************************/yRB7PM+ZnhAFVDLJO**********ePBUuwxH6nqw6/************************************************************",
"isDelete": true,
"isActive": true,
"isAdmin": true
}
}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.

Get wallet

GET /user/{userId}/wallet

Retrieves a specific user's wallet based on the given userId.

Optional header:

  • Berify-App-User-Id: string

Request header:

  • secretKey: string. Use "App-Berify-Secret".
  • secret: string

Request parameters:

  • userId: string

Example:

https://{domain}/api/user/{userId}/wallet

Response:

  • address: string[]
  • error: string
{
"address": [
"0x5890b********************888e479ab14ea52"
]
}

HTTP status code summary:

  • 200 (OK) - Everything worked as expected.
  • 401 (Unauthorized) - Invalid or missing access token.
  • 405 (Method Not Allowed) - Unacceptable HTTP method for requested resource.