Serverless AI Data Search
AI powered data search service that finds the most relevant items from a collection based on a semantic search query.
Endpoint
Search through a collection of items using AI-powered semantic search
POSThttps://api.xtartapp.com/data/search
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
query | string | Yes | 250 | The search query to find relevant items |
items | array | Yes | 100 | Array of items to search through. Maximum 100 items. |
items[].id | string | Yes | 30 | The unique identifier for the item. Maximum 30 characters. |
items[].title | string | Yes | 100 | The title of the item. Maximum 100 characters. |
items[].description | string | No | 200 | Optional description of the item. Maximum 200 characters. |
limit | number | No | 25 | The maximum number of results to return. Default is 1, maximum is 25. |
Response
Name | Type | Description |
---|---|---|
data | object | The data of the search process |
data.results | array | Array of search results ordered by relevance |
data.results[].id | string | ID of the matched item |
data.results[].title | string | Title of the matched item |
data.results[].description | string | Description of the matched item |
data.results[].score | number | Relevance score between 0 and 1, where 1 is most relevant |
data.totalMatches | number | Total number of potential matches found |
metadata | object | Metadata about the data search process |
metadata.cost | number | The cost of the data search request (fixed at $0.0005 per request) |
metadata.tokens | number | Number of tokens used in the operation |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | DATA_SEARCH_ERROR | Ex: could not search data | parsing error |
400 | HARM_CONTENT | Ex.: The content is harmful and cannot be processed. |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
401 | UNAUTHORIZED | Ex.: The token is invalid. |
429 | TOO_MANY_REQUESTS | Ex.: The request limit has been reached. |