Actions52
- Advanced Actions
- Api Keys Actions
- Clusters Actions
- Dictionaries Actions
- Indices Actions
- Records Actions
- Rules Actions
- Search Actions
- Synonyms Actions
- Vaults Actions
Overview
This node operation allows you to create (add) a new API key in your Algolia application with specific permissions and restrictions. It is useful for managing access control by defining what actions the API key can perform, which indices it can access, and other usage limits or constraints.
Typical use cases include:
- Creating API keys with limited permissions for different parts of your application or team members.
- Restricting API key usage by IP address, HTTP referrers, or query parameters.
- Setting expiration times for temporary API keys.
- Limiting the number of queries or hits per query to control usage and costs.
For example, you might add an API key that only has search permissions on certain indices and restricts requests to a specific IP range.
Properties
| Name | Meaning |
|---|---|
| Multiple properties | Select one or more API key attributes to set. These include: Acl, Description, Indexes, Max Hits Per Query, Max Queries Per IPPer Hour, Query Parameters, Referers, Validity. |
| Acl | Permissions that determine the type of API requests this key can make. See Algolia's ACL documentation for details. |
| Description | A text description to help identify the API key. |
| Indexes | List of index names or patterns that this API key can access. Supports wildcards like dev_*, *_dev, or *_products_*. By default, the key can access all indices in the application. |
| Max Hits Per Query | Maximum number of results this API key can retrieve in one query. Default is no limit. |
| Max Queries Per IPPer Hour | Maximum number of API requests allowed per IP address or user token per hour. If exceeded, API returns status code 429. Default is no limit. |
| Query Parameters | Additional query parameters to add when making API requests with this key. For example, to restrict the key to specific IP addresses using restrictSources. Only one source can be added but it can specify a range of IPs. |
| Referers | Allowed HTTP referrers for this API key. Supports wildcards like https://algolia.com/* or *.algolia.com. By default, all referrers are allowed. Note that HTTP referrers can be spoofed and should not be solely relied upon for security. |
| Validity | Duration in seconds after which the API key expires. Default is 0 (no expiration). |
Output
The node outputs the JSON response from the Algolia API after creating the API key. This typically includes details about the newly created API key such as its value, permissions, restrictions, and metadata.
No binary data output is involved.
Dependencies
- Requires an API authentication credential for Algolia with sufficient permissions to create API keys.
- The node uses the Algolia REST API endpoint
/1/keyswith a POST method to add the API key. - Requires configuration of the Algolia Application ID and API key credentials in n8n.
Troubleshooting
- Error 429 (Too Many Requests): Occurs if the maxQueriesPerIPPerHour limit is exceeded. To resolve, increase the limit or reduce request frequency.
- Invalid ACL: Ensure the ACL array contains valid permission strings as per Algolia's documentation.
- Invalid Index Patterns: Check that index names or patterns are correctly formatted and exist in your Algolia application.
- Expired API Key: If validity is set, ensure the key is used before expiration.
- IP or Referrer Restrictions: If requests fail due to IP or referrer restrictions, verify that the calling IP or HTTP referrer matches the allowed ranges/patterns.
- Malformed JSON Inputs: When providing JSON inputs (e.g., ACL, indexes, referers), ensure they are valid JSON strings.