Spelling autocorrect API

autocorrect takes a single word and returns one spelling suggestion.

It also returns a localized “revert” message for the UI.

Command name: autocorrect Success status: 200 OK

On this page

Related: Overview, Supported languages

Common parameters

cmd selects the command to run.

Name
Type
Required
Description

cmd

string

Yes

Must be autocorrect.

These parameters work with any cmd.

Name
Type
Required
Description

serviceid

string

Cloud only

Cloud API key. Required for Cloud requests. Not used on-premises.

format

string

No

Response format. Values: json (default), xml.

callback

string

No

JSONP wrapper function name. Use only with format=json.

short_answer

boolean

No

JSON only. When true, shortens JSON keys to reduce payload size. See boolean parameters.

See Overview for details.

Parameters

These are parameters specific to cmd=autocorrect.

Name
Type
Required
Description

text

string

Yes

Word to autocorrect. If it contains spaces, the command returns no suggestions.

lang

string

Yes

Language code. Use a language that supports spelling. See Supported languages.

locale

string

No

Localization for the revert message shown to the user. Accepted formats: es, es-ES, es_ES.

Behavior notes

  • The response contains zero or one suggestion.

  • If text has more than one word, you get an empty result.

  • An empty result is still a 200 OK.

Request examples

Example: suggestion found

Request:

Response (200 OK):

Use defaults: format=json, short_answer=false.

Example: no suggestions

Request:

Response (200 OK):

Use defaults: format=json, short_answer=false.

Response schema

The response is always an object with a single result.

JSON (short_answer=false)

  • result (object) Always present. Empty object means “no suggestions”.

  • result.suggestions (array of strings) Zero or one element.

  • result.message (string) Localized label for the revert action. Present when a suggestion exists.

Short JSON (short_answer=true)

Key mapping:

  • resultr

  • messagem

  • suggestionss

Errors

Errors use the shared error format from Overview.

Language code not found (400 Bad Request)

Language has no spelling support (403 Forbidden)

Last updated

Was this helpful?