GET API key
API keys API is the endpoint that represents the most popular keys appearing in the account.
URL
https://REGION.rest.logs.insight.rapid7.com/management/organizations/apikeys
REGION is the data center that your account is in, e.g. "us","eu", "ca" or "au".
Method:
GET
Authentication
Owner or Read Write key is required.
Success Response:
Response codes:
- 200 for existent, non-expired and active API keys.
- 404 for non matching API key param and authenticated API key.
Content:
json
1{2"apikeys": [3{4"id": "181c9a30-xxxx-4c7d-af1a-xxxxxxxxxxxx",5"api_key": "'00112233-4455-6677-8899-aabbccddeeff'",6"acl_type": "ReadOnly",7"apilimits": {8"default": 500,9"management": 1500,10"query": 150011},12"expires": null,13"active": true14},15{16"id": "xxxxxxxx-0bd9-xxxx-8eaa-xxxxxxxxxxxx",17"api_key": "xxxxxxxxx-fa82-xxxx-xxxx-b7db2c3fa542",18"acl_type": "ReadWrite",19"apilimits": {20"default": 500,21"management": 1500,22"query": 150023},24"expires": null,25"active": true26}27]28}
where:
Key | About | example |
---|---|---|
id | API key id used in URL to get this resource | "id": "181c9a30-xxxx-4c7d-af1a-xxxxxxxxxxxx" |
api_key | The actual API key | "api_key": "xxxxxxxx-dca9-xxxx-ae4f-a5432fc3aafc", |
acl_type | Type of acl associated with this key - Owner, ReadWrite or ReadOnly | "acl_type": "ReadOnly", |
apilimits | Consists of name:value pairs where name is management or query or any other api endpoint with a specific limit | "apilimits": { |
expires | Set when created and checked when authenticating | "expires": null, |
active | True if the key still active (false if disabled) | "active": true |
Note:
- The actual api_key is never returned for an owner key.
Sample Call
python
1import requests2import json3import time45API_KEY = 'xxxxxxxxx-fa82-xxxx-8422-b7db2c3fa542'67def handle_response(resp):8response = resp9time.sleep(1)10if response.status_code == 200:11print json.dumps(resp.json(), indent=4)12else:13print response.status_code1415def make_request(provided_url=None):16headers = {'x-api-key': API_KEY}1718url = "https://rest.logentries.com/management/organizations/apikeys"19req = requests.get(url, headers=headers)20return req212223def get_log():24req = make_request()25handle_response(req)2627def start():28get_log()2930if __name__ == '__main__':31start()