> 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 v1

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

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

This endpoint will be deprecated in a few months. We recommend transitioning to our [v2 Account Info API](/reference/getaccountinfo2)


Reference: https://docs.humansecurity.com/applications/reference/get-account-infov-1

## 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

- `attack_types` (list of enum, optional) — The type(s) of attack(s) to check for on the account. * If the parameter is not sent, then all available attack types will be checked. The returned response will be based on your available attack types. * If two `attack_types` are sent, then the response will prioritize returning the attack with a **Pending** status. * If both are **Pending**, then the response will return the attack with the higher risk score. * Otherwise, the response will return the **Resolved** or **Archived** attack with the highest risk score. For example, if the account has a **Pending** attack with a risk score of 60 and an **Archived** attack with a risk score of 100, then the response will return the Pending attack.
  - Allowed values: `['ato', 'fake_account']`, `['ato']`, `['fake_account']`, `[]`

## Response

### 200

Success

- `account_id` (string, optional) — The ID for the account.
- `is_under_attack` (boolean, optional) — The status for the attack corresponding to the statuses displayed in the **Account Defender** portal. `true` corresponds to **Pending** attacks. `false` corresponds to: * **Resolved** or **Archived** attacks * The account does not exist * The account exists, but was never under attack.
- `is_manually_created` (boolean, optional) — Whether the account was manually changed to be under attack. This response is only returned if the value is `true`.
- `risk_score` (integer, optional) — The risk score for the attack.
- `exists` (boolean, optional) — Whether the requested account exists.

## Errors

### 400 Bad Request Error

Bad request

- `any`

### 401 Unauthorized Error

Access token is missing or invalid

- `any`

## Examples

**Response**

```json
{
  "account_id": "123456789",
  "is_under_attack": true,
  "is_manually_created": true,
  "risk_score": 1,
  "exists": true
}
```

**SDK Code**

```python
import requests

url = "https://console.humansecurity.com/api/v1/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/v1/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/v1/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/v1/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/v1/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/v1/account_defender/account/123456789', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://console.humansecurity.com/api/v1/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/v1/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()
```