Skip to content

SKU-HSN Mapping API

The SKU-HSN Mapping API is designed to enable efficient mapping between SKU (Stock Keeping Unit) codes and HSN (Harmonized System of Nomenclature) codes. This API allows businesses to create, retrieve, and manage mappings between SKUs and HSN codes.

Available Endpoints

Authentication

All endpoints require the following header:

  • Content-Type: application/json

API Endpoints

1. Search SKU-HSN Mappings

Searches for SKU-HSN mappings with pagination.

GET https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map

Headers

Content-Type: application/json

Query Parameters

ParameterRequiredTypeDescription
queryYesstringSearch query (skuId or hsnCode)
pageNonumberPage number (default: 1)
limitNonumberItems per page (default: 10)
Success Response (200 OK)
{
"status": "success",
"message": "SKU-HSN mappings retrieved successfully",
"data": {
"items": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"skuId": "SKU123",
"hsnCode": "6502",
"description": "HAT-SHAPES, PLAITED OR MADE BY ASSEMBLING STRIPS OF ANY MATERIAL",
"category": "Headgear",
"createdAt": "2024-04-04T11:31:09Z",
"updatedAt": "2024-04-04T11:31:09Z"
}
],
"pagination": {
"totalItems": 1,
"itemCount": 1,
"itemsPerPage": "10",
"totalPages": 1,
"currentPage": "1"
}
},
"statusCode": "1000"
}

Error Response (400 Bad Request)

{
"status": "error",
"message": "Query is required",
"data": null,
"statusCode": "4000"
}

Error Response (404 Not Found)

{
"status": "error",
"message": "No results found for the given query.",
"data": null,
"statusCode": "4004"
}

2. Get SKU-HSN Mapping by ID

Retrieves a specific SKU-HSN mapping by ID.

GET https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/{id}

Headers

Content-Type: application/json
Success Response (200 OK)
{
"status": "success",
"message": "SKU-HSN mapping retrieved successfully",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"skuId": "SKU123",
"hsnCode": "6502",
"description": "HAT-SHAPES, PLAITED OR MADE BY ASSEMBLING STRIPS OF ANY MATERIAL",
"category": "Headgear",
"createdAt": "2024-04-04T11:31:09Z",
"updatedAt": "2024-04-04T11:31:09Z"
},
"statusCode": "1000"
}

Error Response (404 Not Found)

{
"status": "error",
"message": "SKU-HSN mapping with ID not found",
"data": null,
"statusCode": "4004"
}

3. Create SKU-HSN Mapping

Creates a new SKU-HSN mapping.

POST https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map

Headers

Content-Type: application/json
x-tenant-id: T-1234
x-user-id: U-1234

Request Body

ParameterRequiredTypeDescription
skuIdYesstringSKU ID
hsnCodeYesstringHSN code
descriptionNostringDescription of the mapping
categoryNostringCategory of the product
Success Response (201 Created)
{
"status": "success",
"message": "SKU-HSN mapping created successfully",
"data": {
"id": "3ab644e6-5032-4172-96ef-8a94ea321dce",
"tenantId": "T-1234",
"userId": "U-1234",
"skuId": "SM21-SH-M02-RD-L-001",
"productName": "Summer 2021 shirt, model 02, red, large",
"hsnCode": "61052010",
"countryCode": "IN",
"createdAt": "2025-04-22T06:36:47.391Z",
"updatedAt": "2025-04-22T06:36:47.391Z"
},
"statusCode": "1000"
}

Error Response (400 Bad Request)

{
"status": "error",
"message": "Failed to create SKU-HSN mapping",
"data": null,
"statusCode": "4000"
}

4. Update SKU-HSN Mapping

Updates an existing SKU-HSN mapping.

PATCH https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/{id}

Headers

Content-Type: application/json

Request Body

ParameterRequiredTypeDescription
hsnCodeNostringUpdated hsnCode of the mapping
tenantIdNostringUpdated tenantId of the product
userIdNostringUpdated userId of the product
skuIdNostringUpdated skuId of the product
productNameNostringUpdated productName of the product
countryCodeNostringUpdated countryCode of the product
Success Response (200 OK)
{
"status": "success",
"message": "SKU-HSN mapping updated successfully",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"skuId": "SKU123",
"hsnCode": "6502",
"description": "Updated description",
"category": "Updated category",
"createdAt": "2024-04-04T11:31:09Z",
"updatedAt": "2024-04-04T12:45:22Z"
},
"statusCode": "1000"
}

Error Response (404 Not Found)

{
"status": "error",
"message": "SKU-HSN mapping with ID not found",
"data": null,
"statusCode": "4004"
}

Error Response (400 Bad Request)

{
"status": "error",
"message": "Failed to update SKU-HSN mapping",
"data": null,
"statusCode": "4000"
}

5. Delete SKU-HSN Mapping

Deletes a SKU-HSN mapping.

DELETE https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/{id}

Headers

Content-Type: application/json
Success Response (200 OK)
{
"status": "success",
"message": "SKU-HSN mapping deleted successfully",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000"
},
"statusCode": "1000"
}

Error Response (404 Not Found)

{
"status": "error",
"message": "SKU-HSN mapping with ID not found",
"data": null,
"statusCode": "4004"
}

Error Response (400 Bad Request)

{
"status": "error",
"message": "Failed to delete SKU-HSN mapping",
"data": null,
"statusCode": "4000"
}

Error Codes

Status CodeTitleDescriptionExample
4000ErrorGeneral error occurred{"status": "error", "message": "Failed to create SKU-HSN mapping", "statusCode": "4000"}
4002Bad RequestInvalid request parameters{"status": "error", "message": "Query is required", "statusCode": "4000"}
4004Not FoundResource not found{"status": "error", "message": "SKU-HSN mapping with ID not found", "statusCode": "4004"}
5000Internal Server ErrorUnexpected server error{"status": "error", "message": "An unexpected error occurred", "statusCode": "5000"}

Example Usage

Search SKU-HSN Mappings

Terminal window
curl --location 'https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map?query=SKU123&page=1&limit=10' \
-H "Content-Type: application/json"

Get SKU-HSN Mapping by ID

Terminal window
curl --location 'https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/550e8400-e29b-41d4-a716-446655440000' \
-H "Content-Type: application/json"

Create SKU-HSN Mapping

Terminal window
curl --location 'https://devapis.prayog.io/hsn-service/api/v1/map-sku-hsn' \
--header 'x-tenant-id: T-1234' \
--header 'x-user-id: U-1234' \
--header 'Content-Type: application/json' \
--data '{
"skuId": "SM21-SH-M02-RD-L-001",
"productName": "Summer 2021 shirt, model 02, red, large",
"hsnCode": "61052010",
"countryCode": "IN"
}'

Update SKU-HSN Mapping

Terminal window
curl --location --request PATCH 'https://devapis.prayog.io/hsn-service/api/v1/map-sku-hsn/3ab644e6-5032-4172-96ef-8a94ea321dce' \
--header 'Content-Type: application/json' \
--data '{
"hsnCode": "6105223",
"tenantId": "T-1020",
"userId": "U-1020"
}'

Delete SKU-HSN Mapping

Terminal window
curl --location --request DELETE 'https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/550e8400-e29b-41d4-a716-446655440000' \
-H "Content-Type: application/json"