{"id":23698076,"url":"https://github.com/inloco/incognia-node","last_synced_at":"2026-05-14T15:01:19.648Z","repository":{"id":42661942,"uuid":"346374073","full_name":"inloco/incognia-node","owner":"inloco","description":"Node library for Incognia API","archived":false,"fork":false,"pushed_at":"2025-09-02T14:38:09.000Z","size":980,"stargazers_count":5,"open_issues_count":4,"forks_count":1,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-09-02T16:26:12.574Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inloco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-10T13:58:20.000Z","updated_at":"2025-09-02T14:36:39.000Z","dependencies_parsed_at":"2023-02-08T03:32:01.309Z","dependency_job_id":"6e843385-b353-46ba-bd53-0fece8da4d46","html_url":"https://github.com/inloco/incognia-node","commit_stats":{"total_commits":80,"total_committers":7,"mean_commits":"11.428571428571429","dds":0.55,"last_synced_commit":"2e9f529de0b6e056aaf2b635f56809727fad1ee4"},"previous_names":["inloco/incognia-api-node-wrapper"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/inloco/incognia-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inloco%2Fincognia-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inloco%2Fincognia-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inloco%2Fincognia-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inloco%2Fincognia-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inloco","download_url":"https://codeload.github.com/inloco/incognia-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inloco%2Fincognia-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273377063,"owners_count":25094525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T07:13:31.243Z","updated_at":"2026-05-14T15:01:19.639Z","avatar_url":"https://github.com/inloco.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Incognia Node Library\n\nThe official Node.js library for integrating with the Incognia API.\n\nDocumentation can be found at \u003chttps://developer.incognia.com/docs\u003e\n\n## Installation\n\nnpm:\n\n```sh\nnpm install @incognia/api\n```\n\nyarn:\n\n```sh\nyarn add @incognia/api\n```\n\n## Getting started\n\nRequire the package:\n\nCommonJS modules:\n\n```js\nconst { IncogniaApi } = require('@incognia/api')\n```\n\nOr ES modules:\n\n```js\nimport { IncogniaApi } from '@incognia/api'\n```\n\nInitialize the `IncogniaApi` with your `clientId` and `clientSecret`. This is a required step and must be done before calling any of the API methods.\n\n```js\nIncogniaApi.init({\n  clientId: 'clientId',\n  clientSecret: 'clientSecret'\n})\n```\n\n### Incognia API Options (`options`)\n\nYou can optionally configure HTTP behavior when initializing the SDK via the `options` parameter. These options affect all requests made by the library after initialization.\n\n```js\nIncogniaApi.init({\n  clientId: 'clientId',\n  clientSecret: 'clientSecret',\n  options: {\n    // Reuse TCP connections for better performance in high-throughput environments (Default: false)\n    keepAlive: true,\n    // Number of times to retry a failed request before throwing (Default: 0)\n    maxRetries: 3,\n    // Delay in milliseconds between retries (Default: 200)\n    retryDelayMs: 500\n  }\n})\n```\n\n- **keepAlive**: boolean. Default: `false`.\n  - When `true`, the library sets Node's `https.Agent` with `keepAlive: true` on the internal Axios instance, enabling connection reuse.\n- **maxRetries**: number. Default: `0`.\n  - Maximum number of retry attempts for failed requests. Retries are only performed on transient errors such as network failures or server errors (5xx responses). Client errors (4xx, e.g., invalid credentials) are not retried.\n- **retryDelayMs**: number. Default: `200`.\n  - The delay in milliseconds between each retry attempt. Useful for preventing overwhelming the API when multiple retries are configured.\n\n## API methods\n\n### Registering a Mobile Signup\n\nThis method registers a new mobile signup for the given request token and address, returning a signup assessment, containing the risk assessment and supporting evidence:\n\n```js\ntry {\n  const signup = await IncogniaApi.registerSignup({\n    requestToken: 'request_token',\n    policyId: 'policy_id',\n    structuredAddress: {\n      locale: 'en-US',\n      countryName: 'United States of America',\n      countryCode: 'US',\n      state: 'NY',\n      city: 'New York City',\n      borough: 'Manhattan',\n      neighborhood: 'Midtown',\n      street: 'W 34th St.',\n      number: '20',\n      complements: 'Floor 2',\n      postalCode: '10001',\n      county: 'New York County'\n    }\n  })\n} catch (error) {\n  console.log(error.message)\n}\n```\n\n### Registering a Web Signup\n\nThis method registers a new web signup for the given request token, returning a signup assessment, containing the risk assessment and supporting evidence:\n\n```js\ntry {\n  const signup = await IncogniaApi.registerWebSignup({\n    requestToken: 'request_token',\n    policyId: 'policy_id'\n  })\n} catch (error) {\n  console.log(error.message)\n}\n```\n\n### Registering a Mobile Login\n\nThis method registers a new mobile login for the given request token and account, returning a transaction assessment, containing the risk assessment and supporting evidence.\n\n```js\ntry {\n  const login = await IncogniaApi.registerLogin({\n    requestToken: 'request_token',\n    accountId: 'account_id',\n    policyId: 'policy_id',\n    externalId: 'external_id' // optional field\n  })\n} catch (error) {\n  console.log(error.message)\n}\n```\n\n### Registering a Web Login\n\nThis method registers a new web login for the given request token and account, returning a transaction assessment, containing the risk assessment and supporting evidence.\n\n```js\ntry {\n  const login = await IncogniaApi.registerWebLogin({\n    requestToken: 'request_token',\n    accountId: 'account_id',\n    policyId: 'policy_id'\n  })\n} catch (error) {\n  console.log(error.message)\n}\n```\n\n### Registering a Payment\n\nThis method registers a new payment for the given request token and account, returning a transaction assessment, containing the risk assessment and supporting evidence.\n\n```js\ntry {\n  const payment = await IncogniaApi.registerPayment({\n    requestToken: 'request_token',\n    accountId: 'account_id',\n    policyId: 'policy_id',\n    addresses: [\n      {\n        structuredAddress: {\n          locale: 'en-US',\n          countryName: 'United States of America',\n          countryCode: 'US',\n          state: 'NY',\n          city: 'New York City',\n          borough: 'Manhattan',\n          neighborhood: 'Midtown',\n          street: 'W 34th St.',\n          number: '20',\n          complements: 'Floor 2',\n          postalCode: '10001',\n          county: 'New York County'\n        },\n        addressCoordinates: {\n          lat: 40.74836007062138,\n          lng: -73.98509720487937\n        },\n        type: 'shipping'\n      }\n    ]\n  })\n} catch (error) {\n  console.log(error.message)\n}\n```\n\n### Registering a Web Payment\n\nThis method registers a new web payment for the given request token and account, returning a transaction assessment, containing the risk assessment and supporting evidence.\n\n```js\ntry {\n  const payment = await IncogniaApi.registerWebPayment({\n    requestToken: 'request_token',\n    accountId: 'account_id',\n    policyId: 'policy_id'\n  })\n} catch (error) {\n  console.log(error.message)\n}\n```\n\n### Sending Feedback\n\nThis method registers a feedback event for the given identifiers related to a signup, login or payment.\n\n```js\ntry {\n  IncogniaApi.registerFeedback({\n    installationId: 'installation_id',\n    accountId: 'account_id',\n    event: FeedbackEvent.AccountTakeover,\n    occurredAt: '2024-07-22T15:20:00Z'\n  })\n} catch (error) {\n  console.log(error.message)\n}\n```\n\n## Typescript enabled\n\nThanks to Typescript, all methods attributes and data response are typed, meaning any typescript-enabled editor can take advantage of intellisense and auto-complete:\n\n![Visual Studio Code Intellisense](vsc-intellisense.gif)\n\n## Response format\n\nResponses have JSONs identical to the original api \u003chttps://us.incognia.com\u003e, **however** property names will be in camelCase rather than snake_case, including property names in nested objects.\n\n```json\n{\n  \"id\": \"5e76a7ca-577c-4f47-a752-9e1e0cee9e49\",\n  \"riskAssessment\": \"low_risk\",\n  \"evidence\": {\n    \"deviceModel\": \"Moto Z2 Play\"\n  }\n}\n```\n\n## Exception handling\n\nEvery method call can throw `IncogniaApiError` and `IncogniaError`.\n\n`IncogniaApiError` is thrown when the API returned an unexpected http status code. You can retrieve it by calling the `statusCode` property, along with the `payload` property, which returns the API response payload that might include additional details.\n\n`IncogniaError` represents unknown errors, like serialization/deserialization errors.\n\n```js\nconst { IncogniaApi, IncogniaApiError } = require('@incognia/api')\n\ntry {\n  const loginAssessment = await IncogniaApi.registerLogin({\n    requestToken: 'request_token',\n    accountId: 'account_id'\n  })\n} catch (error) {\n  if (error instanceof IncogniaApiError) {\n    console.log(error.statusCode)\n    console.log(error.payload)\n  }\n}\n```\n\n## Migration to v6\n\nThe v6 changed the `IncogniaApi` interface, transforming the previous instance methods into static methods.\n\nWhen migrating to v6, adjust the `IncogniaApi` usage as follows.\n\n### Initialization\n\nInstead of creating an instance of the `IncogniaApi` class using your API credentials, just initialize the `IncogniaApi` with your credentials using the `init()` method. Initializing the `IncogniaApi` is a required step and must be done before calling any of the other `IncogniaApi` methods.\n\n```js\n// Before\nconst incogniaApi = new IncogniaApi({\n  clientId: 'clientId',\n  clientSecret: 'clientSecret'\n})\n\n// After\nIncogniaApi.init({\n  clientId: 'clientId',\n  clientSecret: 'clientSecret'\n})\n```\n\n### Register methods\n\nEvery method of the `IncogniaApi` instance is now static, and should be called on the `IncogniaApi` class.\n\n```js\n// Before\nconst signup = await incogniaApi.registerSignup({...})\nconst login = await incogniaApi.registerLogin({...})\nconst payment = await incogniaApi.registerPayment({...})\nincogniaApi.registerFeedback({...})\n\n// After\nconst signup = await IncogniaApi.registerSignup({...})\nconst login = await IncogniaApi.registerLogin({...})\nconst payment = await IncogniaApi.registerPayment({...})\nIncogniaApi.registerFeedback({...})\n```\n\nFurthermore, the `installationId` and `sessionToken` parameters were removed, and `requestToken` should be used instead. The `requestToken` field can receive the previous `installationId` and `sessionToken` values, as well as the new `requestToken` value from the Mobile and Web SDKs. Also, the `policyId` is now a required parameter and must be used on every assessment.\n\n```js\n// Before\nconst loginAssessment = await incogniaApi.registerLogin({\n  installationId: 'installation_id',\n  accountId: 'account_id'\n})\nconst webPaymentAssessment = await incogniaApi.registerWebPayment({\n  sessionToken: 'session_token',\n  accountId: 'account_id'\n})\n\n// After\nconst loginAssessment = await IncogniaApi.registerLogin({\n  requestToken: 'installation_id',\n  accountId: 'account_id',\n  policyId: 'policy_id'\n})\nconst webPaymentAssessment = await IncogniaApi.registerWebPayment({\n  requestToken: 'session_token',\n  accountId: 'account_id',\n  policyId: 'policy_id'\n})\n```\n\n## More documentation\n\nMore documentation and code examples can be found at \u003chttps://developer.incognia.com/docs\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finloco%2Fincognia-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finloco%2Fincognia-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finloco%2Fincognia-node/lists"}