Points Engine API
This page contains endpoints for additional features that you use to enhance your loyalty program.
Last updated
Was this helpful?
This page contains endpoints for additional features that you use to enhance your loyalty program.
Last updated
Was this helpful?
Use this set of endpoints to manage codes that can be given out to users for points.
POST /codes
Create a new code.
We will give you all your campaign_id
values.
Fields:
value
- value of points the code is worth
The external reward rate will be calculated based on your settings.
eg. if 1 point is 10 miles, then a code of 5 points is worth 50 miles.
campaign_id
- all the IDs for your campaigns will be provided by us
length
- optional. Length of the code to generate.
Minimum: 9
Default: 9
email
- optional. If an email is passed we will also send the user an email with the code generated. You can choose a template or make a new one. Defaults to null
. The email will be validated, failing which, it returns a 400. To send out emails via qiibee, please write to us at .
language
- optional. Language for the email. Defaults to en
reference_id
- optional. type: string
.
is used as a duplicate check, so if it's sent it always needs to be unique for every request. The uniqueness is determined along with the campaign_id
.
For example, you could pass your internal receipt/order ID to make sure that one transaction in your system is never processed twice, even if you happen to send the request twice.
eg.
Responses:
Success: HTTP 201
and the code:
Bad request: HTTP 400
eg. Invalid campaign id or Code length too short
Conflict: HTTP 409
when reference_id
was already used
Manage your NFTs and approve/reject user personalisations like engravings and personal messages.
POST /transactions
Use this endpoint to credit an NFT to the user's account.
Populate the request body with the following fields. All fields are mandatory.
type (string): "credit_nft" indicates the type of transaction.
token_id (number): This is the token ID of your NFT as saved in our system.
user_auth_id (string): The auth ID of the user to whom the NFT should be credited
Example request:
Responses:
Success: HTTP 202
Bad data: HTTP 400
with error message
POST /transactions
Use this endpoint to transfer an NFT from one user's account to another.
Populate the request body with the following fields. All fields are mandatory.
type (string): "nft_transfer" indicates the type of transaction.
token_id (number): This is the token ID of your NFT as saved in our system.
user_auth_id (string): The auth ID of the user to whom the NFT should be transferred from. This user owns the NFT.
user_b_auth_id (string): The auth ID of the user to whom the NFT should be transferred to.
nft_id (number): The ID tied tied to the NFT.
Example request:
Responses:
Success: HTTP 202
Bad data: HTTP 400
with error message
POST /nfts
Use this endpoint to approve or reject a user's NFT personalisation.
If you reject it, the user will receive an email asking them to change the personalisation. You can pick from existing mail templates or create a new one.
All fields are mandatory.
Example request:
GET /nfts
This endpoint returns a list of NFTs that are owned by a given user. You need to pass in the following query parameters:
user_auth_id
: (mandatory) the auth_id of the user who owns the NFTs.
status
: (optional) the status of the NFT. If not sent, it will query the NFTs irrespective of their status. The status can only be one of [null, "pending", "approved", "rejected"]
.
token_id
: (optional) the token ID of a specific NFT. If not sent, the response body will contain all the NFTs that are tied to the sent user_auth_id
.
Example response:
Manage your tokens (loyalty point, NFTs).
GET /tokens/:token_id
This endpoint will fetch a token and the associated with your brand and the specified token_id
. This will also return the amount of points that have been issued and burned of your loyalty point.
Responses:
Success: HTTP 200
with data in the following format:
Bad data: HTTP 400
with error message
Not Found: HTTP 404
GET /tokens/
This endpoint will fetch a list of tokens associated with your brand with the query params as mentioned below.
types: (optional) a list of token types that you want to fetch. Defaults to all token types that qiibee supports.
type: list
eg: ["erc20", "erc721"]
status: (optional) the status of the token. Defaults to all status types that qiibee supports.
type: string
eg: "active", "pending", "stopped", "paused", 'rejected"
An empty list will be returned if no tokens are found.
Response:
Success: HTTP 200
with data in the following format. The tokens will be ordered by their age (date at which created).
Manage your rewards. Eg. Discount Coupons
Users exchange points for a reward.
Soon you will also be able to send rewards to users dynamically.
GET /rewards/:reward
This endpoint will fetch a reward and the associated transaction
, used_at
, anduser_id
if it has already been sent to a user.
Check out the Transactions section of the documentation to see what the loyalty event types are.
Responses:
Success: HTTP 200
with data in the following format:
Bad data: HTTP 404
with error message
eg. not found
PUT /rewards/:reward
| PATCH /rewards/:reward
This endpoint is used to mark a reward as used.
We mark it as used by setting the used_at
property to the UTC time of the request.
Currently, each reward can be used only once.
Success: HTTP 200
with data in the following format:
Conflict: HTTP 409
If the reward was already marked as used
Bad data: HTTP 404
with error message
eg. not found
POST /transactions
The following transaction/loyalty event type is supported to perform this transaction:
points_to_rewards
- redeem points for a reward like a discount coupon
All fields are mandatory.
If you try to exchange more points than the user currently has you'll receive a 400
.
Body:
amount
can be an integer or string.
Accepted: HTTP 202
Bad Request: HTTP 400
eg. unknown transaction type
Bad data: HTTP 404
with error message
eg. not found
GET /transactions
This request returns paginated transaction history.
By default, it returns the last 100 transactions associated with your brand. The most recent transactions are returned first.
You can query transactions using the following query parameters:
limit
: (optional) sets the required limit of transaction history to be requested.
Defaults: 100
Maximum: 100
offset
: (optional) number of transactions to offset when getting the remaining transactions.
Default: 0
user_auth_id
: (optional) Use this parameter to query transactions for a particular user of your brand. If not passed returns all the transactions for your brand. Can be used along with limit
and offset.
types
: (optional) Use this parameter to query transactions for specific loyalty event types. The events must be sent in a list.
Defaults: List of all loyalty event types
token_id
: (optional) This will let you query the transactions for a specific token ID.
Defaults: All tokens that belong to the brand.
from_time
: (optional) queries for transactions that begin from the specified datetime.
Defaults: The datetime at which the brand was created in the qiibee database.
to_time
: (optional) queries for transactions until the specified datetime.
Defaults: The current datetime.
Success: HTTP 200
with data in the following format:
If there are no transactions, an empty transactions
list will be returned. total_tx_count
is the total number of transactions available for the given params.
Bad data: HTTP 404
with error message
eg. not found