Skip to content

Commit c8bc320

Browse files
Merge pull request #103 from algoliareadmebot/master
Update README
2 parents b3ad125 + bcaeae6 commit c8bc320

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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.
21552155
public_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

0 commit comments

Comments
 (0)