Quickstart
This quickstart takes you from nothing to a working script in a few minutes. You will issue a personal access token, check that you can reach your tenant, list your assets, follow a page of results, and list open incidents.
You need:
- An Elastio tenant, and the subdomain you use to sign in (for example
acmeinhttps://acme.app.elastio.com). - A tenant admin account, or a tenant admin who can issue a token for you.
curl, Python 3 withrequests, or PowerShell 7.
-
Get a personal access token.
Tenant admins issue tokens in the Elastio console. Give the token a descriptive name, grant it
readaccess to the scope categories you need (for this quickstart,inventoryandsecurity), and copy the token value. It is shown only once.If you already have a token with admin rights, you can issue new ones through the API with
POST /gateway/shared-services/v1/personal-access-tokens. See Issue a token with the API. -
Store the token and tenant in your environment.
Keep the token out of your source code. The examples on this site read it from
ELASTIO_TOKEN.Terminal window export ELASTIO_TENANT="acme"export ELASTIO_TOKEN="<paste your token>"Terminal window export ELASTIO_TENANT="acme"export ELASTIO_TOKEN="<paste your token>"pip install requestsTerminal window $env:ELASTIO_TENANT = "acme"$env:ELASTIO_TOKEN = "<paste your token>" -
Check that you can reach the API.
Terminal window curl "https://$ELASTIO_TENANT.app.elastio.com/gateway/api/v1/health_check" \-H "Authorization: Bearer $ELASTIO_TOKEN"import os, requestsBASE = f"https://{os.environ['ELASTIO_TENANT']}.app.elastio.com"HEADERS = {"Authorization": f"Bearer {os.environ['ELASTIO_TOKEN']}"}resp = requests.get(f"{BASE}/gateway/api/v1/health_check", headers=HEADERS, timeout=30)resp.raise_for_status()print(resp.json())Terminal window $Base = "https://$env:ELASTIO_TENANT.app.elastio.com"$Headers = @{ Authorization = "Bearer $env:ELASTIO_TOKEN" }Invoke-RestMethod -Uri "$Base/gateway/api/v1/health_check" -Headers $HeadersA
200response with a JSON body containing astatusfield means the tenant is reachable. A401means the token is missing, mistyped, expired or revoked. See Errors. -
List your assets.
GET /gateway/api/v2/assetsreturns the live inventory: every asset with its health, finding counts, latest hunts, tags and policy coverage. Filters are comma-separated lists; here you ask for AWS assets that have findings (infected) or are at risk, 25 at a time.Terminal window curl -G "https://$ELASTIO_TENANT.app.elastio.com/gateway/api/v2/assets" \-H "Authorization: Bearer $ELASTIO_TOKEN" \--data-urlencode "platform=aws" \--data-urlencode "health=infected,at_risk" \--data-urlencode "page_size=25"params = {"platform": "aws", "health": "infected,at_risk", "page_size": 25}resp = requests.get(f"{BASE}/gateway/api/v2/assets", headers=HEADERS, params=params, timeout=30)resp.raise_for_status()page = resp.json()for asset in page["data"]:print(asset["asset_id"], asset["asset_kind"], asset["asset_name"], asset["health"])Terminal window $page = Invoke-RestMethod -Uri "$Base/gateway/api/v2/assets?platform=aws&health=infected,at_risk&page_size=25" -Headers $Headers$page.data | Select-Object asset_id, asset_kind, asset_name, healthThe response has the matching assets in
data, atotal, and apaginationobject:{"total": 42,"data": [{"asset_id": "0b6f3c1e-8a52-4c2e-9d1f-5e7a2b9c4d10","asset_name": "web-prod-01","asset_kind": "ec2_instance","platform": "aws","platform_details": { "account_id": "123456789012", "region": "us-east-1" },"health": "infected","threats": { "malware": 0, "ransomware": 1, "encryption": 0, "filesystem_error": 0 },"…": "…"}],"pagination": { "next_page_token": "eyJvZmZzZXQiOjI1fQ" }} -
Fetch the next page.
Pass
pagination.next_page_tokenback as thenext_page_tokenquery parameter, with the same filters. When the response has nonext_page_token, you have every result.Terminal window curl -G "https://$ELASTIO_TENANT.app.elastio.com/gateway/api/v2/assets" \-H "Authorization: Bearer $ELASTIO_TOKEN" \--data-urlencode "platform=aws" \--data-urlencode "health=infected,at_risk" \--data-urlencode "page_size=25" \--data-urlencode "next_page_token=eyJvZmZzZXQiOjI1fQ"assets = list(page["data"])token = (page.get("pagination") or {}).get("next_page_token")while token:resp = requests.get(f"{BASE}/gateway/api/v2/assets",headers=HEADERS,params={**params, "next_page_token": token},timeout=30,)resp.raise_for_status()page = resp.json()assets.extend(page["data"])token = (page.get("pagination") or {}).get("next_page_token")print(f"{len(assets)} assets")Terminal window $assets = @($page.data)$token = $page.pagination.next_page_tokenwhile ($token) {$t = [uri]::EscapeDataString($token)$page = Invoke-RestMethod -Uri "$Base/gateway/api/v2/assets?platform=aws&health=infected,at_risk&page_size=25&next_page_token=$t" -Headers $Headers$assets += $page.data$token = $page.pagination.next_page_token}"$($assets.Count) assets" -
List open incidents.
Incidents use offset pagination:
limit(at most 20) andoffset.statusdefaults toopen, andseveritytakes a comma-separated list.Terminal window curl "https://$ELASTIO_TENANT.app.elastio.com/gateway/api/v2/incidents?status=open&severity=critical,high&limit=20" \-H "Authorization: Bearer $ELASTIO_TOKEN"params = {"status": "open", "severity": "critical,high", "limit": 20}resp = requests.get(f"{BASE}/gateway/api/v2/incidents", headers=HEADERS, params=params, timeout=30)resp.raise_for_status()body = resp.json()print(f"{body['total']} open incidents")for incident in body["data"]:print(incident["handle"], incident["finding"]["severity"], incident["finding"]["title"])Terminal window $body = Invoke-RestMethod -Uri "$Base/gateway/api/v2/incidents?status=open&severity=critical,high&limit=20" -Headers $Headers"$($body.total) open incidents"$body.data | ForEach-Object { "{0} {1} {2}" -f $_.handle, $_.finding.severity, $_.finding.title }{"total": 3,"data": [{"id": "7d2e9f40-1c3b-4a8e-b5d6-2f9a0c1e3b47","handle": "INC-000012","status": "open","asset_id": "0b6f3c1e-8a52-4c2e-9d1f-5e7a2b9c4d10","opened_at": "2026-10-11T08:14:03Z","version": 1,"finding": {"id": "…","class": "threat","severity": "critical","status": "open","title": "…","asset_name": "web-prod-01","platform": "aws"},"…": "…"}]}To get the next page, add
offset=20, thenoffset=40, untiloffsetreachestotal.