SetuBot
/

to search

Introducing Setu API playground Check it out ↗

#API Guide

#API URLs

  • Sandbox https://sandbox-ondc.setu.co/
  • Production https://ondc.setu.co/

#Headers

These will be applicable to all the APIs you call, unless specified otherwise-

  • authorisation - Bearer <insert_token_here>. This token can be generated via the Generate Access Token API
  • Content-Type - Set this to application/json

#Generate Access Token API

An API to generate access tokens, which are used to authorise any other API requests made to Setu.

Request

MethodPOST
Path/auth/token

Request Body

{
"client_id": "client_id",
"client_secret": "client_secret",
"grant_type": "client_credentials"
}

💡 Since this API is used to generate the Bearer Token the authorisation header shouldn’t be included in the API call. The Content-Type should still be included in the the header


Response

{
"accessToken': "your_access_token",
}

💡 accessToken is are valid for 7 days.

How to use the access token

Once you have a valid token available against product configuration(s), you can store it and use it to authorise an API call made to Setu, by setting the authorization request header as Bearer <token-value>.

On expiry

Implement a workflow to generate new token when the old one expires. The general setup might look something like this—

  • Store clientID and secret.
  • Generate new token with stored clientID and secret when token has expired. If the API you call returns 401 unauthorized, it could be an indication that the token has expired.
  • Store the newly generated token and use for subsequent API calls.

It is recommended that the entity integrating with this API collection follows the below prescribed integration flow as all APIs aren't mandatory for a successful integration.

Integrate with APIs in the following order (you can choose to integrate with only the ones marked mandatory)—

  1. Seller APIs

    1. Create a seller
    2. Get details of a seller
    3. Update details for a seller
    4. Delete a seller
  2. Storefront APIs

    1. Create a storefront for a seller
    2. Get details of a storefront
    3. Update details for a storefront
    4. Delete a storefront
  3. Catalogue APIs

    1. Add / update catalogue items for a storefront
    2. Delete catalogue items
  4. Inventory APIs

    1. Update Inventory API
  5. Order APIs

    1. Get orders for a storefront
    2. Update orders for a storefront

This GIF below illustrates a brief architecture of our system and the users engagement with the Client APIs -

Architecture

In the following section we will discuss each of the APIs in more detail. We have populated each of the fields with sample data to give the reader a better feel of the actual requests and responses. Refer to the API reference to get a better understanding of all the possible values for each of the parameters.


Was this page helpful?