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

Engines

Engines allow you to index documents and perform various search functions. The API allows you to create, delete, get, and list your engines.

Retrieve an Engine

Retrieves an engine by name.

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

Returns

A JSON object containing a name property. Returns an error if the API key does not have read permissions for the requested engine or if the engine does not exist.

Example
curl -X GET 'https://host-2376rb.api.swiftype.com/api/as/v1/engines/rent-a-car' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx'
Example Response
{
  "name": "rent-a-car"
}

Example
Client client = new Client("host-2376rb", "private-xxxxxxxxxxxxxxxxxxxx");

String engineName = "rent-a-car";

client.getEngine(engineName);

Example Response
Map<String, Object>: {
  "name": "rent-a-car"
}

Example
const client = new SwiftypeAppSearchClient('host-2376rb', 'private-xxxxxxxxxxxxxxxxxxxx')

const engineName = 'rent-a-car'

client.getEngine(engineName)

Example Response
{
  "name": "rent-a-car"
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = SwiftypeAppSearch::Client.new(host_identifier: host_identifier, api_key: api_key)

engine_name = 'rent-a-car'

puts client.get_engine(engine_name)

Example Response
{
  'name' => 'rent-a-car'
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = Client(host_identifier, api_key)

engine_name = 'rent-a-car'

client.get_engine(engine_name)

Example Response
{
    'name': 'rent-a-car'
}

Example
No Javascript example available, showing cURL
curl -X GET 'https://host-2376rb.api.swiftype.com/api/as/v1/engines/rent-a-car' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx'
Example Response
No Javascript example available, showing cURL
{
  "name": "rent-a-car"
}

List Engines

Retrieves engines that the API key has access to.

GET /api/as/v1/engines

Arguments

page
optional
JSON object 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 engines with pagination at 25.

Returns

A paginated array of JSON objects containing a name property for each engine the API key has read access to.

Example
curl -X GET 'https://host-2376rb.api.swiftype.com/api/as/v1/engines' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx' \
-d '{
  "page": {
    "current": "1",
    "size": "20"
  }
}'
Example Response
{
  "meta": {
    "page": {
      "current": 1,
      "total_pages": 1,
      "total_results": 1,
      "size": 20
    }
  },
  "results": [
    {
      "name": "rent-a-car"
    }
  ]
}

Example
Client client = new Client("host-2376rb", "private-xxxxxxxxxxxxxxxxxxxx");

client.listEngines();

Example Response
List<Map<String, Object>>: [
  { "name": "rent-a-car" }
]

Example
const client = new SwiftypeAppSearchClient('host-2376rb', 'private-xxxxxxxxxxxxxxxxxxxx')

const options = { page: { current: 1, size: 20 } }

client.listEngines(options)

Example Response
{
  "meta": {
    "page": {
      "current": 1,
      "total_pages": 1,
      "total_results": 1,
      "size": 20
    }
  },
  "results": [
    {
      "name": "rent-a-car"
    }
  ]
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = SwiftypeAppSearch::Client.new(host_identifier: host_identifier, api_key: api_key)

puts client.list_engines

Example Response
{
  'meta' => {
    'page' => {
      'current' => 1,
      'total_pages' => 1,
      'total_results' => 1,
      'size' => 20
    }
  },
  'results' => [
    {
      'name' => 'rent-a-car'
    }
  ]
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = Client(host_identifier, api_key)

client.list_engines(current=1, size=20)

Example Response
{
    'meta': {
        'page': {
            'current': 1,
            'total_pages': 1,
            'total_results': 1,
            'size': 20
        }
    },
    'results': [
        {
            'name': 'rent-a-car'
        }
    ]
}

Example
No Javascript example available, showing cURL
curl -X GET 'https://host-2376rb.api.swiftype.com/api/as/v1/engines' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx' \
-d '{
  "page": {
    "current": "1",
    "size": "20"
  }
}'
Example Response
No Javascript example available, showing cURL
{
  "meta": {
    "page": {
      "current": 1,
      "total_pages": 1,
      "total_results": 1,
      "size": 20
    }
  },
  "results": [
    {
      "name": "rent-a-car"
    }
  ]
}

Create an Engine

Creates a new engine object.

POST /api/as/v1/engines

Arguments

name
required
Name of the engine. Can only contain lowercase letters, numbers, and hyphens.

Returns

A JSON object with a name property. Returns an error if the API key does not have the permissions to create an engine, the engine already exists, or the engine name is invalid.

Example
curl -X POST 'https://host-2376rb.api.swiftype.com/api/as/v1/engines' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx' \
-d '{
  "name": "rent-a-car"
}'
Example Response
{
  "name": "rent-a-car"
}

Example
Client client = new Client("host-2376rb", "private-xxxxxxxxxxxxxxxxxxxx");

String engineName = "rent-a-car";

client.createEngine(engineName);

Example Response
Map<String, Object>: {
  "name": "rent-a-car"
}

Example
const client = new SwiftypeAppSearchClient('host-2376rb', 'private-xxxxxxxxxxxxxxxxxxxx')

const engineName = 'rent-a-car'

client.createEngine(engineName)

Example Response
{
  "name": "rent-a-car"
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = SwiftypeAppSearch::Client.new(host_identifier: host_identifier, api_key: api_key)

engine_name = 'rent-a-car'

puts client.create_engine(engine_name)

Example Response
{
  'name' => 'rent-a-car'
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = Client(host_identifier, api_key)

engine_name = 'rent-a-car'

client.create_engine(engine_name)

Example Response
{
    'name': 'rent-a-car'
}

Example
No Javascript example available, showing cURL
curl -X POST 'https://host-2376rb.api.swiftype.com/api/as/v1/engines' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx' \
-d '{
  "name": "rent-a-car"
}'
Example Response
No Javascript example available, showing cURL
{
  "name": "rent-a-car"
}

Delete an Engine

Delete an engine by name.

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

Returns

A JSON object with a deleted property denoting whether the engine was successfully deleted. Returns an error if the API key does not have write permissions for the requested engine.

Example
curl -X DELETE 'https://host-2376rb.api.swiftype.com/api/as/v1/engines/rent-a-car' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx'
Example Response
{
  "deleted": true
}

Example
Client client = new Client("host-2376rb", "private-xxxxxxxxxxxxxxxxxxxx");

String engineName = "rent-a-car";

client.destroyEngine(engineName);

Example Response
Map<String, Boolean>: {
  "deleted": true
}

Example
const client = new SwiftypeAppSearchClient('host-2376rb', 'private-xxxxxxxxxxxxxxxxxxxx')

const engineName = 'rent-a-car'

client.destroyEngine(engineName)

Example Response
{
  "deleted": true
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = SwiftypeAppSearch::Client.new(host_identifier: host_identifier, api_key: api_key)

engine_name = 'rent-a-car'

puts client.destroy_engine(engine_name)

Example Response
{
  'deleted' => true
}

Example
host_identifier = 'host-2376rb'
api_key = 'private-xxxxxxxxxxxxxxxxxxxx'
client = Client(host_identifier, api_key)

engine_name = 'rent-a-car'

client.destroy_engine(engine_name)

Example Response
{
    'deleted': True
}

Example
No Javascript example available, showing cURL
curl -X DELETE 'https://host-2376rb.api.swiftype.com/api/as/v1/engines/rent-a-car' \
-H 'Authorization: Bearer private-xxxxxxxxxxxxxxxxxxxx'
Example Response
No Javascript example available, showing cURL
{
  "deleted": true
}

What's Next?

An Engine is the beating heart of the search experience. Now you may want to learn more about how you can add, destroy and update, the Documents - the life-blood - within them. If you want a deep look into how users are interacting with your engines, then the Analytics and Clickthrough end-points are worth discovering.


Stuck? Looking for help? Contact Support!