Constructor
new AML(apiKeyopt)
Create a new AML API client.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
apiKey |
string | null |
<optional> |
null | Your API key. If omitted, the `IDANALYZER_KEY` environment variable is used. |
- Source:
Extends
Methods
getApiKey(customKeyopt) → {string|null}
Resolve the API key, preferring the provided value and falling back to
the `IDANALYZER_KEY` environment variable.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
customKey |
string | null |
<optional> |
null | Explicitly supplied API key. |
- Overrides:
- Source:
Returns:
The resolved API key, or `null` if none is available.
- Type
- string | null
(async) search(nameopt, idNumberopt, entityopt, countryopt, databaseopt, birthYearopt) → {Promise.<ApiResponse>}
Search the AML database (v1 endpoint).
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string |
<optional> |
"" | Search AML database with a person's name or business name. |
idNumber |
string |
<optional> |
"" | Search AML database with a document number. |
entity |
number |
<optional> |
0 | Entity type: 0=Person, 1=Corporation/Legal Entity. |
country |
string |
<optional> |
"" | Two-digit ISO country code to filter by country/nationality. |
database |
Array.<string> | null |
<optional> |
null | Optional array of databases to search, e.g. ["us_ofac","eu_fsf"]. If omitted, all databases are searched. |
birthYear |
string |
<optional> |
"" | Filter by year of birth. |
- Source:
Throws:
-
If both `name` and `idNumber` are empty.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
(async) searchV3(textopt, idopt, limitopt, pageopt) → {Promise.<ApiResponse>}
Search the AML database (v3 endpoint). Provide either a free-text query or one or more entity IDs.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
text |
string |
<optional> |
"" | Full-text query (name, alias, document/passport/tax/registration number, etc.). |
id |
string |
<optional> |
"" | One or more AML entity IDs separated by comma or newline (max 50). |
limit |
number |
<optional> |
0 | Number of results to return per page. 0 uses the API default. |
page |
number |
<optional> |
0 | Result page number. 0 uses the API default. |
- Source:
Throws:
-
If both `text` and `id` are empty.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
setParam(key, value) → {void}
Set an API parameter and its value, this function allows you to set any API parameter without using the built-in functions
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | Parameter key |
value |
* | Parameter value |
- Overrides:
- Source:
Returns:
- Type
- void
throwApiException(swopt) → {void}
Whether an exception should be thrown if API response contains an error message
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
sw |
boolean |
<optional> |
false | Set to `true` to throw an APIError when the API response contains an error, or `false` to return the raw error response instead. |
- Overrides:
- Source:
Returns:
- Type
- void