-
Compute a SHA-256 HMAC with:
- Secret: the parent API key
- Message: a URL-encoded list of query parameters
- Concatenate the SHA-256 HMAC with the list of query parameters into a single string.
-
Encode the resulting string in
base64.
Usage
var response = client.GenerateSecuredApiKey(
"2640659426d5107b6e47d75db9cbaef8",
new SecuredApiKeyRestrictions
{
ValidUntil = 2524604400L,
RestrictIndices = new List<string> { "Movies" },
}
);
response, err := client.GenerateSecuredApiKey(
"2640659426d5107b6e47d75db9cbaef8",
search.NewEmptySecuredApiKeyRestrictions().SetValidUntil(2524604400).SetRestrictIndices(
[]string{"Movies"}))
if err != nil {
// handle the eventual error
panic(err)
}
String response = client.generateSecuredApiKey(
"2640659426d5107b6e47d75db9cbaef8",
new SecuredApiKeyRestrictions().setValidUntil(2524604400L).setRestrictIndices(Arrays.asList("Movies"))
);
const response = client.generateSecuredApiKey({
parentApiKey: '2640659426d5107b6e47d75db9cbaef8',
restrictions: { validUntil: 2524604400, restrictIndices: ['Movies'] },
});
var response =
client.generateSecuredApiKey(
parentApiKey = "2640659426d5107b6e47d75db9cbaef8",
restrictions =
SecuredApiKeyRestrictions(validUntil = 2524604400L, restrictIndices = listOf("Movies")),
)
$response = $client->generateSecuredApiKey(
'2640659426d5107b6e47d75db9cbaef8',
['validUntil' => 2524604400,
'restrictIndices' => [
'Movies',
],
],
);
response = client.generate_secured_api_key(
parent_api_key="2640659426d5107b6e47d75db9cbaef8",
restrictions={
"validUntil": 2524604400,
"restrictIndices": [
"Movies",
],
},
)
response = client.generate_secured_api_key(
"2640659426d5107b6e47d75db9cbaef8",
Algolia::Search::SecuredApiKeyRestrictions.new(valid_until: 2524604400, restrict_indices: ["Movies"])
)
val response = client.generateSecuredApiKey(
parentApiKey = "2640659426d5107b6e47d75db9cbaef8",
restrictions = SecuredApiKeyRestrictions(
validUntil = Some(2524604400L),
restrictIndices = Some(Seq("Movies"))
)
)
let response = try client.generateSecuredApiKey(
parentApiKey: "2640659426d5107b6e47d75db9cbaef8",
restrictions: SecuredApiKeyRestrictions(validUntil: Int64(2_524_604_400), restrictIndices: ["Movies"])
)
Parameters
- C#
- Go
- Java
- JavaScript
- Kotlin
- PHP
- Python
- Ruby
- Scala
- Swift
string
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParamsObject
Search parameters that are always applied when using this API key.
For more information, see API parameters.
string
Filters that are always applied when using this API key.
long
Timestamp when the API key expires,
in seconds since the Unix epoch.
List<string>
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.string
IP network range that is allowed to use this API key.
string
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
string
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParamsObject
Search parameters that are always applied when using this API key.
For more information, see API parameters.
string
Filters that are always applied when using this API key.
int64
Timestamp when the API key expires,
in seconds since the Unix epoch.
[]string
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.string
IP network range that is allowed to use this API key.
string
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
String
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParamsObject
Search parameters that are always applied when using this API key.
For more information, see API parameters.
String
Filters that are always applied when using this API key.
Long
Timestamp when the API key expires,
in seconds since the Unix epoch.
List<String>
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.String
IP network range that is allowed to use this API key.
String
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
string
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParams
Search parameters that are always applied when using this API key.
For more information, see API parameters.
String
Filters that are always applied when using this API key.
number
Timestamp when the API key expires,
in seconds since the Unix epoch.
string[]
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.string
IP network range that is allowed to use this API key.
string
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
String
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParamsObject
Search parameters that are always applied when using this API key.
For more information, see API parameters.
String
Filters that are always applied when using this API key.
Long
Timestamp when the API key expires,
in seconds since the Unix epoch.
List<String>
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.String
IP network range that is allowed to use this API key.
String
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
string
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
array
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
array
Search parameters that are always applied when using this API key.
For more information, see API parameters.
string
Filters that are always applied when using this API key.
int
Timestamp when the API key expires,
in seconds since the Unix epoch.
string[]
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.string
IP network range that is allowed to use this API key.
string
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
str
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
dict | SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
dict | SearchParams
Search parameters that are always applied when using this API key.
For more information, see API parameters.
str
Filters that are always applied when using this API key.
int
Timestamp when the API key expires,
in seconds since the Unix epoch.
list[str]
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.str
IP network range that is allowed to use this API key.
str
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
String
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
Hash
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParams
Search parameters that are always applied when using this API key.
For more information, see API parameters.
String
Filters that are always applied when using this API key.
integer
Timestamp when the API key expires,
in seconds since the Unix epoch.
Array[String]
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.String
IP network range that is allowed to use this API key.
String
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
String
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParamsObject
Search parameters that are always applied when using this API key.
For more information, see API parameters.
String
Filters that are always applied when using this API key.
Long
Timestamp when the API key expires,
in seconds since the Unix epoch.
Seq[String]
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.String
IP network range that is allowed to use this API key.
String
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.
String
required
The API key to be used as secret for the secured API key.
The secured API key inherits all restrictions from its parent.
You can’t use an Admin API key as parent.
SecuredApiKeyRestrictions
required
You must apply at least one restriction when creating a secured API key.
If you try to use a secured API key with the same restrictions as its parent key,
the API returns a
403 Forbidden error.Show child attributes
Show child attributes
SearchParamsObject
Search parameters that are always applied when using this API key.
For more information, see API parameters.
String
Filters that are always applied when using this API key.
int
Timestamp when the API key expires,
in seconds since the Unix epoch.
[String]
Indices names that this API key can access.
Use
* as a wildcard, for example dev_* to allow all indices with names that start with dev_.
When using replica indices, include them explicitly, or use wildcard patterns.String
IP network range that is allowed to use this API key.
String
By default, rate limits are applied per IP address.
If many users share an IP,
add a user token to each generated API key to avoid incorrect rate limiting.