Sajari API (v4)

Download OpenAPI specification:Download

Sajari is a smart, highly-configurable, real-time search service that enables thousands of businesses worldwide to provide amazing search experiences on their websites, stores, and applications.

Authentication

BasicAuth

The Sajari API uses API keys to authenticate requests.

You should provide either your account's API key or your collection's API key. The type of key you provide depends on the required level of access for the request you are making. To administer your account (e.g. create and delete collections) you should provide an account key. For most other requests (e.g. query collection) you should provide a collection key.

Your API keys carry many privileges, so be sure to keep them secure. Do not share your API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Basic Auth. Provide your API key ID as the basic auth username value. Provide your API key secret as the basic auth password value.

$ curl https://api-gateway.sajari.com -u <key_id>:<key_secret>

You can find your account's API keys in the Sajari Console account credentials page. You can find your collection's API keys in the Sajari Console collection credentials page.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Security Scheme Type HTTP
HTTP Authorization Scheme basic

Collections

Collections store the records that you want to search through.

They also contain the configuration associated with your data including pipelines, rules, synonyms, authorized domains and analytics. Each collection has an associated schema that designates field names, field types, and whether a field's data is indexed for text search.

Create a collection for every new set of related records that you want to search through.

List collections

Retrieve a list of collections in the account.

Authorizations:
query Parameters
page_size
integer <int32>

The maximum number of collections to return. The service may return fewer than this value.

If unspecified, at most 50 collections are returned.

The maximum value is 100; values above 100 are coerced to 100.

page_token
string

A page token, received from a previous ListCollections call.

Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to ListCollections must match the call that provided the page token.

Responses

Response samples

Content type
application/json
{
  • "collections": [
    ],
  • "next_page_token": "string"
}

Create collection

Create an empty collection.

Before records can be added to a collection, the schema and pipelines for the collection have to be set up. Consider setting up new collections via the Sajari Console, which handles the creation of the schema and pipelines for you.

Authorizations:
query Parameters
collection_id
required
string

The ID to use for the collection.

This must start with an alphanumeric character followed by one or more alphanumeric or - characters. Strictly speaking, it must match the regular expression: ^[A-Za-z][A-Za-z0-9\-]*$.

Request Body schema: application/json

Details of the collection to create.

display_name
required
string

The collection's display name. You can change this at any time.

authorized_query_domains
Array of strings

The list of authorized query domains for the collection.

Client-side / browser requests to the QueryCollection call can be made by any authorized query domain or any of its subdomains. This allows your interface to make search requests without having to provide an API key in the client-side request.

Responses

Request samples

Content type
application/json
{
  • "display_name": "string",
  • "authorized_query_domains": [
    ]
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "account_id": "string",
  • "create_time": "2019-08-24T14:15:22Z",
  • "display_name": "string",
  • "authorized_query_domains": [
    ]
}

Get collection

Retrieve the details of a collection.

Authorizations:
path Parameters
collection_id
required
string

The collection to retrieve, e.g. my-collection.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "account_id": "string",
  • "create_time": "2019-08-24T14:15:22Z",
  • "display_name": "string",
  • "authorized_query_domains": [
    ]
}

Delete collection

Delete a collection and all of its associated data.

Note: this operation cannot be reversed.

Authorizations:
path Parameters
collection_id
required
string

The collection to delete, e.g. my-collection.

Responses

Response samples

Content type
application/json
{ }

Update collection

Update the details of a collection.

Authorizations:
path Parameters
collection_id
required
string

The collection to update, e.g. my-collection.

query Parameters
update_mask
string

The list of fields to be updated, separated by a comma, e.g. field1,field2.

Each field should be in snake case, e.g. display_name.

For each field that you want to update, provide a corresponding value in the collection object containing the new value.

Request Body schema: application/json

Details of the collection to update.

display_name
required
string

The collection's display name. You can change this at any time.

a