Skip to main content

Similar Products

Overview

The endpoint /api/v1/products/protected/similar returns a list of similar products based on a provided product ID. This is a protected endpoint that requires authentication via token.

Request Information

HTTP Method

POST

URL

https://catalog.api.fashionai.dev/api/v1/products/protected/similar

Required Headers

HeaderValueDescription
Content-Typeapplication/jsonSets the format of the request body
acceptapplication/jsonSets the expected format of the response
X-FashionAI-APP-Token{token}Application authentication token

Request Body

Structure

{
"userId": "",
"sessionId": "123",
"data": {
"id": "979935"
}
}

Parameters

FieldTypeRequiredDescription
userIdstring | nullNoUser identifier (optional)
sessionIdstringYesUnique session identifier
dataSimilarDataYesObject containing the request data

SimilarData

FieldTypeRequiredDescription
idstringYesProduct ID to search similar products for

Response

Structure

{
"products": ["product_id_1", "product_id_2", "product_id_3"]
}

Parameters

FieldTypeDescription
productsstring[]Array containing the IDs of similar products

Examples

cURL Request

curl -X 'POST' \
'https://catalog.api.fashionai.dev/api/v1/products/protected/similar' \
-H 'accept: application/json' \
-H 'X-FashionAI-APP-Token: YOUR_TOKEN_HERE' \
-H 'Content-Type: application/json' \
-d '{
"userId": "",
"sessionId": "123",
"data": {
"id": "979935"
}
}'

HTTP Status Codes

CodeDescription
200Success. Returns the list of similar products
400Request validation error (invalid or missing parameters)
401Unauthorized. Invalid or expired token
403Forbidden. Insufficient permissions
404Product not found
500Internal server error

Validations

  • sessionId: Required field, must be a non-empty string
  • data.id: Required field, must be a non-empty string representing a valid product ID
  • userId: Optional, can be null or a string
  • X-FashionAI-APP-Token: Required token for authentication

Important Notes

  • This is a protected endpoint and requires authentication via token
  • The token must be included in the X-FashionAI-APP-Token header
  • The sessionId is required for tracking the user session
  • The userId field may be optional in some scenarios
  • The response contains only the IDs of similar products, not the complete product data