A new version of our Web API has been released!
This documentation has been updated to reflect those changes, however, we do reserve the right to make changes without a prior notice.

Introduction

Welcome to the offical documentation of Affbay Web API.

Here you will be able to learn and understand how our API works, how to authenticate , what are our endpoints and what status codes you can receive, what will undoubtedly help you with debugging your integration.

Please be aware that usage of previous API bases (listed below) has been depreciated and is now not supported. From now on you should be only using https://efirstpanel.com/api as the base API URL for any of your implementations.

URL API Version Status
efirstpanel.com/api 2.0
promos-seru.com/api 1.0
penirum-indonesia.com/api 1.0
leferyprofessional.com/api 1.0
saran-dokter.com/api 1.0
pro-dee.com/api 1.0

Getting started

We've prepared an amazing PHP wrapper of our API to kick-start your integration.

The wrapper can be found on our GitHub repository and it contains, along with a base to integrate your service with just few modifications and a full instruction manual covering all the steps, a set of examples of different approaches on how to best facilitate and use our API.

Authentication

To use most of publicly available endpoints you need a Partner Token. This is an unique identifier that tells us who is making a request, so we can provide the best service to all of our users.

To generate your Partner Token please visit your tokens section of your account settings and click "Generate" on corresponding item. Shortly after you should see your brand new Partner Token. You will always be able to find your token there, but be aware you won't be able to re-generate it again, so please keep it safe as we do reserve the right to block temporally or permanently any token used in requests acting against our Terms and Conditions.

Methods

Currently, as our API is used solely to create new resources (contacts), it supports only POST method.

ID Method Endpoints Description
1 POST /make/contact /make/contacts Creates resources
2 GET N/A Retrieves resources
3 PUT N/A Changes and/or replaces resources or collections
4 DELETE N/A Deletes resources
5 OPTIONS N/A Returns available (and defined) options, methods and extra information (e.g. documentation)

Rate Limiting

Rate Limiting enables Web API to share access bandwidth to its resources equally across all users.

Rate limiting is applied as per application based on Partner Token, and regardless of the number of users who use the application simultaneously.

Note: If Web API returns status code 429, it means that you have sent too many requests. When this happens, check the Retry-After header, where you will see a number displayed. This is the number of seconds that you need to wait, before you try your request again.

Responses

Web API returns all response data as a JSON object. See the Endpoints section for a description of all the retrievable objects.

Product SKUs

One of the biggest differences between versions 1 and 2 of the Web API is use of Product SKUs instead of product names.

We offer so many products, that usage of product names as identifiers for all of the products and their variations was getting more and more confusing. Therefore we introduced SKU - Stock Keeping Unit.

We issued an unique SKU identifier to all products in our offer. You can find them on our products list or in their corresponding details page.

Please be aware and noticed that any further usage of product names is not supported and therefore will always lead to an error.

Note: If Web API returns status code 400, it means that you have sent wrong product SKU. The response should look somehow like this:

curl -X POST --header 'Accept: application/json' -d 'first_name=Joe&last_name=Doe&phone=1234567890&click_id=1234&token=XXXXXXXX&product=wrong-product-sku' 'https://efirstpanel.com/api/make/contact'

{
    "status": "invalid product name"
}

Endpoints

Explore all publicly available endpoints of Affbay API.
Hint: click to expand

POST /make/contact Create a single lead
Implementation Notes

You can make a request to our API to create a lead using token you got before.

Successful Response (Status 200)
{"status":"contact: 617 created", "id":"617", "click_id":"123456"}
Parameters
Parameter Value Description Parameter Type Data Type
first_name Contact's first name formData string
last_name Contact's last name formData string
email Contact's email formData string
phone Contact's phone number formData string
phone2 Alternative Contact's phone number formData string
click_id A random, unique, alphanumerical click identifier provided by your system formData string
token Your authentication token formData string
product Product SKU gathered from http://affbay.asia/products formData string
pub_id formData integer
base_url formData string
ext_price formData string
Response:

                                        
Response Messages
HTTP Status Code Reason Response
200 Lead Created
{"status":"contact: 617 created", "id":"617", "click_id":"123456"}
200 Fields Missing
{"status":"required fields missing"}
200 Invalid SKU
{"status":"invalid product name"}
200 Phone number duplicate
{"status":"double phone"}
200 Invalid token
{"status":"client not found, token mismatch"}
POST /make/contacts Create multiple leads
Implementation Notes

You can make a request to our API even to create up to 25 leads per request.

Successful Response (Status 200)
[
    {"status":"ok", "id":"617", "click_id":"123456"},
    {"status":"ok", "id":"618", "click_id":"123456"}
]
Parameters
Parameter Value Description Parameter Type Data Type
first_name Contact's first name formData string
last_name Contact's last name formData string
phone Contact's phone number formData string
phone2 Alternative Contact's phone number formData string
email Contact's email formData string
click_id A random, unique, alphanumerical click identifier provided by your system formData string
pub_id formData integer
base_url formData string
ext_price formData string
product Product SKU gathered from http://affbay.asia/products formData string
token Your authentication token formData string
Response:

                                        
Response Messages
HTTP Status Code Reason Response
200 Lead Created
[{"status":"contact: 2189 created","id":2189,"click_id":"12345"}]
200 Fields Missing
[{"status":"{field_names} missing", "phone":"1234567890", "first_name":"first_name", "last_name":"last_name", "click_id":"123456"}]
200 Invalid SKU
[{"status":"invalid product name", "phone":"1234567890", "first_name":"first_name", "last_name":"last_name", "click_id":"123456"}]
200 Phone number duplicate
[{"status":"double phone", "phone":"1234567890", "first_name":"first_name", "last_name":"last_name", "click_id":"123456"}]
200 Invalid token
{"status":"client not found, token mismatch"}
200 Rate limit
{"status":"out of 25 contacts limit"}
200 Phone Number Duplicate
{"status":"{field_names} missing"}
200 Invalid Token
{"status":"out of 25 contacts limit"}

Migration

If you have been using previous version of our Web API you will need to migrate your integration to the 2.0 version.

Your Partner Token

Shortly before official release of the new Web API, you should have received a message sent via any known communication channel we do have an information about. The message contained instructions and your new Partner Token.

If for some reason you have troubles finding your Partner Token or you haven't received our message, please contact us immediately and we will help to sort this out.

Product names

Following the release of the Web API 2.0 we've depreciated the usage of product names as the product parameter value.

To learn more about our reasons and the new SKU system, please refer to the Product SKUs section of this documentation.

API base URL

We have disabled and depreciated all old API bases. Please refer to Introduction's API base URLs table to find an address of supported API base URL.

Endpoints

When you're migrating from previous version of our API, endpoints hasn't changed too much. We've changed some parameter names and their formats to reflect changes in Product SKUs referencing, but we tried to keep the new version of the API as much backward-compatible as possible. Please do have a read of Endpoints section of this documentation to have a better look at pursued changes.

Contact & support

We try to make this documentation as simple and accessible as possible. However, we do understand that technical terms and aspects can be difficult and may often lead to misstatements or not provide all information needed. Therefore, when you should have any further questions or need an explaination of anything mentioned in this document, please do not hesitate to give us a shout, as we encourage all our partners to do so, in order to prevent service disruptions and errors on either side.

The best way to contact us is to drop us an email at support@affbay.asia or using our contact form.

We target to give you a first-off reply within 24 bussiness hours.