Partners API
Kingfisher (Email Service) Endpoints

Authentications

Kingfisher APIs uses Bearer Token as the authentication method. Tokens are valid for seven days and can be extended two days after the expiration date.
post
https://kingfisher.kamva.ir/api
/auth/register
Register User
post
https://kingfisher.kamva.ir/api
/auth/login
Login
delete
https://kingfisher.kamva.ir/api
/auth/logout
Logout
post
https://kingfisher.kamva.ir/api
/auth/refresh
Refresh auth token

Global Authentication Responses

There may be other client error responses, for the APIs that checks the auth token before processing the requests.
In the following sections, we will describe these responses, their structures, and their reasons:

Authentication token is not provided

This error response returns when the Authorization header is empty.
1
{
2
"code": "J1E04",
3
"message": "دسترسی به این قسمت بدون توکن احراز هویت، امکان پذیر نیست."
4
}
Copied!

Invalid token provided

This error response returns when the Authorization header is invalid. It means that the Authorization header value has not Bearer keyword before the token or token has invalid values.
1
{
2
"code": "J1E01",
3
"message": "توکن اشتباه است."
4
}
Copied!

Token is expired

This error response returns when the provided token has expired.
1
{
2
"code": "J1E02",
3
"message": "توکن احراز هویت شما منقضی شده است. لطفا مجددا به سیستم وارد شوید."
4
}
Copied!

Token is blacklisted

This error response returns when the provided token has been blacklisted before.
1
{
2
"code": "J1E03",
3
"message": "توکن احراز هویت شما فاقد اعتبار است."
4
}
Copied!
post
https://kingfisher.kamva.ir/api
/auth/forgot-password
Forgot Password
post
https://kingfisher.kamva.ir/api
/auth/reset-password/:user_id
Reset password

Plan

get
https://kingfisher.kamva.ir/api
/plan
List available plans
get
https://kingfisher.kamva.ir/api
/plan/all
(Admin only) List available plans (Include custom plans)
post
https://kingfisher.kamva.ir/api
/plan
Create new plan(Admin)
put
https://kingfisher.kamva.ir/api
/plan/:receipt_id
update plan (Admin)
Another response for not found plan:
1
{
2
"code": "J3E00",
3
"message": "تعرفه\u200cای با مشخصات ارسال شده پیدا نشد."
4
}
Copied!
delete
https://kingfisher.kamva.ir/api
/plan/:receipt_id
Delete plan (Admin)

Subscription

post
https://kingfisher.kamva.ir/api
/subscription/subscribe
Subscribe
Here we have three state:
  • User have extended receipt: we update it's receipt's plan and price, then redirect to bank gateway and set callback to https://kingfisher.kamva.ir/receipt/verify.
  • User already subscribed : we return 403 forbidden response.
  • User don't have any subscription: we redirect to bank gateway and set callback to https://kingfisher.kamva.ir/verify
kingfisher callback URLs tries to verify payment and redirect the user back to the client. The client verification URL can be customized via PAYMENT_VERIFICATION_URL env variable. Kingfisher also pass some value through query string parameters when redirecting, to specify the status of the payment.
These parameters are:
  • authority [string]: The payment refer_id to show to the user.
  • verified [bool]: Determine whether payment verified by payment gateway or not.
  • status [string]: Determine the status of payment, subscription creation and registration on Sendinblue. It may have one of the following values:
    • success: everything went well.
    • failed: payment not verified in kingfisher side or payment gateway side.
    • cancelled: payment has been cancelled by user.
    • internal_error: some internal error occurred.
  • receipt_id: ID of paying receipt. It is not_found if no receipt found related to payment authority.
  • error_code: when status parameter value is internal_error, an error code will be passed to specify the reason of error.
In some situations, an internal error may occur after verifying payment. It means that payment has been verified successfully – and the money will not return back to the payee account – but some of the operation that will happen after payment verification has been failed. You should find the reason by searching error_code in codes and fix it manually.
Sometime when API returns 200 OK response, sendinblue registration may be failed but successfully queue for retrying.
post
https://kingfisher.kamva.ir/api
/subscription/update/:receipt_id
update subscription receipt
All 4xx error responses in /subscription/subscribe API may return here also.
post
https://kingfisher.kamva.ir/api
/verify-failed
Verify Failed payment
There may be other responses in some situations:
If payment is unsuccessful:
1
{
2
"code": "J2E03",
3
"message": "Payment failed with status code 22|..."
4
}
Copied!
or
1
{
2
"code": "J2E03",
3
"message": "مشکلی در بررسی پرداخت شما رخ داده است، لطفا چند دقیقه بعد مجددا تلاش نمایید."
4
}
Copied!
When the subscription is active but the user calls to this API
1
{
2
"code": "J2E13",
3
"message": "اشتراک شما فعال می باشد."
4
}
Copied!
post
https://kingfisher.kamva.ir/api
/subscription/manual
[Admin Only] subscribe user manually
In addition to the written responses, you need to also check internal error responses.
post
https://kingfisher.kamva.ir/api
/subscription/extend
(Admin only) Extend user's subscription manually
Some other 403 Forbidden responses:
1
{
2
"code":"J2E22",
3
"message":"کاربر ابتدا باید اشتراک بگیرد.(تا به حال اشتراکی نداشته است)"
4
}
Copied!
1
{
2
"code":"J2E23",
3
"message":"بیشتر از ۱۰ روز تا اتمام اشتراک فعلی زمان باقی مانده است."
4
}
Copied!
1
{
2
"code":"J2E26",
3
"message":"رسید تمدید دستی قبلا ایجاد شده است."
4
}
Copied!
1
{
2
"code":"J2E25",
3
"message":"کاربر مورد نظر قبلا رسیدی را جهت تمدید، پرداخت کرده است."
4
}
Copied!
post
https://kingfisher.kamva.ir/api
/subscription/history/extend
(Admin Only) Extend user's extension history
Some other 403 Forbidden responses:
1
{
2
"code":"J2E22",
3
"message":"کاربر ابتدا باید اشتراک بگیرد.(تا به حال اشتراکی نداشته است)"
4
}
Copied!
1
{
2
"code":"J2E29",
3
"message":"تاریخ تمدید باید در گذشته باشد."
4
}
Copied!
post
https://kingfisher.kamva.ir/api
/subscription/trial
[Admin Only] Add Trial User (Deprecated)
If a 200 OK response returns with an empty auth_key field, it means registering user in sendinblue and it has queued for retrying.
post
https://kingfisher.kamva.ir/api
/v1/subscription/trial-existed-user
Give Trial subscription to user (Admin Only)
post
https://kingfisher.kamva.ir/api
/subscription/sponsorship
[Admin Only] Add Sponsorship Account
If a 200 OK response returns with an empty auth_key field, it means registering user in sendinblue and it has queued for retrying.

Credit

post
https://kingfisher.kamva.ir/api
/credit/add
(Admin Only) Add credit to user

Low Credit Reminder Settings

post
https://kingfisher.kamva.ir/api
/credit/threshold
Add low credit threshold settings (Admin Only)
put
https://kingfisher.kamva.ir/api
/credit/threshold/{threshold_settings_id}
Update Low Credit Threshold Settings
delete
https://kingfisher.kamva.ir/api
/credit/threshold/{threshold_settings_id}
Delete low credit threshold settings (Admin Only)

Receipt

get
https://kingfisher.kamva.ir/api
/receipt/{receipt_id}
Get Receipt Info
Client should have a page to show the receipt data before redirecting user to payment gateway. This page url should be like https://<domain>/<path>/<receipt_id>. Since this URL is used in expiration reminder emails and SMSs, it is configurable via RECEIPT_BASE_URL. This variable should contains domain and path part of example url above. for example it should be https://kamva.ir/email/receipt.
In this page we have either "Pay" or "Verify Payment" or "Pay Again" button relative to these scenarios : 1. if the receipt is unverified (verified: false) and authority is false (has_authority: false ) , show a simple "pay" button.
2. If the receipt is unverified but has_authority is true , show "Verify payment" button that on clicked on it, send request to /verify-failed route and get result, if have paymentError result (see description of this route) , hide this button and show "pay again" button that have URL same as "Pay" button.
get
https://kingfisher.kamva.ir/api
/receipt/unpaid
Get unpaid receipt
post
https://kingfisher.kamva.ir/api
/receipt/:receipt_id/update
Update extension receipt (Upgrade receipt)
Other Situations:
If plan id be invalid (404 : Not Found)
1
{
2
"code":"J3E00",
3
"message":"تعرفه‌ای با مشخصات ارسال شده پیدا نشد."
4
}
Copied!
get
https://kingfisher.kamva.ir/api
/receipt/{receipt_id}/pay
Pay Receipt
After the user paid the subscription receipt, will be redirected to https://kingfisher.kamva.ir/verify. In this URL, kingfisher tries to verify payment and redirect the user back to the client. The client verification URL can be customized via PAYMENT_VERIFICATION_URL env variable. Kingfisher also pass some value through query string parameters when redirecting, to specify status of the payment.
These parameters are exactly like the parameter in subscription section.

Discount

get
https://kingfisher.kamva.ir/api
/discount/all
List all discounts (Admin only)
post
https://kingfisher.kamva.ir/api
/discount
Create New Discount (Admin only)
put
https://kingfisher.kamva.ir/api
/discount/:descount_id
Edit discount (Admin only)
post
https://kingfisher.kamva.ir/api
/discount/:discount_id/expire
Expire Discount (Admin only)

IP

get
https://kingfisher.kamva.ir/api
/ip
List IPs (Admin Only)
post
https://kingfisher.kamva.ir/api
/ip/associate
Associate IP to user
post
https://kingfisher.kamva.ir/api
/ip/dissociate
Dissociate IP (Admin Only)

Sender

post
https://kingfisher.kamva.ir/api
/sender
Create Sender (Admin Only)

Info

get
https://kingfisher.kamva.ir/api
/info/malicious-users
Get Malicious users list (Admin Only)

Notification

get
https://kingfisher.kamva.ir/api
/notification/{driver}/settings
Get Notification settings
post
https://kingfisher.kamva.ir/api
/notification/{driver}/settings
Set Notification Settings
get
https://kingfisher.kamva.ir/api
/notification/{driver}/settings
post
https://kingfisher.kamva.ir/api
/{driver}/contact/{server_key:string}/
Insert (update if exists) Contact
get
https://kingfisher.kamva.ir/api
/{driver}
Get notification list
post
https://kingfisher.kamva.ir/api
/{driver}
Create Notification
get
https://kingfisher.kamva.ir/api
/{driver}/{notification_id}
Get Notification Info
put
https://kingfisher.kamva.ir/api
/{driver}/{notification_id}
Update notification
delete
https://kingfisher.kamva.ir/api
{driver}/{notification_id}
Delete Notification
get
https://kingfisher.kamva.ir/api
/lab/healthcheck
Health check

Profile

get
https://kingfisher.kamva.ir/api
/profile
Get Profile Info
patch
https://kingfisher.kamva.ir/api
/profile
Update User Info

Reports

get
https://kingfisher.kamva.ir/api
/report
[Admin Only] Sales Report
Last modified 1yr ago
Copy link
Contents
Authentications
post
Register User
post
Login
delete
Logout
post
Refresh auth token
Global Authentication Responses
post
Forgot Password
post
Reset password
get
SSO Link
Plan
get
List available plans
get
(Admin only) List available plans (Include custom plans)
post
Create new plan(Admin)
put
update plan (Admin)
delete
Delete plan (Admin)
Subscription
post
Subscribe
post
update subscription receipt
get
Get payment link to subscription receipt
post
Verify Failed payment
post
[Admin Only] subscribe user manually
post
(Admin only) Extend user's subscription manually
post
(Admin Only) Extend user's extension history
post
[Admin Only] Add Trial User (Deprecated)
post
Give Trial subscription to user (Admin Only)
post
[Admin Only] Add Sponsorship Account
Credit
post
(Admin Only) Add credit to user
Low Credit Reminder Settings
post
Add low credit threshold settings (Admin Only)
put
Update Low Credit Threshold Settings
delete
Delete low credit threshold settings (Admin Only)
Receipt
get
Get Receipt Info
get
Get unpaid receipt
post
Update extension receipt (Upgrade receipt)
get
Pay Receipt
Discount
get
List all discounts (Admin only)
post
Create New Discount (Admin only)
put
Edit discount (Admin only)
post
Expire Discount (Admin only)
IP
get
List IPs (Admin Only)
post
Associate IP to user
post
Dissociate IP (Admin Only)
Sender
post
Create Sender (Admin Only)
Info
get
Get Malicious users list (Admin Only)
Notification
get
Get Notification settings
post
Set Notification Settings
get
post
Insert (update if exists) Contact
get
Get notification list
post
Create Notification
get
Get Notification Info
put
Update notification
delete
Delete Notification
get
Health check
Profile
get
Get Profile Info
patch
Update User Info
Reports
get
[Admin Only] Sales Report