API
This document contains user friendly examples of our main APIs to search and chat. The formal docs can be found here:
- API Reference documentation (redoc format)
- API Reference documentation (fastapi format)
- API Reference documentation (rapidoc format)
Note
Since, most features are both implemented at the API call level and at the configuration record level, the details of the implementation will be linked to Configuration section.
Getting started with APIs#
For all our APIs, you need the store’s API key to perform operations. You can find it in the administration panel under Store → API Key.
In this tutorial, we provide two different store API keys from our development environment (dev.api.searchmindai.com) so you can easily test each of them:
- Shoes and sports store API key:
stadium_qAbYC4u8Sp - Miscellaneous gifts & home store API key:
milgenialuruguayCom_bPCJW3wSzX
Search API#
Here is the API reference documentation for the /search endpoint.
Below are examples of calling the /search endpoint using the curl command-line tool:
curl 'https://dev.api.searchmindai.com/v2/search' \
-H 'API-KEY: stadium_qAbYC4u8Sp' \
-H 'Content-Type: application/json' \
--data-raw '{
"query":"topper rosadito",
"limit":10,
"offset":0,
"facets":true
}'
Chat API#
The chat endpoint comes in two variations: with streaming and without streaming. Performance is identical; the only difference is that the streaming version allows you to display the chat response as it is generated, even before it is complete.
In both cases, the response will include the raw chat output as well as references to the products mentioned in the response, including all their associated data.
Chat Without Streaming#
Here is the API reference documentation for the non-streaming chat endpoint:
curl 'https://dev.api.searchmindai.com/v2/chat' \
-H 'API-KEY: stadium_qAbYC4u8Sp' \
-H 'Content-Type: application/json' \
--data-raw '{
"query":"regalo para hijo de 6 años deportes",
"userId":"test_user_43tUC",
"getReferencesData":true
}'
Chat With Streaming#
Here is the API reference documentation for the streaming chat endpoint.
In the streaming response, the streamed content is separated from the final JSON response (which includes product references) using the delimiter string '·$%&@'.
curl 'https://dev.api.searchmindai.com/v2/chat/stream' \
-H 'Content-Type: application/json' \
--data-raw '{
"query":"regalo para hijo de 6 años deportes",
"apiKey":"stadium_qAbYC4u8Sp",
"userId":"test_user_43tUC",
"stream":true,
"getReferencesData":true
}'
Search API#
This is a big search operation, following are different sections or use cases.
For conceptual definition see Search concepts. For implementation details see Search configuration
Filters#
See Filters documentation for detail information.
TODO: explain how to perform API call
Mode#
See Filters documentation for detail information.
By default mode is semantic but it can be changed to only use it as a filter which is much faster and ideal for instantaneous experiences like autocomplete, see Search configurations mode
Catalog inference#
See Document Type inference documentation for detail information.
Use documentType property to explicitly indicate on which store's catalog to search, or "infer" to let the system infer the catalog based on user's query "intelligently". See filters search configuration inference-prompt
Facets#
See Facets documentation for detail information.
Chat API#
Search Metrics#
See Search metrics for detail information.
Admin endpoints#
Some API endpoints are under /admin and require an Authorization header. These endpoints allow you to manage store configuration, catalog documents, users, and more.
Admin auth#
Admin endpoints require an Authorization header containing a valid token. Use the /admin/auth endpoint to obtain one.
Endpoint: POST /admin/auth
Request body
{
"email": "your-admin-email@example.com",
"password": "your-password"
}
Response
{
"id": 1,
"name": "Admin User",
"email": "your-admin-email@example.com",
"storeId": 42,
"role": "store",
"password": "",
"token": "<your-authorization-token>"
}
Use the returned token value as the Authorization header on all subsequent admin requests.
Example — obtain a token and call an admin endpoint
Step 1: authenticate
curl -X POST 'https://api.searchmindai.com/admin/auth' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "your-admin-email@example.com",
"password": "your-password"
}'
Copy the token from the response.
Step 2: call a protected endpoint
curl 'https://api.searchmindai.com/admin/stores/{storeId}' \
-H 'Authorization: <your-authorization-token>'
Replace {storeId} with your numeric store ID and <your-authorization-token> with the token obtained in Step 1.
Catalog update documents#
See Update documents section for how to use.