curl --request POST \
--url https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"text": "How is tihs ",
"typingEvent": {
"cursorStart": 11,
"cursorEnd": 12
},
"userDictionary": [
"Hellooo"
],
"language": "en"
}
'import requests
url = "https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction"
payload = {
"text": "How is tihs ",
"typingEvent": {
"cursorStart": 11,
"cursorEnd": 12
},
"userDictionary": ["Hellooo"],
"language": "en"
}
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'How is tihs ',
typingEvent: {cursorStart: 11, cursorEnd: 12},
userDictionary: ['Hellooo'],
language: 'en'
})
};
fetch('https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'How is tihs ',
'typingEvent' => [
'cursorStart' => 11,
'cursorEnd' => 12
],
'userDictionary' => [
'Hellooo'
],
'language' => 'en'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"asapp-api-id: <api-key>",
"asapp-api-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction"
payload := strings.NewReader("{\n \"text\": \"How is tihs \",\n \"typingEvent\": {\n \"cursorStart\": 11,\n \"cursorEnd\": 12\n },\n \"userDictionary\": [\n \"Hellooo\"\n ],\n \"language\": \"en\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"How is tihs \",\n \"typingEvent\": {\n \"cursorStart\": 11,\n \"cursorEnd\": 12\n },\n \"userDictionary\": [\n \"Hellooo\"\n ],\n \"language\": \"en\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"How is tihs \",\n \"typingEvent\": {\n \"cursorStart\": 11,\n \"cursorEnd\": 12\n },\n \"userDictionary\": [\n \"Hellooo\"\n ],\n \"language\": \"en\"\n}"
response = http.request(request)
puts response.read_body{
"id": "01BX5ZZKBKACTAV9WEVGEMMVS1",
"misspelledText": "tihs",
"correctedText": "this",
"position": 7
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "403-01",
"message": "Forbidden Response"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "404-01",
"message": "Not Found"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "409-01",
"message": "Conflict"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "413-01",
"message": "Request Entity Too Large"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "422-01",
"message": "Unprocessable Entity"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "429-01",
"message": "Too Many Requests"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "503-01",
"message": "Service Unavailable"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}Check for spelling mistakes
Get spelling correction for a message as it is being typed, if there is a misspelling. Only the current word will be corrected, once it’s fully typed (so it is recommended to call this endpoint after space characters).
curl --request POST \
--url https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction \
--header 'Content-Type: application/json' \
--header 'asapp-api-id: <api-key>' \
--header 'asapp-api-secret: <api-key>' \
--data '
{
"text": "How is tihs ",
"typingEvent": {
"cursorStart": 11,
"cursorEnd": 12
},
"userDictionary": [
"Hellooo"
],
"language": "en"
}
'import requests
url = "https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction"
payload = {
"text": "How is tihs ",
"typingEvent": {
"cursorStart": 11,
"cursorEnd": 12
},
"userDictionary": ["Hellooo"],
"language": "en"
}
headers = {
"asapp-api-id": "<api-key>",
"asapp-api-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'asapp-api-id': '<api-key>',
'asapp-api-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'How is tihs ',
typingEvent: {cursorStart: 11, cursorEnd: 12},
userDictionary: ['Hellooo'],
language: 'en'
})
};
fetch('https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => 'How is tihs ',
'typingEvent' => [
'cursorStart' => 11,
'cursorEnd' => 12
],
'userDictionary' => [
'Hellooo'
],
'language' => 'en'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"asapp-api-id: <api-key>",
"asapp-api-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction"
payload := strings.NewReader("{\n \"text\": \"How is tihs \",\n \"typingEvent\": {\n \"cursorStart\": 11,\n \"cursorEnd\": 12\n },\n \"userDictionary\": [\n \"Hellooo\"\n ],\n \"language\": \"en\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("asapp-api-id", "<api-key>")
req.Header.Add("asapp-api-secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction")
.header("asapp-api-id", "<api-key>")
.header("asapp-api-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"How is tihs \",\n \"typingEvent\": {\n \"cursorStart\": 11,\n \"cursorEnd\": 12\n },\n \"userDictionary\": [\n \"Hellooo\"\n ],\n \"language\": \"en\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.asapp.com/autocompose/v1/spellcheck/correction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["asapp-api-id"] = '<api-key>'
request["asapp-api-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"How is tihs \",\n \"typingEvent\": {\n \"cursorStart\": 11,\n \"cursorEnd\": 12\n },\n \"userDictionary\": [\n \"Hellooo\"\n ],\n \"language\": \"en\"\n}"
response = http.request(request)
puts response.read_body{
"id": "01BX5ZZKBKACTAV9WEVGEMMVS1",
"misspelledText": "tihs",
"correctedText": "this",
"position": 7
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "400-01",
"message": "Bad request"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "401-01",
"message": "Unauthorized"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "403-01",
"message": "Forbidden Response"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "404-01",
"message": "Not Found"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "409-01",
"message": "Conflict"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "413-01",
"message": "Request Entity Too Large"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "422-01",
"message": "Unprocessable Entity"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "429-01",
"message": "Too Many Requests"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "503-01",
"message": "Service Unavailable"
}
}{
"error": {
"requestId": "8e033668-9f1a-11ec-b909-0242ac120002",
"code": "500-01",
"message": "Internal server error"
}
}Body
The parameters for getting a spelling correction as a message is being typed.
Text being typed by the agent, already entered into the composer
Show child attributes
Show child attributes
Words that should not be corrected if they are present on the text
Optional IETF language tag of the text. If not provided, the default language will be assumed which most likely will be English but it could be a different language depending on the customer setup.
Response
Successfully checked for a spelling mistake.
ID for the spelling correction that was returned (to be used in analytics events)
"01BX5ZZKBKACTAV9WEVGEMMVS1"
misspelling that needs to be replaced with the corrected text
"tihs"
correction for the misspelling
"this"
position where the misspelling starts
7
Was this page helpful?