> This page is for Applications Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# Get account info v2

GET https://console.humansecurity.com/api/v2/account_defender/account/{account_id}

Access the attack status and risk score of an account on your application. 

This updated version includes detailed information in the response. We recommend transitioning to this version from the [v1](/reference/getaccountinfov1).


Reference: https://docs.humansecurity.com/applications/reference/get-account-info-2

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://console.humansecurity.com/api` (Version 1 of the API., default)
- `https://console.humansecurity.com/api` (Version 2 of the API.)

## Request

### Path parameters

- `account_id` (string, required) — ID for an account

### Query parameters

- `days_range` (integer, optional, default: 30) — Customizes the aggregative data calculation. When provided, the following behavior applies: - The `aggregative_data` fields will be calculated based on values observed within the specified time period. - The time period is defined as the last `days_range` days from the current date. - Only data points that fall within this window will be included in the calculations.

## Response

### 200

Success

- `account_id` (string, optional) — The ID for the account.
- `exists` (boolean, optional) — Whether the specified account exists.
- `is_under_attack` (boolean, optional) — The status for the attack corresponding to the statuses displayed in the Account Defender portal. Only present if `exists` returns `true`. `true` corresponds to **Pending** attacks. `false` corresponds to: - **Resolved** or **Archived** attacks - The account does not exist - The account exists, but is not under attack
- `first_seen` (string, optional) — The first time Account Defender encountered this account. Only present if `exists` returns `true`.
- `last_seen` (string, optional) — The last time Account Defender encountered this account. Only present if `exists` returns `true`.
- `email` (string, optional) — The account's email address. Only present if `exists` returns `true`.
- `registration_date` (string, optional) — The date the account was created. Only present if `exists` returns `true`.
- `active_incidents` (list of activeIncident, optional) — An array of pending incidents on the account. Only present if `is_under_attack` returns `true`.
- `aggregative_data` (AccountInfo2AggregativeData, optional) — Statistical information about the account based on the supplied `days_range`. Only present if calculated information is available for the given `days_range`.

## Errors

### 400 Bad Request Error

Bad request

- `any`

### 403 Forbidden Error

Access token is missing or invalid

- `any`

## Types

### activeIncident

- `attack_type` (enum, optional) — The type of detected attack.
  - Allowed values: `account_takeover`, `fake_account`
- `event_type` (enum, optional) — Classification of the event.
  - Allowed values: `single`, `network`
- `risk_score` (double, optional) — Risk assessment score from 0-1, where 0 is no risk and 1 is certainly a risk.
- `is_manually_created` (boolean, optional) — Whether the incident was manually created.
- `incident_creation` (string, optional) — When the incident was created.
- `additional` (ActiveIncidentAdditional, optional) — Further information about the incident.

### AccountInfo2AggregativeData

Statistical information about the account based on the supplied `days_range`. Only present if calculated information is available for the given `days_range`.

- `trigger_categories` (list of string, optional) — A list of trigger categories.
- `sensitive_transactions` (list of string, optional) — A list of detected sensitive endpoints.

### ActiveIncidentAdditional

Further information about the incident.

- single: single
- network: network

### single

The response object when `event_type` returns `single`.

- `account_age` (integer, optional) — The age of the account in hours, rounded down.
- `asn` (string, optional)
- `city` (string, optional)
- `country` (string, optional)
- `custom_param1` (string, optional)
- `custom_param2` (string, optional)
- `custom_param3` (string, optional)
- `custom_param4` (string, optional)
- `custom_param5` (string, optional)
- `custom_param6` (string, optional)
- `custom_param7` (string, optional)
- `custom_param8` (string, optional)
- `custom_param9` (string, optional)
- `custom_param10` (string, optional)
- `device_fingerprint` (string, optional) — The unique device identifier.
- `email` (string, optional)
- `ip` (string, optional)
- `path` (string, optional)
- `user_agent` (string, optional)
- `vid` (string, optional)

### network

The response object when `event_type` returns `network`.

- `network_id` (string, optional) — The identifier for the network.
- `network_type` (enum, optional) — The type of the identifier the network was based on.
  - Allowed values: `vid`, `device_fingerprint`, `normalized_email`

## Examples

**Response**

```json
{
  "account_id": "123456789",
  "exists": true,
  "is_under_attack": true,
  "first_seen": "2023-10-06T19:52:12.132Z",
  "last_seen": "2025-01-21T13:00:41.008Z",
  "email": "email@email.com",
  "registration_date": "2021-01-06T19:25:28Z",
  "active_incidents": [
    {
      "attack_type": "account_takeover",
      "event_type": "single",
      "risk_score": 0.707,
      "is_manually_created": false,
      "incident_creation": "2025-01-20T14:19:49.028Z",
      "additional": {
        "account_age": 35394,
        "asn": "Mobile Telecommunications Company",
        "city": "City",
        "country": "KCountryW",
        "device_fingerprint": "16427277324375911310",
        "email": "email@email.com",
        "ip": "1.1.1.1",
        "path": "/inbox/conversations/messages",
        "user_agent": "Mozilla/5.0",
        "vid": "111"
      }
    }
  ],
  "aggregative_data": {
    "trigger_categories": [
      "network",
      "behavior"
    ],
    "sensitive_transactions": [
      "send_message",
      "send_attachment"
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://console.humansecurity.com/api/v2/account_defender/account/123456789"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://console.humansecurity.com/api/v2/account_defender/account/123456789';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://console.humansecurity.com/api/v2/account_defender/account/123456789"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://console.humansecurity.com/api/v2/account_defender/account/123456789")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://console.humansecurity.com/api/v2/account_defender/account/123456789")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://console.humansecurity.com/api/v2/account_defender/account/123456789', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://console.humansecurity.com/api/v2/account_defender/account/123456789");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://console.humansecurity.com/api/v2/account_defender/account/123456789")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```