File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2128,7 +2128,7 @@ You can restrict the key to a list of index names allowed for the secured API ke
21282128
21292129``` python
21302130# generate a public API key that is restricted to 'index1' and 'index2':
2131- public_key = client.generate_secured_api_key(' YourSearchOnlyApiKey' , {' restrictIndices' : valid_until })
2131+ public_key = client.generate_secured_api_key(' YourSearchOnlyApiKey' , {' restrictIndices' : ' index1,index2 ' })
21322132```
21332133
21342134#### Rate Limiting
@@ -2155,6 +2155,15 @@ even if he shares his `IP` with another user.
21552155public_key = client.generate_secured_api_key(' YourSearchOnlyApiKey' , {' filters' : ' _tags:user_42' , ' userToken' : ' user_42' })
21562156```
21572157
2158+ #### Network restriction
2159+
2160+ For more protection against API key leaking and reuse you can restrict the key to be valid only from specific IPv4 networks
2161+
2162+ ``` python
2163+ # generate a public API key that is restricted to '192.168.1.0/24':
2164+ public_key = client.generate_secured_api_key(' YourSearchOnlyApiKey' , {' restrictSources' : ' 192.168.1.0/24' })
2165+ ```
2166+
21582167
21592168
21602169
You can’t perform that action at this time.
0 commit comments