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
- GET https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map
- GET https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/{id}
- POST https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map
- PATCH https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/{id}
- DELETE https://apis.prayog.io/hsn-service/hsn-service/api/v1/sku-hsn-map/{id}
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-mapHeaders
Content-Type: application/jsonQuery Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| query | Yes | string | Search query (skuId or hsnCode) |
| page | No | number | Page number (default: 1) |
| limit | No | number | Items 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/jsonSuccess 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-mapHeaders
Content-Type: application/jsonx-tenant-id: T-1234x-user-id: U-1234Request Body
| Parameter | Required | Type | Description |
|---|---|---|---|
| skuId | Yes | string | SKU ID |
| hsnCode | Yes | string | HSN code |
| description | No | string | Description of the mapping |
| category | No | string | Category 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/jsonRequest Body
| Parameter | Required | Type | Description |
|---|---|---|---|
| hsnCode | No | string | Updated hsnCode of the mapping |
| tenantId | No | string | Updated tenantId of the product |
| userId | No | string | Updated userId of the product |
| skuId | No | string | Updated skuId of the product |
| productName | No | string | Updated productName of the product |
| countryCode | No | string | Updated 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/jsonSuccess 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 Code | Title | Description | Example |
|---|---|---|---|
| 4000 | Error | General error occurred | {"status": "error", "message": "Failed to create SKU-HSN mapping", "statusCode": "4000"} |
| 4002 | Bad Request | Invalid request parameters | {"status": "error", "message": "Query is required", "statusCode": "4000"} |
| 4004 | Not Found | Resource not found | {"status": "error", "message": "SKU-HSN mapping with ID not found", "statusCode": "4004"} |
| 5000 | Internal Server Error | Unexpected server error | {"status": "error", "message": "An unexpected error occurred", "statusCode": "5000"} |
Example Usage
Search SKU-HSN Mappings
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
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
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
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
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"