Serverless AI Text Suggestions

AI powered text suggestions to accelerate your text input with context aware suggestions based on the previous text input. It may be used to autocomplete text in a chatbot or a text input field based on the intent of the field.

Endpoint

Text suggestions with intent

POSThttps://api.xtartapp.com/text/suggestions

*Authentication

You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.

Request body

NameTypeRequiredMaxDescription
textstringYes500The text to analyze
intentstringYes250The intent to use for the suggestions
limitnumberNo-The limit of results to return. Minimum 1, maximum 10
languagestringYes-The language code for the suggestions (e.g., 'en', 'es', 'fr'). Use 'auto' for automatic language detection.

Response

NameTypeDescription
dataobjectThe data of the text suggestions
data.sourceTextstringThe original input text
data.suggestionsarrayArray of suggestion objects
data.suggestions[].suggestionstringThe suggested text with completion
data.suggestions[].scorenumberThe confidence score of the text suggestions (0-1)
data.detectedLanguagestringThe detected language code of the input text
metadataobjectMetadata about the text suggestions process
metadata.costnumberThe cost of the text suggestions request

Errors

{
   "error": "string", 
   "code": "string"
}
HTTP StatusError CodeMessage
400INVALID_PAYLOADOccurs when the payload is invalid.
400INVALID_REQUESTEx.: The request is invalid.
400TEXT_SUGGESTIONS_ERROREx: could not generate suggestions for the text | parsing error
400HARM_CONTENTEx.: The content is harmful and cannot be processed.
400INSUFFICIENT_BALANCEThe user has insufficient balance
401UNAUTHORIZEDEx.: The token is invalid.
429TOO_MANY_REQUESTSEx.: The request limit has been reached.