#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 APIContent-Type
- Set this toapplication/json
#Generate Access Token API
An API to generate access tokens, which are used to authorise any other API requests made to Setu.
Request
Method | POST |
---|---|
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
andsecret
. - Generate new token with stored
clientID
andsecret
when token has expired. If the API you call returns401 unauthorized
, it could be an indication that the token has expired. - Store the newly generated token and use for subsequent API calls.
#Recommended Integration Journey
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)—
Seller APIs
- Create a seller
- Get details of a seller
- Update details for a seller
- Delete a seller
Storefront APIs
- Create a storefront for a seller
- Get details of a storefront
- Update details for a storefront
- Delete a storefront
Catalogue APIs
- Add / update catalogue items for a storefront
- Delete catalogue items
Inventory APIs
- Update Inventory API
Order APIs
- Get orders for a storefront
- Update orders for a storefront
This GIF below illustrates a brief architecture of our system and the users engagement with the Client APIs -

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?