Recast.AI is now part of SAP.
Recast.AI is now part of SAP.

Text analysis API


Text analysis works with any raw text.


Name Type Description Constraints
text String This is your user input. Required, not empty, not blank, less than 512 characters
language String The language Recast.AI will process your text. Optional, must be en, fr or es for premium level languages or ar, ca, da, de, fi, hi, it, ja, ko, no, no, nl, pl, pt, ru, sv and zh (for standard level languages) , if not provided a language detection will be performed


Copy-paste this snippet in a file by replacing the REQUEST_TOKEN by your token, install the dependencies, and run the file ;)

JS: npm install recastai

Python: pip install recastai

Ruby: gem install 'RecastAI'

PHP: composer require recastai/sdk-php

const recastai = require('recastai')

const client = new recastai.request('YOUR_REQUEST_TOKEN', 'en')

  .then(function(res) {
    if (res.intent()) { console.log('Intent: ', res.intent().slug) }
    if (res.intent().slug === 'YOUR_EXPECTED_INTENT') {
      // Do your code...


We return a JSON containing your sentences and actionable data extracted from them.

  "results": {
    "uuid": "21ec79d8-3865-40e3-be8b-f31d040efed8",
    "source": "What'll be the weather in London next Thursday?",
    "intents": [
        "slug": "weather",
        "confidence": 0.95
    "act": "wh-query",
    "type": "desc:desc",
    "sentiment": "neutral",
    "entities": {
      "location": [
          "formatted": "London, UK",
          "lng": -0.1277583,
          "lat": 51.5073509,
          "type": "locality",
          "place": "ChIJdd4hrwug2EcRmSrV3Vo6llI",
          "raw": "London",
          "confidence": 0.99
      "datetime": [
          "formatted": "Thursday, 06 October 2016 at 09:00:00 AM",
          "iso": "2016-10-06T09:00:00Z",
          "accuracy": "day",
          "chronology": "future",
          "raw": "next Thursday",
          "confidence": 0.95
    "language": "en",
    "version": "2.4.0",
    "timestamp": "2016-09-30T10:29:54.211866Z",
    "status": 200
  "message": "Resource rendered with success"
Name Type Description
uuid String The universally unique id for this request
source String The text we processed
intents Array of intent The intents we found, sorted by probability
intent.slug String The slug of the intent which matched
intent.confidence Float The maching score of the intent
act String The act of the request, more info in the glossary
type String The type of the request, more info in the glossary
sentiment String The sentiment of the request, more info in the glossary
entities Object Every keys are an array of entity, more infos in the glossary
language String The language detected (or given) from the processed sentence, follows the ISO 639-1 standard
version String The version of our JSON, follows the Semantic Versioning Specification
timestamp String The UTC timestamp at the end of our processing, follows the ISO 8061 standard
status Integer The status of our Natural Language processor


We will return an error (400: bad_request) if any of these cases is met:

  • Parameter text is missing.
  • Parameter text is blank.
  • Text is longer than 512 characters.
  • Parameter language is neither a standard level language isocode or a premium language isocode

We will return an error (401: unauthorized) if the following case is met:

  • The token provided in your request is not linked to any of your bots.

We will return an error (503: service_unavailable) if any of these cases is met:

  • Our natural language processing service is unavailable.