All API interactions must utilize HTTPS with strict adherence to the following technical standards:
Content Handling
- Content-Type: application/json (mandatory for all requests)
- Character Encoding: UTF-8 exclusively
Common Request Parameters (HTTP Header)
Every API request must include these four essential parameters within the HTTP Header:
| Header | Description |
|---|---|
Authorization | Authorization token which have a 6-hour validity period and must be refreshed via the POST {{URL}}/api/open/grocery/v1/oauth/token endpoint upon expiration. |
Appid | Unique application identifier assigned by the Keeta platform. This value remains constant across all API calls made by your application. |
Timestamp | Unix timestamp in seconds representing the exact moment of API invocation. |
Signature | Cryptographic signature generated by applying the HMAC-SHA256 algorithm to the concatenated request parameters. |
Step 1: Construct the string to participate in the signature calculation
The components are concatenated in the following order to form the string used for signature calculation:
url_without_query&Appid={Appid}&Authorization={accessToken}&Timestamp={Timestamp}&{sorted_query_parameters}&{request_body}&{AppSecret}
Query parameters must be handled separately from the URL:
- Split the request URL into
url_without_queryand query parameters. The?separator is not included in the signature string. - Decode each query parameter key and value, then sort the parameters by key in ascending lexicographical order.
- Join the sorted parameters as
key1=value1&key2=value2. Empty values must be retained askey=. - Append the sorted query parameters after
Timestampand beforerequest_body, using&as the separator. - If the request has no query parameters, omit the query segment entirely.
Example 1: Request without Authorization Header, only for /v1/oauth/token endpoint (with request body)
url: https://open.mykeeta.com/api/open/grocery/v1/oauth/token
Appid: 123456
Timestamp: 1767196800
AppSecret: xyz
request body:
{
"grantType": "client_credentials",
"clientId": "123456",
"clientSecret": "xyz"
}The constructed signature calculation string is as follows:
https://open.mykeeta.com/api/open/grocery/v1/oauth/token&Appid=123456&Timestamp=1767196800&{"grantType":"client_credentials","clientId":"123456","clientSecret":"xyz"}&xyzExample 2: HTTP GET request (without request body)
url: https://open.mykeeta.com/api/open/grocery/v1/order/chains/1297211/vendors/611469/orders?pageSize=50&page=1
Appid: 123456
Authorization: abcdef
Timestamp: 1767196800
AppSecret: xyzThe query parameters are sorted by key as follows:
page=1&pageSize=50The constructed signature calculation string is as follows:
https://open.mykeeta.com/api/open/grocery/v1/order/chains/1297211/vendors/611469/orders&Appid=123456&Authorization=abcdef&Timestamp=1767196800&page=1&pageSize=50&xyzExample 3: HTTP POST/PUT request (with request body)
url: https://open.mykeeta.com/api/open/grocery/v1/product/update/chains/1297211/vendors/61146
Appid: 123456
Authorization: abcdef
Timestamp: 1767196800
AppSecret: xyz
request body:
{
"products": [
{
"sku": "TEST_SKU",
"active": true,
"price": 10,
"quantity": 10,
"baseWeight": 1,
"baseWeightUnit": "kg",
"pricePerBaseWeightUnit": 1
}
]
}The constructed signature calculation string is as follows:
https://open.mykeeta.com/api/open/grocery/v1/product/update/chains/1297211/vendors/61146&Appid=123456&Authorization=abcdef&Timestamp=1767196800&{"products":[{"sku":"TEST_SKU","active":true,"price":10,"quantity":10,"baseWeight":1,"baseWeightUnit":"kg","pricePerBaseWeightUnit":1}]}&xyzStep 2: Calculate HMAC-SHA256 Signature
- Use the constructed signature string in step 1
- Use the provided AppSecret as key
- Calculate HMAC-SHA256 hash
- Encode the result in Base64 format
Step 3: Add the Signature to the Signature Header
Assign the generated signature to the Signature Header, and then submit the request.
Example:
"Signature": "1hk2Wb1l/3Hvpn8UrH8XjPG4/hSucZMuuzu5dYCt6E4="