Constructor
new ProfileAPI(apiKeyopt)
Create a new Profile 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
(async) createProfile(nameopt, profileopt) → {Promise.<ApiResponse>}
Create a new KYC profile.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string |
<optional> |
"" | Profile name. |
profile |
Profile | Object.<string, *> | null |
<optional> |
null | A Profile object (its overrides become the profile config) or a plain object. |
- Source:
Throws:
-
If `name` is empty, or `profile` is an unsupported type.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
(async) deleteProfile(profileIdopt) → {Promise.<ApiResponse>}
Delete a KYC profile.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
profileId |
string |
<optional> |
"" | KYC profile ID. |
- Source:
Throws:
-
If `profileId` is empty.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
(async) exportProfile(profileIdopt) → {Promise.<ApiResponse>}
Export a KYC profile (GET /export/profile/{id}).
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
profileId |
string |
<optional> |
"" | KYC profile ID. |
- Source:
Throws:
-
If `profileId` is empty.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
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) getProfile(profileIdopt) → {Promise.<ApiResponse>}
Retrieve a single KYC profile.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
profileId |
string |
<optional> |
"" | KYC profile ID. |
- Source:
Throws:
-
If `profileId` is empty.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>
(async) listProfile(orderopt, limitopt, offsetopt) → {Promise.<ApiResponse>}
List KYC profiles.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
order |
number |
<optional> |
-1 | Sort results by newest(-1) or oldest(1). |
limit |
number |
<optional> |
10 | Number of items to be returned per call. |
offset |
number |
<optional> |
0 | Start the list from a particular entry index. |
- Source:
Throws:
-
If `order` is not 1 or -1.
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
(async) updateProfile(profileIdopt, nameopt, profileopt) → {Promise.<ApiResponse>}
Update an existing KYC profile.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
profileId |
string |
<optional> |
"" | KYC profile ID. |
name |
string |
<optional> |
"" | New profile name. |
profile |
Profile | Object.<string, *> | null |
<optional> |
null | A Profile object (its overrides become the profile config) or a plain object. |
- Source:
Throws:
-
If `profileId` is empty, or `profile` is an unsupported type.
Returns:
The parsed API response.
- Type
- Promise.<ApiResponse>