Algolia CLI / Commands

Manage your Algolia API keys.

algolia apikeys create

Usage
algolia apikeys create [flags]

Create a new API key.

Examples

1
2
3
4
5
6
# Create a new API key targeting the index "MOVIES", with the "search" and "browse" ACL and a description
$ algolia apikeys create --indices MOVIES --acl search,browse --description "Search & Browse API Key"

# Create a new API key targeting the indices "MOVIES" and "SERIES", with the "https://example.com" referer, with a validity of 1 hour and a description
$ algolia apikeys create -i MOVIES,SERIES --acl search -r "https://example.com" --u 1h -d "Search-only API Key for MOVIES & SERIES"

Flags

--acl

API key’s ACL.

1
2
3
4
5
6
7
8
9
10
11
12
13
`search`: can perform search operations.  
`browse`: can retrieve all index data with the browse endpoint.  
`addObject`: can add or update records in the index.  
`deleteObject`: can delete an existing record.  
`listIndexes`: can get a list of all indices.  
`deleteIndex`: can delete an index.  
`settings`: can read all index settings.  
`editSettings`: can update all index settings.  
`analytics`: can retrieve data with the Analytics API.  
`recommendation`: can interact with the Recommendation API.  
`usage`: can retrieve data with the Usage API.  
`logs`: can query the logs.  
`seeUnretrievableAttributes`: can retrieve unretrievableAttributes for all operations that return records.  
-d, --description

Describe an API key to help you identify its uses.

-i, --indices

Index names or patterns that this API key can access. By default, an API key can access all indices in the same application.

You can use leading and trailing wildcard characters (*).
For example, dev_* matches all indices starting with dev_. *_dev matches all indices ending with _dev. *_products_* matches all indices containing products.

-r, --referers

Specify the list of referrers that can perform an operation.
You can use the wildcard character (*) to match subdomains or entire websites.

-u, --validity

Duration (in seconds) after which the API key expires. By default (a value of 0), API keys don’t expire.

algolia apikeys delete

Usage
algolia apikeys delete <api-key> [flags]

Deletes the API key.

Flags

-y, --confirm

Skip the delete API key confirmation prompt

algolia apikeys get

Usage
algolia apikeys get <api-key> [flags]

Get the API key.

Examples

1
2
3
# Get an API key
$ algolia --application-id app-id apikeys get abcdef1234567890

algolia apikeys list

Usage
algolia apikeys list [flags]

Lists all API keys associated with your Algolia application, including their permissions and restrictions.

Output formatting flags

--allow-missing-template-keys

If true, ignore errors in templates due to missing fields or map keys. This only applies to golang and jsonpath output formats.

-o, --output

Output format. One of: (json, jsonpath, jsonpath-as-json, jsonpath-file).

--template

Template string or path to a template file to use when –output=jsonpath, –output=jsonpath-file.

Did you find this page helpful?