### Evaluate a login action with cURL Source: https://www.rupt.dev/api/evaluations/evaluate-an-action This example demonstrates how to evaluate a login action using cURL. It sends a POST request to the /v2/evaluate endpoint with the necessary payload. ```bash curl -X POST \ 'https://YOUR_API_ENDPOINT/v2/evaluate' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -d '{ "action": "login", "user": "USER_ID", "ip": "192.168.1.1", "fingerprint": "LQJgbAnEA", "last_fingerprint": "OwZmQ", "version": "2.32.0", "email": "user@example.com", "phone": "+1234567890", "metadata": { "email": { "status": "valid", "regexp": false, "normalized_email": "user@example.com", "gibberish": false, "disposable": false, "webmail": false, "mx_records": false, "smtp_server": false, "smtp_check": false, "accept_all": false, "block": false } } }' ``` -------------------------------- ### Attach Device Response Source: https://www.rupt.dev/api/devices/attach-a-device This is an example of the response received after successfully attaching a device. It includes details about the attached devices, limits, and access status. ```json { "success": true, "attached_devices": 3, "device_id": "6323dadac7c49192e9154563", "default_device_limit": 2, "block_over_usage": false, "suspended": false, "new_device": false, "access": "6323dadac7c49192e9763547", "metadata": { "key": "value" }, "verification_status": "verified" } ``` -------------------------------- ### Get Challenges with Node SDK Source: https://www.rupt.dev/api/challenges/list-all-challenges Use the Node SDK to fetch a list of challenges. Specify pagination parameters like page and limit. The maximum limit is 100. ```javascript const { data, total } = await Rupt.getChallenges({ page: 1, limit: 10, }); ``` -------------------------------- ### Get Challenge Devices with Node.js SDK Source: https://www.rupt.dev/api/challenges/retrieve-challenge-devices Use the `getChallengeDevices` method from the Rupt SDK to retrieve devices for a challenge. Ensure `CHALLENGE_ID` is defined. ```javascript const { data } = await Rupt.getChallengeDevices(CHALLENGE_ID); ``` -------------------------------- ### Get User Access History with JavaScript Source: https://www.rupt.dev/api/legacy-apis/access-history Use the axios library to make a GET request to the access-history endpoint. Ensure you include your API secret in the Authorization header and specify at least a 'user' or 'device' parameter in the query string. ```javascript import Rupt from 'rupt'; import axios from 'axios'; const { data } = await axios.get( 'https://api.rupt.dev/v2/proj/access-history?user=USER_ID', { headers: { Authorization: `Bearer ${API_SECRET}` } } ); ``` -------------------------------- ### Get User Devices Source: https://www.rupt.dev/api/evaluations Retrieves a list of devices associated with a specific user. ```APIDOC ## GET /v2/user/:id/devices ### Description Retrieves a list of devices associated with a specific user. ### Method GET ### Endpoint /v2/user/:id/devices ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the user. ``` -------------------------------- ### Retrieve User Devices (JavaScript) Source: https://www.rupt.dev/api/users/retrieve-user-devices Use the Axios library to make a GET request to the /v2/user/:id/devices endpoint. Ensure you include your API secret in the Authorization header. ```javascript import axios from 'axios'; const { data } = await axios.get( 'https://api.rupt.dev/v2/user/USER_ID/devices', { headers: { Authorization: `Bearer ${API_SECRET}` } } ); ``` -------------------------------- ### List Challenges using cURL Source: https://www.rupt.dev/api/challenges/list-all-challenges Make a GET request to the /v2/challenges endpoint to retrieve a list of challenges. Supports query parameters for pagination and date filtering. ```bash curl -X GET "https://api.rupt.dev/v2/challenges?page=1&limit=10" \ -H "Authorization: Bearer YOUR_API_TOKEN" ``` -------------------------------- ### Get Project Access History Source: https://www.rupt.dev/api/legacy-apis Retrieves the access history for a project. ```APIDOC ## GET /v2/proj/access-history ### Description Retrieves the access history for a project. ### Method GET ### Endpoint /v2/proj/access-history ``` -------------------------------- ### Get Challenge by ID Source: https://www.rupt.dev/api/challenges Retrieves a specific challenge by its unique identifier. ```APIDOC ## GET /v2/challenges/:id ### Description Retrieves a specific challenge by its ID. ### Method GET ### Endpoint /v2/challenges/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the challenge. ``` -------------------------------- ### Retrieve Challenge Details (Node.js) Source: https://www.rupt.dev/api/challenges/retrieve-a-challenge Use this method to get the full details of a specific challenge. Supply the challenge ID obtained from the Rupt SDK's `onChallenge` callback. Ensure CHALLENGE_ID is defined. ```javascript await Rupt.getChallenge(CHALLENGE_ID); ``` -------------------------------- ### Get Access History Source: https://www.rupt.dev/api/legacy-apis/access-history Fetches a paginated list of access records. You must provide either a `user` or `device` ID. You can also specify `per` for results per page and `page` for the desired page number. ```APIDOC ## GET /v2/proj/access-history ### Description Retrieves a paginated list of access records for a specific user or device. ### Method GET ### Endpoint /v2/proj/access-history ### Parameters #### Query Parameters - **user** (string) - Required - The ID of the user to get access history for. - **device** (string) - Required - The ID of the device to get access history for. - **per** (number) - Optional - A number between 1 and 50 indicating how many results to return per page. - **page** (number) - Optional - The page number to query. Defaults to 1. ### Request Example ```javascript const { data } = await axios.get( 'https://api.rupt.dev/v2/proj/access-history?user=USER_ID', { headers: { Authorization: `Bearer ${API_SECRET}` } } ); ``` ### Response #### Success Response (200) Returns a paginated response containing access records. - **docs** (array) - An array of access history objects. - **totalDocs** (number) - The total number of documents found. - **limit** (number) - The maximum number of documents per page. - **totalPages** (number) - The total number of pages available. - **page** (number) - The current page number. - **pagingCounter** (number) - The index of the first document on the current page. - **hasPrevPage** (boolean) - Indicates if there is a previous page. - **hasNextPage** (boolean) - Indicates if there is a next page. - **prevPage** (number | null) - The previous page number, or null if none. - **nextPage** (number | null) - The next page number, or null if none. #### Response Example ```json { "docs": [ { "_id": "633443fa96c1b648bfc29625", "signed": false, "device": { "_id": "633443f596c1b648bfc2916a", "user": "633443f5fd85e259023d7827", "project": "632c919b3c0a10dc53dcaa75", "info": { "ua": "Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120502 Firefox/12.0 SeaMonkey/2.9.1", "browser": { "name": "SeaMonkey", "version": "2.9.1", "major": "2" }, "engine": { "name": "Gecko", "version": "12.0" }, "os": { "name": "Linux", "version": "i686" }, "device": { "vendor": null, "model": null, "type": null }, "cpu": { "architecture": "ia32" } }, "status": "attached", "metadata": {}, "createdAt": "2022-09-28T12:54:13.510Z", "updatedAt": "2022-09-28T12:54:13.510Z", "__v": 0 }, "project": "632c919b3c0a10dc53dcaa75", "user": "633443f5fd85e259023d7827", "api_key": "632f6444952b1dbf850fd6f9", "confidence": 0.9714285714285714, "version": "2", "createdAt": "2022-09-28T12:54:18.757Z", "updatedAt": "2022-09-28T12:54:18.757Z", "__v": 0 } ], "totalDocs": 11, "limit": 10, "totalPages": 2, "page": 1, "pagingCounter": 1, "hasPrevPage": false, "hasNextPage": true, "prevPage": null, "nextPage": 2 } ``` ``` -------------------------------- ### Get Fingerprint ID with JavaScript SDK Source: https://www.rupt.dev/api/devices/fingerprint-a-device Use the `getFingerprint` function from the rupt SDK to obtain a device's fingerprint ID. Ensure you have the correct client ID for your project. ```javascript import { getFingerprint } from 'rupt'; const { fingerprint_id } = await getFingerprint({ client_id: "CLIENT_ID", }); ``` -------------------------------- ### Open Challenge with Options (JavaScript) Source: https://www.rupt.dev/api/challenges/open-a-challenge Use this snippet to open a challenge with specific redirect URLs, channel, and debug settings. Ensure the 'rupt' library is imported. ```javascript import { challenge } from 'rupt'; challenge({ challenge_id: "challenge_id", redirect_urls: { success_url: "https://example.com/success", }, channel: "text", debug: true, }) ``` -------------------------------- ### List All Challenges Source: https://www.rupt.dev/api/challenges/list-all-challenges Fetches a paginated list of challenges, sorted by creation date. ```APIDOC ## GET /v2/challenges ### Description Returns a list of your challenges. The challenges are returned sorted by creation date, with the most recently created challenges appearing first. ### Method GET ### Endpoint /v2/challenges ### Parameters #### Query Parameters - **page** (number) - Optional - The page of the query. Default is 1. - **limit** (number) - Optional - The number of results to return in the query. Maximum is 100. Default is 10. - **start_date** (date) - Optional - The beginning of the query range compared to the `createdAt` date of the challenge. - **end_date** (date) - Optional - The end of the query range compared to the `createdAt` date of the challenge. ### Response #### Success Response (200) - **data** (array) - A list of challenge objects. - **_id** (string) - The unique identifier for the challenge. - **user** (object) - Information about the user associated with the challenge. - **_id** (string) - The unique identifier for the user. - **external_id** (string) - The external identifier for the user. - **email** (string) - The email address of the user. - **phone** (string) - The phone number of the user. - **status** (string) - The current status of the challenge. - **reasons** (array) - A list of reasons associated with the challenge status. - **createdAt** (string) - The date and time the challenge was created. - **page** (number) - The current page number of the response. - **limit** (number) - The number of results per page. - **total** (number) - The total number of challenges available. ### Response Example ```json { "data": [ { "_id": "649873be6e8b6f9b33722a0c", "user": { "_id": "649873be6e8b6f9b33722a0c", "external_id": "external_account_id", "email": "ab*****@rupt.dev", "phone": "******34" }, "status": "pending", "reasons": ["limit_exceeded", "concurrency"], "createdAt": "2021-09-01T00:00:00.000Z" } ], "page": 1, "limit": 10, "total": 1000 } ``` ``` -------------------------------- ### Attach Device using JavaScript SDK Source: https://www.rupt.dev/api/devices/attach-a-device Attaches a device to a user account and returns device and user access state information. ```APIDOC ## POST /v2/device/attach ### Description Attaches a device to a user account and returns device and user access state information. ### Method POST ### Endpoint /v2/device/attach ### Parameters #### Request Body - **client_id** (string) - Required - The client ID for authentication. - **account** (string) - Required - The account ID of the user. - **phone** (string) - Required - The phone number of the user. - **email** (string) - Required - The email address of the user. - **metadata** (object) - Optional - Additional metadata for the device. - **groups** (array) - Optional - An array of group objects to associate with the device. - **id** (string) - Required - The ID of the group. - **name** (string) - Required - The name of the group. - **metadata** (object) - Optional - Additional metadata for the group. ### Request Example ```json { "client_id": "CLIENT_ID", "account": "account_id", "phone": "+15551234567", "email": "user@example.com", "metadata": { "key": "value" }, "groups": [ { "id": "group_id", "name": "group_name", "metadata": { "key": "value" } } ] } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **attached_devices** (integer) - The total number of devices attached to the account. - **device_id** (string) - The ID of the newly attached device. - **default_device_limit** (integer) - The default limit for the number of devices per account. - **block_over_usage** (boolean) - Indicates if over-usage is blocked. - **suspended** (boolean) - Indicates if the account is suspended. - **new_device** (boolean) - Indicates if this is a new device for the account. - **access** (string) - Access token or identifier. - **metadata** (object) - Metadata associated with the device. - **verification_status** (string) - The verification status of the user or device. #### Response Example ```json { "success": true, "attached_devices": 3, "device_id": "6323dadac7c49192e9154563", "default_device_limit": 2, "block_over_usage": false, "suspended": false, "new_device": false, "access": "6323dadac7c49192e9763547", "metadata": { "key": "value" }, "verification_status": "verified" } ``` ``` -------------------------------- ### List Devices for a Challenge Source: https://www.rupt.dev/api/challenges Retrieves a list of devices associated with a specific challenge. ```APIDOC ## GET /v2/challenges/:id/devices ### Description Retrieves a list of devices associated with a specific challenge. ### Method GET ### Endpoint /v2/challenges/:id/devices ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the challenge. ``` -------------------------------- ### Evaluate a login action with Node.js SDK Source: https://www.rupt.dev/api/evaluations/evaluate-an-action Use this snippet to evaluate a login attempt. Ensure the SDK is imported and configured. The parameters include user ID, IP address, fingerprint hashes, and optional email/phone/metadata. ```javascript const { verdict, challenge_id, fingerprint_id, reasons } = await Rupt.evaluate({ action: "login", user: "USER_ID", ip: "192.168.1.1", fingerprint: "LQJgbAnEA", last_fingerprint: "OwZmQ", version: "2.32.0", email: "user@example.com", phone: "+1234567890", metadata: { email: { status: "valid", regexp: false, normalized_email: "user@example.com", gibberish: false, disposable: false, webmail: false, mx_records: false, smtp_server: false, smtp_check: false, accept_all: false, block: false, } }, }); ``` -------------------------------- ### Open Challenge Source: https://www.rupt.dev/api/challenges/open-a-challenge Opens a challenge using the provided challenge ID and configuration options. ```APIDOC ## Open a Challenge Opens a challenge given the challenge_id. ### Parameters #### Path Parameters - **challenge_id** (string) - REQUIRED - The challenge ID. #### Query Parameters - **redirect_urls** (object) - JS only - The options for the challenge. - **success_url** (string) - The redirect url used when the challenge is completed. If not provided, the user will be redirected to the current page. The success url will contain the challenge_id as a query parameter. - **channel** (string) - The channel to automatically use for the challenge. `channel` can be `email` or `text`. If provided, the user will skip the channel selection step and the challenge will be sent to the provided channel. If not provided, the user will be asked to select a channel. - **debug** (boolean) - A boolean indicating whether to run in debug mode or not. If debug is `true`, any errors will be printed to the console as well as warnings and recommendations. ### Returns Returns null. ### Browser SDK Example ```javascript import { challenge } from 'rupt'; challenge({ challenge_id: "challenge_id", redirect_urls: { success_url: "https://example.com/success", }, channel: "text", debug: true, }) ``` ### Response Example ```json null ``` ``` -------------------------------- ### Retrieve User Devices (cURL) Source: https://www.rupt.dev/api/users/retrieve-user-devices Execute a cURL command to retrieve user devices. Replace USER_ID and API_SECRET with your actual values. The Authorization header is required. ```bash curl -X GET https://api.rupt.dev/v2/user/USER_ID/devices \ -H "Authorization: Bearer API_SECRET" ``` -------------------------------- ### Attach Device Source: https://www.rupt.dev/api/devices Attaches a new device to a user. ```APIDOC ## POST /v2/device/attach ### Description Attaches a new device to a user. ### Method POST ### Endpoint /v2/device/attach ``` -------------------------------- ### Get Device Hash - Browser SDK Source: https://www.rupt.dev/api/devices/retrieve-device-hash Use the `getHash` function from the 'rupt' library to retrieve the device's fingerprint hash. This hash is an array containing the current and last saved fingerprint. ```javascript import { getHash } from 'rupt'; const hash = await getHash(); ``` ```json [ "649873be6e8b6f9b33722a0c...", "649873be6e8b6f9b33722a0c..." ] ``` -------------------------------- ### Verify Challenge Code with Node SDK Source: https://www.rupt.dev/api/challenges/verify-challenge-code Use this method to verify a device for a challenge. Supply the unique challenge ID and the two-factor authentication code. ```javascript await Rupt.verifyChallengeCode({ challenge: "CHALLENGE_ID", code: "123456" }); ``` ```json { "success": true } ``` -------------------------------- ### Initialize Rupt Node SDK Source: https://www.rupt.dev/api/introduction Initialize the Rupt Node SDK on the server-side. Requires an API secret for authentication and provides type safety. ```javascript import RuptCore from '@ruptjs/core'; const Rupt = new RuptCore(API_SECRET); ``` -------------------------------- ### Retrieve User Devices Source: https://www.rupt.dev/api/users/retrieve-user-devices Fetches a list of all devices registered for a given user ID. ```APIDOC ## GET /v2/user/:id/devices ### Description Retrieve the list of devices for an existing user. Supply the unique user ID from the Rupt SDK `attach` method. ### Method GET ### Endpoint /v2/user/:id/devices ### Parameters No parameters ### Response #### Success Response (200) Returns a list of device objects. - **_id** (string) - Unique identifier for the device. - **user** (string) - The ID of the user the device is associated with. - **status** (string) - The current status of the device (e.g., "attached"). - **metadata** (object) - Key-value pairs for additional device information. - **info** (object) - Contains detailed information about the device. - **info.device** (object) - Specific device details. - **info.device.vendor** (string) - The manufacturer of the device. - **info.device.model** (string) - The model name of the device. - **info.device.type** (string) - The type of device (e.g., "mobile"). - **attachedAt** (string) - Timestamp when the device was attached. - **createdAt** (string) - Timestamp when the device record was created. - **updatedAt** (string) - Timestamp when the device record was last updated. ### Request Example ```javascript import axios from 'axios'; const { data } = await axios.get( 'https://api.rupt.dev/v2/user/USER_ID/devices', { headers: { Authorization: `Bearer ${API_SECRET}` } } ); ``` ### Response Example ```json [ { "_id": "635940382397b3ac0b81c0b7", "user": "649873be6e8b6f9b33722a0c", "status": "attached", "metadata": { "key": "value" }, "info": { "device": { "vendor": "Apple", "model": "iPhone 12", "type": "mobile" } }, "attachedAt": "2021-09-01T00:00:00.000Z", "createdAt": "2021-09-01T00:00:00.000Z", "updatedAt": "2021-09-01T00:00:00.000Z" } ] ``` ``` -------------------------------- ### admin.notify.shared_account Webhook Payload Source: https://www.rupt.dev/api/webhooks/admin-notify-shared-account This webhook is used to get notified when an admin receives a request for assistance during the account sharing challenge process when the challenge type is set to "Notify admins". The payload includes event details and account information. ```APIDOC ## Webhook: admin.notify.shared_account ### Description Notifies an admin when a user encounters an issue during the account sharing process and requires assistance. ### Event `admin.notify.shared_account` ### Payload Structure The webhook payload contains the following properties: - **event** (String): The name of the event, which is `admin.notify.shared_account`. - **account** (String): Identifier for the shared account. - **metadata_fields** (Map): Additional metadata associated with the event. - **device_count** (Number): The total number of devices associated with the account. - **attached_device_count** (Number): The number of devices currently attached to the account. - **other_users_devices_count** (Number): The number of devices belonging to other users that are relevant to this event. ### Example Payload ```json { "event": "admin.notify.shared_account", "account": "acc_12345", "metadata_fields": { "challenge_id": "ch_abcde" }, "device_count": 5, "attached_device_count": 3, "other_users_devices_count": 2 } ``` ``` -------------------------------- ### Retrieve Devices for a Challenge Source: https://www.rupt.dev/api/challenges/retrieve-challenge-devices Fetches a list of devices for a specified challenge using its unique ID. ```APIDOC ## GET /v2/challenges/:id/devices ### Description Retrieve the list of devices for an existing challenge. Supply the unique challenge ID from the Rupt SDK `onChallenge` callback. ### Method GET ### Endpoint /v2/challenges/:id/devices ### Parameters No parameters ### Response #### Success Response (200) Returns a list of device objects. - **_id** (string) - The unique identifier for the device. - **user** (string) - The ID of the user associated with the device. - **status** (string) - The current status of the device (e.g., "attached"). - **metadata** (object) - Additional metadata about the device. - **info** (object) - Information about the device hardware. - **device** (object) - **vendor** (string) - The manufacturer of the device. - **model** (string) - The model name of the device. - **type** (string) - The type of the device (e.g., "mobile"). - **attachedAt** (string) - The timestamp when the device was attached. - **createdAt** (string) - The timestamp when the device record was created. - **updatedAt** (string) - The timestamp when the device record was last updated. ### Response Example ```json [ { "_id": "635940382397b3ac0b81c0b7", "user": "649873be6e8b6f9b33722a0c", "status": "attached", "metadata": { "key": "value" }, "info": { "device": { "vendor": "Apple", "model": "iPhone 12", "type": "mobile" } }, "attachedAt": "2021-09-01T00:00:00.000Z", "createdAt": "2021-09-01T00:00:00.000Z", "updatedAt": "2021-09-01T00:00:00.000Z" } ] ``` ``` -------------------------------- ### Send Verification for Device Source: https://www.rupt.dev/api/challenges Initiates the verification process for a specific device within a challenge. ```APIDOC ## POST /v2/challenges/:id/devices/:id/send ### Description Sends a verification request for a specific device within a challenge. ### Method POST ### Endpoint /v2/challenges/:id/devices/:id/send ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the challenge. - **id** (string) - Required - The unique identifier of the device. ``` -------------------------------- ### Pagination Parameters and Response Structure Source: https://www.rupt.dev/api/pagination Many API resources support bulk fetching of records using pagination. This section details the common parameters accepted for pagination and the structure of the response. ```APIDOC ## Pagination Some API resources support bulk fetching of records. For these APIs, they will accept at minimum the following two parameters: `page`, and `limit` ### Parameters * * * `page` number The current page number * * * `limit` number The number of items per page ### Returns * * * `data` array An array containing the actual response elements, paginated by any request parameters. * * * `page` number optional, default is 10 The current page number * * * `limit` number The number of items per page * * * `total` number The total number of items The pagination object ```json { "data": [ ... ], "page": 1, "limit": 10, "total": 1000, } ``` ``` -------------------------------- ### List Devices of a User Source: https://www.rupt.dev/api/legacy-apis/list-devices-of-a-user This endpoint retrieves a list of all devices for a given user. It supports filtering by whitelisted devices and development mode. ```APIDOC ## GET /v2/proj/user/:id/devices ### Description Retrieve a list of all the devices for a user. This endpoint is deprecated. ### Method GET ### Endpoint /v2/proj/user/:id/devices ### Parameters #### Query Parameters - **whitelisted** (boolean) - Optional - A boolean indicating whether or not to include whitelisted devices in the response. - **dev** (boolean) - Optional - A boolean indicating which mode to query for devices in development mode only. ### Response #### Success Response (200) Returns a list of device objects. - **_id** (string) - The unique identifier for the device. - **user** (string) - The identifier of the user associated with the device. - **project** (string) - The identifier of the project the device belongs to. - **info** (object) - Contains detailed information about the device. - **status** (string) - The current status of the device (e.g., "detached"). - **metadata** (object) - Additional metadata associated with the device. - **createdAt** (string) - The timestamp when the device was created. - **updatedAt** (string) - The timestamp when the device was last updated. - **__v** (number) - Version key. - **auto_detached** (boolean) - Indicates if the device was automatically detached. - **detached_at** (string) - The timestamp when the device was detached. ### Request Example ```javascript import Rupt from 'rupt'; import axios from 'axios'; const { data } = await axios.get( 'https://api.rupt.dev/v2/proj/user/USER_ID/devices?whitelisted=true', { headers: { Authorization: `Bearer ${API_SECRET}` } } ); ``` ### Response Example ```json [ { "_id": "632f652d952b1dbf850fd797", "user": "632f652dfd85e259023bcb9c", "project": "632c919b3c0a10dc53dcaa75", "info": { // device info here }, "status": "detached", "metadata": { // metadata here }, "createdAt": "2022-09-24T20:14:37.512Z", "updatedAt": "2022-10-12T13:53:23.287Z", "__v": 0, "auto_detached": true, "detached_at": "2022-09-27T22:18:36.871Z" } ] ``` ``` -------------------------------- ### Evaluate an Action Source: https://www.rupt.dev/api/evaluations/evaluate-an-action This endpoint evaluates a user's action (e.g., login, signup) and returns a verdict on whether to allow, deny, or challenge the action. It accepts various parameters to enrich the evaluation context. ```APIDOC ## GET /v2/evaluate ### Description Evaluate an action to determine if it should be allowed, denied, or if a challenge should be triggered. ### Method GET ### Endpoint /v2/evaluate ### Parameters #### Query Parameters - **action** (string) - Required - The action to evaluate. Possible values are `signup` and `login`. - **user** (string) - Required - The user to evaluate. - **ip** (string) - Required - The IP address to evaluate. - **fingerprint** (string) - Optional - The current fingerprint hash. This is the first value returned by the client SDK `getHash()` method. - **last_fingerprint** (string) - Optional - The last saved fingerprint hash. This is the second value returned by the client SDK `getHash()` method. - **email** (string) - Optional - The email address to evaluate. - **phone** (string) - Optional - The phone number to evaluate. - **metadata** (object) - Optional - Any additional metadata to evaluate. - **version** (string) - Optional - The SDK version used to generate the fingerprint hashes. Must be set to `"2.32.0"`. ### Response #### Success Response (200) - **fingerprint_id** (string) - Description of the fingerprint ID. - **challenge_id** (string) - Description of the challenge ID. - **verdict** (string) - The evaluation result (e.g., `allow`, `deny`, `challenge`). - **reasons** (array) - A list of reasons for the verdict. - **metadata** (object) - Any additional metadata returned by the evaluation. ### Request Example ```javascript const { verdict, challenge_id, fingerprint_id, reasons } = await Rupt.evaluate({ action: "login", user: "USER_ID", ip: "192.168.1.1", fingerprint: "LQJgbAnEA", last_fingerprint: "OwZmQ", version: "2.32.0", email: "user@example.com", phone: "+1234567890", metadata: { email: { status: "valid", regexp: false, normalized_email: "user@example.com", gibberish: false, disposable: false, webmail: false, mx_records: false, smtp_server: false, smtp_check: false, accept_all: false, block: false, } }, }); ``` ### Response Example ```json { "fingerprint_id": "649873be6e8b6f9b33722a0c", "challenge_id": "649873be6e8b6f9b33722a0c", "verdict": "challenge", "reasons": ["new_fingerprint", "new_ip"], "metadata": { "email": { "status": "valid", "regexp": false, "normalized_email": "user@example.com", "gibberish": false, "disposable": false, "webmail": false, "mx_records": false, "smtp_server": false, "smtp_check": false, "accept_all": false, "block": false, } } } ``` ``` -------------------------------- ### List User Devices (JavaScript) Source: https://www.rupt.dev/api/legacy-apis/list-devices-of-a-user Use this snippet to retrieve a list of devices for a specific user. Include your API secret in the Authorization header. The `whitelisted` parameter can be set to `true` to filter the results. ```javascript import Rupt from 'rupt'; import axios from 'axios'; const { data } = await axios.get( 'https://api.rupt.dev/v2/proj/user/USER_ID/devices?whitelisted=true', { headers: { Authorization: `Bearer ${API_SECRET}` } } ); ``` -------------------------------- ### Verify Device Source: https://www.rupt.dev/api/challenges Verifies a specific device within a challenge. ```APIDOC ## POST /v2/challenges/:id/devices/:id/verify ### Description Verifies a specific device within a challenge. ### Method POST ### Endpoint /v2/challenges/:id/devices/:id/verify ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the challenge. - **id** (string) - Required - The unique identifier of the device. ``` -------------------------------- ### Attach Device using RUPT SDK Source: https://www.rupt.dev/api/devices/attach-a-device Use this function to attach a new device to an account. Ensure you have the necessary client and account IDs. The function returns the device ID upon successful attachment. ```javascript import { attach } from 'rupt'; const { device_id } = await attach({ client_id: "CLIENT_ID", account: "account_id", phone: "+15551234567", email: "user@example.com", metadata: { key: "value" }, groups: [{ id: "group_id", name: "group_name", metadata: { key: "value" } }], }) ``` -------------------------------- ### Complete Challenge Source: https://www.rupt.dev/api/challenges Marks a challenge as complete. ```APIDOC ## POST /v2/challenges/:id/devices/:id/complete ### Description Completes a challenge. ### Method POST ### Endpoint /v2/challenges/:id/devices/:id/complete ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the challenge. - **id** (string) - Required - The unique identifier of the device. ``` -------------------------------- ### Kick a device from a challenge (Node.js) Source: https://www.rupt.dev/api/challenges/kick-a-challenge-device Use this method to remove a specific device from a challenge. Ensure you have the correct challenge and device IDs. ```javascript await Rupt.kickChallengeDevice({ challenge: "CHALLENGE_ID", device: "DEVICE_ID", }); ``` ```json { "success": true } ``` -------------------------------- ### Complete Challenge with Node SDK Source: https://www.rupt.dev/api/challenges/complete-challenge Use this method to complete an existing challenge. Supply the unique challenge ID from the Rupt SDK `onChallenge` callback. ```javascript await Rupt.completeChallenge("CHALLENGE_ID"); ``` -------------------------------- ### Import Rupt Browser SDK Source: https://www.rupt.dev/api/introduction Import the Rupt Browser SDK for client-side operations. This is typically used in web applications. ```javascript import Rupt from 'rupt'; ``` -------------------------------- ### User Object JSON Representation Source: https://www.rupt.dev/api/users/the-user-object This is a sample JSON object representing a user. It includes the user's unique ID, external account ID, custom metadata, and timestamps for creation and last update. ```json { "id": "649873be6e8b6f9b33722a0c", "account": "external_id", "metadata": { "key": "value" }, "createdAt": "2021-09-01T00:00:00.000Z", "updatedAt": "2021-09-01T00:00:00.000Z" } ``` -------------------------------- ### Retrieve Challenge Details Source: https://www.rupt.dev/api/challenges/retrieve-a-challenge Use this endpoint to fetch the complete details of a specific challenge by providing its unique identifier. ```APIDOC ## GET /v2/challenges/:id ### Description Retrieve the details of an existing challenge. Supply the unique challenge ID from the Rupt SDK `onChallenge` callback. ### Method GET ### Endpoint /v2/challenges/:id ### Parameters No parameters ### Response #### Success Response (200) Returns a challenge object. ### Response Example ```json { "_id": "649873be6e8b6f9b33722a0c", "user": { "_id": "649873be6e8b6f9b33722a0c", "external_id": "external_account_id", "email": "ab*****@rupt.dev", "phone": "******34" }, "limit": { "is_exceeded": true, "overall": 1, "mobile": 0, "tablet": 0, "desktop": 1 }, "status": "pending", "reasons": ["limit_exceeded", "concurrency"], "channels": ["text", "email"], "createdAt": "2021-09-01T00:00:00.000Z" } ``` ``` -------------------------------- ### Verify Challenge Code Source: https://www.rupt.dev/api/challenges/verify-challenge-code Verify a device for an existing challenge. Supply the unique challenge ID from the Rupt SDK `onChallenge` callback. Supply the unique device ID from the list of devices for the challenge. ```APIDOC ## POST /v2/challenges/:id/verify ### Description Verify a device for an existing challenge using a two-factor authentication code. ### Method POST ### Endpoint /v2/challenges/:id/verify ### Parameters #### Query Parameters - **code** (string) - REQUIRED - The two-factor authentication code to verify the device. ### Request Example ```javascript await Rupt.verifyChallengeCode({ challenge: "CHALLENGE_ID", code: "123456" }); ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the verification was successful. ``` -------------------------------- ### Attach Device Source: https://www.rupt.dev/api/devices/attach-a-device Attaches a device to a specified user or account. Requires a client ID and either a user/account ID. Optional parameters include phone number, email, redirect URLs, group information, metadata, and more. ```APIDOC ## Attach Device ### Description Attaches a device to a user. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **client_id** (string) - REQUIRED - The client ID of your project's API key. - **user** / **account** (string) - REQUIRED - The ID of the user you want the device to be linked to. `user` is deprecated. - **phone** (string) - Optional - The phone number of the user. Must be in E.164 format. - **email** (string) - Optional - The email of the user. - **redirect_urls** (object) - Optional - URLs for redirecting the user after certain events. - **logout_url** (string) - Optional - Redirect URL when a device is detached. - **new_account_url** (string) - Optional - Redirect URL when a new account CTA is pressed. - **success_url** (string) - Optional - Redirect URL when the challenge is completed. - **suspended_url** (string) - Optional - Redirect URL when the suspension is determined for an attached device. - **upgrade_url** (string) - Optional - Redirect URL when an upgrade account CTA is pressed. - **groups** (object/array of objects) - Optional - The group or groups the user belongs to. - **group.id** (string) - REQUIRED - The ID of the group in your system. - **group.name** (string) - Optional - The name of the group or organization. - **group.metadata** (object) - Optional - Custom metadata for the group. - **metadata** (object) - Optional - Custom metadata for the device. - **include_page** (boolean) - Optional - If true, automatically gets the page URL and sends it with access data. - **signals** (object) - Optional - Browser signals used to identify the device. Use `getSignals` from the Rupt SDK. - **limit_config** (object) - Optional - Overrides project default limits. - **overall_device_limit** (number) - Optional - The overall device limit for the user. - **people_limit** (number) - Optional - The limit of people that can be attached to the user. - **event** (string) - Optional - A string to pass an event key. - **on_challenge** (function) - Optional - Callback triggered when Rupt determines a device session should be challenged (JavaScript SDK only). - **on_current_device_logout** (function) - Optional - Callback called when the current device needs to be detached. - **on_limit_exceeded** (function) - Optional - Callback called when the user exceeds the specified device limit. - **debug** (boolean) - Optional - If true, prints errors, warnings, and recommendations to the console. ### Request Example ```json { "client_id": "YOUR_CLIENT_ID", "user": "USER_ID", "phone": "+15551234567", "redirect_urls": { "success_url": "https://example.com/success" }, "groups": [ { "id": "GROUP_ID", "name": "Example Group" } ], "metadata": { "custom_key": "custom_value" }, "include_page": true, "limit_config": { "overall_device_limit": 5 } } ``` ### Response #### Success Response (200) Details of the attached device and user information. #### Response Example ```json { "device_id": "DEVICE_ID", "user_id": "USER_ID", "status": "attached", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Complete Project Identification Source: https://www.rupt.dev/api/legacy-apis Completes the identification process for a project. ```APIDOC ## POST /v2/proj/identification/:id/complete ### Description Completes the identification process for a project. ### Method POST ### Endpoint /v2/proj/identification/:id/complete ``` -------------------------------- ### List Challenges Source: https://www.rupt.dev/api/challenges Retrieves a list of all challenges associated with the account. ```APIDOC ## GET /v2/challenges ### Description Retrieves a list of all challenges. ### Method GET ### Endpoint /v2/challenges ``` -------------------------------- ### Send Challenge Code with Node SDK Source: https://www.rupt.dev/api/challenges/send-challenge-code Use this method to send a two-factor authentication code. Provide the challenge ID, device ID, and specify the channel (email or SMS) and language. ```javascript await Rupt.sendChallengeCode({ challenge: "CHALLENGE_ID", device: "DEVICE_ID", language: "en", channel: "email" }); ``` -------------------------------- ### Update Device Metadata with cURL Source: https://www.rupt.dev/api/devices/update-device-metadata This cURL command demonstrates how to update device metadata. Ensure you replace DEVICE_ID and API_SECRET with your specific credentials. The JSON payload includes the metadata_fields to be appended. ```bash curl -X POST \ 'https://api.rupt.dev/v2/device/DEVICE_ID/metadata' \ -H 'Authorization: Bearer API_SECRET' \ -H 'Content-Type: application/json' \ -d '{ "metadata_fields": { "key": "value" } }' ```