Users API
Use these APIs to to perform actions related to your users (members).
The id and auth_id are 2 different fields and are not interchangeable.
When using our Loyalty API, if you want to take an action on a user’s account, you need to use the auth_id.
The auth_id can be set by you if you register users using our Loyalty API. So, for example, you could set it to the primary key you have for the user in your own systems. This saves you the trouble of creating another column to map users in your system to the user profile with qiibee.
However, if you prefer qiibee that generates a new unique identifier for every new user registration, simply leave the auth_id field empty and we will generate a UUID-v4 and return it to you so you can save it in your system. The user_id shown in the Loyalty Whitelabel App (LWA) frontend is different from the auth_id and is used exclusively for the LWA frontend.

Create User

POST /users
Only the email field is mandatory. The email will be validated, failing which, will return a 400.
We recommend you send a unique UUID-v4 auth_id for every new user registration so you can map each user to your internal system. If you do not send this field we will generate a UUID-v4 and return it to you.
Please save the auth_id and use it for all actions on a user's account.
eg.
1
{
2
"user": {
3
"id": "3r2esf3423r",
4
"email": "[email protected]",
5
"auth_id": "e24c962d-c81c-4a01-b0cd-57dd233553f1",
6
"first_name": "John",
7
"second_name": "Doe",
8
"language": "en",
9
"country_ISO": "usa",
10
"metadata": {
11
"opts_newsletter": true | false
12
}
13
}
14
}
Copied!

Responses

  • Created: HTTP 201 with the user object
  • Bad data: HTTP 400 with error message
    • eg. duplicate auth_id

Update User details

PUT /users/:auth_id || PATCH /users/:auth_id
You can update every field besides the auth_id
eg.
1
{
2
"user": {
3
"id": "3r2esf3423r",
4
"email": "[email protected]",
5
"first_name": "John",
6
"second_name": "Smith",
7
"language": "it",
8
"country_ISO": "usa",
9
"metadata": {
10
"opts_newsletter": true | false
11
}
12
}
13
}
Copied!

Responses

  • Update: HTTP 200 with the user object
  • Not found: HTTP 404 with error message

Get List of Users

GET /users/
This request returns a paginated list of users. By default, it returns the last 100 users associated with your brand, along with the total count of the users.
You can query transactions using the following query parameters:
  • limit: (optional) sets the required limit of users history to be requested.
    • Defaults: 100
    • Maximum: 100
  • offset: (optional) number of users to offset when getting the remaining users.
    • Default: 0
The params, limit and offset, work exactly as they’re used in SQL.
Responses
  • Success: HTTP 200 with the user object:
    • 1
      {
      2
      "data": {
      3
      "users": <list_of_users>,
      4
      "offset": 0,
      5
      "limit": 100,
      6
      "total_count": <total_count_of_users>
      7
      }
      8
      }
      Copied!
  • Bad data: HTTP 404 with error message
    • eg. not found

Get User Details

GET /users/:auth_id

Responses

  • Success: HTTP 200 with the user object:
    • 1
      {
      2
      "data": {
      3
      "id": "3r2esf3423r",
      4
      "email": "[email protected]",
      5
      "auth_id": "e24c962d-c81c-4a01-b0cd-57dd233553f1",
      6
      "first_name": "John",
      7
      "second_name": "Doe",
      8
      "language": "en",
      9
      "country_ISO": "usa",
      10
      "metadata": null | {
      11
      "opts_newsletter": true | false
      12
      }
      13
      }
      14
      }
      Copied!
  • Bad data: HTTP 404 with error message
    • eg. not found

Create User Membership

POST /users/:auth_id/memberships
All fields are mandatory.
Each user can have 1 membership per exchange provider. You can override the membership number in specific requests - for example, when exchanging points to miles you can provide a new membership number specifically for that request.
exchange_provider_implementation_name can be one of:
  • etihad
  • miles_and_more
The membership number will be validated. If you want to know how you can validate the numbers yourself please reach out to us and we will provide the algorithms for each exchange provider.
eg.
1
{
2
"membership": {
3
"exchange_provider_implementation_name": "etihad" | "miles_and_more",
4
"membership_number": "xxxx....xxx"
5
}
6
}
Copied!

Responses

  • Created: HTTP 201 with the user object
  • Not found: HTTP 404
    • user not found
  • Bad data: HTTP 400 with error message
    • invalid format for the membership number
    • invalid exchange provider

Update User Membership

Same as Create User Membership.

Get User Memberships

GET /users/:auth_id/memberships
This will return all the memberships for a user. If no memberships exist for the user this will be an empty array.
eg.
1
{
2
"data": [
3
{
4
"membership_number": "xxx...xxxx",
5
"exchange_provider": {
6
"name": "Miles and More",
7
"implementation_name": "miles_and_more"
8
}
9
},
10
{
11
"membership_number": "yyy...yyyy",
12
"exchange_provider": {
13
"name": "Etihad",
14
"implementation_name": "etihad"
15
}
16
}
17
]
18
}
Copied!

Get User Membership

GET /users/:auth_id/memberships/:implementation_name
Returns the membership information for a user for a particular exchange provider implementation, if found, 404 and empty object otherwise.
eg.
1
{
2
"data": {
3
"membership_number": "xxx...xxx",
4
"exchange_provider": {
5
"implementation_name": "etihad",
6
"name": "Etihad"
7
}
8
}
9
}
Copied!
Responses
  • Success: HTTP 200 with membership
  • Not found: HTTP 404 if user or membership not found

Delete User Membership

DELETE /users/:auth_id/memberships/:implementation_name
Deletes the membership information for a user if it exists. Returns 404 if user or membership not found.
eg.
1
{
2
"data": {
3
"membership_number": "xxx...xxx",
4
"exchange_provider": {
5
"implementation_name": "etihad",
6
"name": "Etihad"
7
}
8
}
9
}
Copied!
Responses
  • Success: HTTP 204
  • Not found: HTTP 404 if user or membership not found
  • Bad request: HTTP 400 if the implementation does not exist