search mobile facets autocomplete spellcheck crawler rankings weights synonyms analytics engage api customize documentation install setup technology content domains user history info home business cart chart contact email activate analyticsalt analytics autocomplete cart contact content crawling custom documentation domains email engage faceted history info install mobile person querybuilder search setup spellcheck synonyms weights engage_search_term engage_related_content engage_next_results engage_personalized_results engage_recent_results success add arrow-down arrow-left arrow-right arrow-up caret-down caret-left caret-right caret-up check close content conversions-small conversions details edit grid help small-info error live magento minus move photo pin plus preview refresh search settings small-home stat subtract text trash unpin wordpress x alert case_deflection advanced-permissions keyword-detection predictive-ai sso

Synonyms

Synonyms allow you to relate two words together that contextually have the same meaning in your dataset. Sometimes, users will use different terminology, leading them to poor search relevance and bad search results. You can help improve their search experience by creating synonym sets.

Get a Set of Synonyms

Retrieves a synonym set by id.

GET /api/as/v1/engines/{ENGINE_NAME}/synonyms/{SYNONYM_SET_ID}

Returns

A dictionary containing the requested id and the synonyms set keyed by synonyms. Returns an error if the API key does not have read permissions for the requested engine or if the synonym set does not exist.

Example
curl -X GET 'https://host-9b2jfk.api.swiftype.com/api/as/v1/engines/junkyard/synonyms/syn-4qqbba74eaa0b20bidd9629b' \
-H 'Authorization: Bearer api-uak6ab37rhxij4nsg7zi87vn'
Example Response
{
    "id": "syn-4qqbba74eaa0b20bidd9629b",
    "synonyms": [
        "ludicrous speed",
        "Tesla"
    ]
}

List Synonyms

Retrieves synonym sets for an engine.

GET /api/as/v1/engines/{ENGINE_NAME}/synonyms

Arguments

page
optional
Dictionary containing current and size, where current is the current page number and size is the page size. The maximum for size is 25, and be will truncated if a larger size is requested. The default is the first page of synonym sets with pagination at 25.

Returns

A paginated list of synonym sets represented by a dictionary with id and synonyms as keys. Returns an error if the API key does not have read permissions for the requested engine or if the optional page parameter is not well formed.

Example
curl -X GET 'https://host-9b2jfk.api.swiftype.com/api/as/v1/engines/junkyard/synonyms' \
-H 'Authorization: Bearer api-uak6ab37rhxij4nsg7zi87vn'
Example Response
{
    "meta": {
        "page": {
            "current": 1,
            "total_pages": 1,
            "total_results": 3,
            "size": 25
        }
    },
    "results": [
        {
            "id": "syn-4qqbba74eaa0b20bidd9629b",
            "synonyms": [
                "ludicrous speed",
                "Tesla"
            ]
        },
        {
            "id": "syn-5afbba74eaa0b20bcdd9689b",
            "synonyms": [
                "cool car",
                "PT Cruiser"
            ]
        },
        {
            "id": "syn-5afbba98c9f929574a040374",
            "synonyms": [
                "violet",
                "purple"
            ]
        }
    ]
}

Create a Synonym Set

Creates a new synonym set for an engine.

POST /api/as/v1/engines/{ENGINE_NAME}/synonyms

Arguments

synonyms
required
A list of strings containing at least two unique strings.

Returns

An id of the new synonym set and the synonyms provided in the request. Returns an error if the API key does not have write permissions for the requested engine or if the synonyms is not well formed.

Example
curl -X POST 'https://host-9b2jfk.api.swiftype.com/api/as/v1/engines/junkyard/synonyms' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer api-uak6ab37rhxij4nsg7zi87vn' \
-d '{
    "synonyms": ["cool car", "PT Cruiser"]
}'
Example Response
{
    "id": "syn-5afbba74eaa0b20bcdd9689b",
    "synonyms": [
        "cool car",
        "PT Cruiser"
    ]
}

Delete a Synonym Set

Delete a synonym set by id.

DELETE /api/as/v1/engines/{ENGINE_NAME}/synonyms/{SYNONYM_SET_ID}

Returns

A dictionary with a deleted property denoting whether the synonym set was successfully deleted. Returns an error if the API key does not have write permissions for the requested engine or if the synonym set does not exist.

Example
curl -X DELETE 'https://host-7s23ap.api.swiftype.com/api/as/v1/engines/rent-a-car' \
-H 'Authorization: Bearer api-3958sdlfjadsf'
Example Response
{
    "deleted": true
}