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": 1500
11
},
12
"expires": null,
13
"active": true
14
},
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": 1500
23
},
24
"expires": null,
25
"active": true
26
}
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": {
"default": 500,
"management": 1500,
"query": 1500
}

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
1
import requests
2
import json
3
import time
4
5
API_KEY = 'xxxxxxxxx-fa82-xxxx-8422-b7db2c3fa542'
6
7
def handle_response(resp):
8
response = resp
9
time.sleep(1)
10
if response.status_code == 200:
11
print json.dumps(resp.json(), indent=4)
12
else:
13
print response.status_code
14
15
def make_request(provided_url=None):
16
headers = {'x-api-key': API_KEY}
17
18
url = "https://rest.logentries.com/management/organizations/apikeys"
19
req = requests.get(url, headers=headers)
20
return req
21
22
23
def get_log():
24
req = make_request()
25
handle_response(req)
26
27
def start():
28
get_log()
29
30
if __name__ == '__main__':
31
start()