Tokopedia Open Platform — and how to use it
Disclaimer: This is not the official guide for Tokopedia Open Platform. I just worked on this project, and wanted to share and summarise of what is already available on the official documentation website.
Open Platform
Tokopedia Open Platform is an API service that enables third-party partners to connect with Tokopedia APIs.
As defined in our documentation website, we have 8 features that you could access using APIs. For example, in Product API, we could programmatically create a new product (in fact up to 20 products per request) without navigating to your seller dashboard.
- Webhooks API: Register webhook to get notifications through your system.
- Product API: Create and manage products with/without variants.
- Order API: Get order info and manage all incoming orders.
- Logistic API: Manage your Third-party logistics service.
- Shop API: View and Update Shop Information.
- Category API: Get all product category information.
- Interaction API: Get all messages, replies, and send a reply.
- Statistic API: Get the statistics of your transactions and buyers.
To use these features, you will need to have a token (which will be explained below), knowledge of using a REST API, and additionally, knowledge of the webhook concept (which will also be explained below).
Developer Console
To connect to our API, you would need an application that provides the necessary data to generate your token. And here are complete steps on how to get those data.
1. Register Your Developer Account
First of all, you should be logged in to tokopedia.com using your current account. After logging in, if you have not yet created a Developer Account, you would be prompted with a Registration Page. Simply fill the fields required below to complete registration.
As pictured above, there’s Company Name
, PIC Name
, Contact Number
, and Business Registration Certificate (SIUP)
which pretty straightforward. And then there’s a type of member, and system choice.
Third-party Enabler is an external entity providing an application that manages multiple sellers’ orders, inventory, etc.
Seller (Official Store only) is an official store merchant which would like to provide their own system to manage their orders, inventory, etc.
InHouse is usually a merchant which have multiple stores, and they would like to manage all of their different stores in a single system.
Third-Party is similar as defined in the type of member choice, but this choice is extended to Sellers (Official Store only) who would also like to manage other merchant’s orders, inventory, etc.
2. Waiting for Approval
After successfully registering your Developer Account, you should be prompted with this image.
This means that our business team is currently validating your information. And when your application is either approved or rejected, you would receive an email notifying it.
3. Creating an Application
After being approved by our business team, you can now access our Developer Console.
New Developers usually served with an empty list of applications, with an Add Application button provided. There are 3 available options in creating a new application.
- Live Application — is an application that provides a connection to Tokopedia’s live environment, in this type of application, we could connect to a real merchant.
- Test Application — is a testing application that is created solely for testing purposes. Tokopedia also provides a buyer and seller account to simulate the real-life experience of a transaction.
- Use Existing Credentials — the choice is provided for our partners that are already our partners before the release of the Developer Console feature. If you are reading this, it’s most likely that you don’t need this option.
4. Authenticating
After creating an application, we can enter the application menu by clicking the application card. We then will be provided with multiple menus on the sidebar.
- Authentication Management — contains your application credentials which can and will be used in this section.
- Shop Management (for live applications only)— is a feature that enables your system to register a live shop so that your requests are allowed to manage the shop programmatically.
- Playground — is provided to let Developers quickly figure out how does our request and response looks like.
- Buyer Account (for test applications only) — contains buyer account for testing purposes.
- Seller Account (for test applications only) — contains seller account for testing purposes.
Back to the topic of Authentication your request, we should navigate to Authentication Management, in here you can see your app_id
(formerly known as fs_id
), client_id
, and client_secret
.
Using client_id
and client_secret
above, we should make an API call to this endpoint to receive your access_token
. Below is the example request.
curl -X POST \
'https://accounts.tokopedia.com/token?grant_type=client_credentials' \
-H 'Authorization: Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQK' \
-H 'Content-Length: 0' \
-H 'User-Agent: PostmanRuntime/7.17.1'
The Authorization
header above is generated from client_id
, and client_secret
using base64
with the format of client_id:client_secret
. Below provided an example function using Node.js to generate your Authorization token.
function base64encode(clientId, clientSecret){
let buff = new Buffer(`${clientId}:${clientSecret}`);
return buff.toString('base64');
}
After making a request to the endpoint above, we should receive a response that looks like this.
{
"access_token": "LSPr7x7sRGaewzwZE6IcuA",
"expires_in": 2592000,
"token_type": "Bearer"
}
And there you go, the access_token
field is the token you will be using for authenticating all of your requests.
5. Trying an endpoint
Let’s try our recently acquired access_token
to request the simplest endpoint (in my opinion).
curl -X GET \
https://fs.tokopedia.net/v1/fs/13004 \
-H 'Authorization: Bearer LSPr7x7sRGaewzwZE6IcuA'
The last path variable 13004
is your app_id
which is also retrieved from the Authentication Management menu, and the Authorization
header is Bearer <access_token>
with the token is the one retrieved in step 4.
Upon a successful request, you should see this as the response.
{
"data": {
"fs_id": 13004,
"order_notification_url": "",
"order_cancellation_url": "",
"order_status_url": "",
"order_request_cancellation_url": "",
"chat_notification_url": "",
"webhook_secret": "webhook_secret"
},
"status": "200 Ok",
"error_message": []
}
The result may vary according to your current application state. If you have reached this sentence, then congratulations, you can now use our Tokopedia Open Platform services. Heads up to our documentation here to explore all of the features Tokopedia Open Platform provides.