### Install Merge Node Client Source: https://github.com/merge-api/merge-node-client/blob/main/README.md Install the Merge Node.js client library using npm or yarn. ```bash npm install --save @mergeapi/merge-node-client # or yarn add @mergeapi/merge-node-client ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/merge-api/merge-node-client/blob/main/CONTRIBUTING.md Installs all necessary dependencies for the project using yarn. ```bash yarn install ``` -------------------------------- ### Build the Project Source: https://github.com/merge-api/merge-node-client/blob/main/CONTRIBUTING.md Compiles the project code. ```bash yarn build ``` -------------------------------- ### Get Sync Status Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Retrieves the sync status for the current and most recently finished sync. This includes timestamps for when syncs started and finished, along with their results. ```APIDOC ## GET /sync/status ### Description Get sync status for the current sync and the most recently finished sync. `last_sync_start` represents the most recent time any sync began. `last_sync_finished` represents the most recent time any sync completed. These timestamps may correspond to different sync instances which may result in a sync start time being later than a separate sync completed time. To ensure you are retrieving the latest available data reference the `last_sync_finished` timestamp where `last_sync_result` is `DONE`. Possible values for `status` and `last_sync_result` are `DISABLED`, `DONE`, `FAILED`, `PARTIALLY_SYNCED`, `PAUSED`, `SYNCING`. Learn more about sync status in our [Help Center](https://help.merge.dev/en/articles/8184193-merge-sync-statuses). ### Method GET ### Endpoint /sync/status ### Parameters #### Query Parameters - **cursor** (string) - Optional - For example, `cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw`. - **pageSize** (integer) - Optional - For example, `1`. ### Response #### Success Response (200) - **sync_status** (object) - Description of the sync status object. - **next_page** (string) - Optional - URL for the next page of results. ### Response Example ```json { "sync_status": [ { "id": "string", "company": "string", "last_sync_start": "2023-01-01T12:00:00Z", "last_sync_finished": "2023-01-01T12:05:00Z", "status": "DONE", "last_sync_result": "DONE" } ], "next_page": "/sync/status?cursor=..." } ``` ``` -------------------------------- ### Client Instantiation (`new MergeClient(options)`) Source: https://context7.com/merge-api/merge-node-client/llms.txt Creates the top-level client for interacting with the Merge API. Requires an `apiKey` and optionally accepts `accountToken`, `environment`, `baseUrl`, `timeoutInSeconds`, `maxRetries`, `fetch`, and `headers`. ```APIDOC ## `new MergeClient(options)` — Client instantiation Creates the top-level client. `apiKey` is mandatory; `accountToken` is required for all end-user data endpoints but can be omitted during initial Link sessions. Optional fields include `environment`, `baseUrl`, `timeoutInSeconds`, `maxRetries`, `fetch`, and `headers`. ```typescript import { MergeClient, MergeEnvironment } from '@mergeapi/merge-node-client'; // Production (default) const merge = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN, }); // EU region const mergeEu = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN, environment: MergeEnvironment.ProductionEu, }); // Sandbox with custom timeout and retries const mergeSandbox = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN, environment: MergeEnvironment.Sandbox, timeoutInSeconds: 30, maxRetries: 3, }); ``` ``` -------------------------------- ### client.crm.accountDetails.retrieve() Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get details for a linked account. ```APIDOC ## retrieve ### Description Get details for a linked account. ### Method GET ### Endpoint /crm/account-details ### Parameters #### Query Parameters - **requestOptions** (AccountDetailsClient.RequestOptions) - Optional - Options for the request. ### Response #### Success Response (200) - **account_details** (Merge.AccountDetails) - Details of the linked account. ``` -------------------------------- ### Run Test Suite Source: https://github.com/merge-api/merge-node-client/blob/main/CONTRIBUTING.md Executes the full test suite for the project. ```bash yarn test ``` -------------------------------- ### Filestorage AccountDetails Retrieve Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get details for a linked account. ```APIDOC ## Filestorage AccountDetails Retrieve ### Description Get details for a linked account. ### Method ``` client.filestorage.accountDetails.retrieve ``` ### Parameters #### Request Body - **requestOptions** (AccountDetailsClient.RequestOptions) - Optional - Options for the retrieve request. ### Request Example ```typescript await client.filestorage.accountDetails.retrieve(); ``` ``` -------------------------------- ### Ticketing Issues Retrieve Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get a specific issue by its ID. ```APIDOC ## Ticketing Issues Retrieve ### Description Get a specific issue. ### Method GET ### Endpoint /ticketing/issues/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the issue to retrieve. #### Query Parameters - **requestOptions** (IssuesClient.RequestOptions) - Required - Options for the request, such as API keys and timeouts. ### Response #### Success Response (200) - **response** (Merge.Issue) - The retrieved issue object. ``` -------------------------------- ### Instantiate Merge Client Source: https://github.com/merge-api/merge-node-client/blob/main/README.md Instantiate the MergeClient with your API key and account token. ```typescript import { MergeClient } from '@mergeapi/merge-node-client'; const merge = new MergeClient({ apiKey: 'YOUR_API_KEY', accountToken: 'YOUR_ACCOUNT_TOKEN', }); ``` -------------------------------- ### Get Time Off Metadata Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Retrieves metadata for Time Off POST requests. ```APIDOC ## Get Time Off Metadata ### Description Returns metadata for `TimeOff` POSTs. ### Method `client.hris.timeOff.metaPostRetrieve(requestOptions?: TimeOffClient.RequestOptions)` ### Parameters #### Request Options - **requestOptions** (TimeOffClient.RequestOptions) - Optional - Options for the request, such as idempotency key. ### Response #### Success Response Returns a `MetaResponse` object containing metadata. ### Request Example ```typescript await client.hris.timeOff.metaPostRetrieve(); ``` ``` -------------------------------- ### create Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Create a remote key. ```APIDOC ## create ### Description Create a remote key. ### Method POST ### Endpoint /api/ats/generate-key ### Parameters #### Request Body - **name** (string) - Required - The name of the remote key. ### Request Example ```json { "name": "Remote Deployment Key 1" } ``` ### Response #### Success Response (201) - **remote_key** (object) - The created remote key instance. #### Response Example ```json { "remote_key": { "id": "key-12345", "name": "Remote Deployment Key 1", "created_at": "2023-01-01T12:00:00Z" } } ``` ``` -------------------------------- ### create Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Create a remote key. ```APIDOC ## create ### Description Create a remote key. ### Method POST ### Endpoint /accounting/generate-key ### Parameters #### Request Body - **name** (string) - Required - The name of the remote key. ### Request Example { "name": "Remote Deployment Key 1" } ### Response #### Success Response (201) - **id** (string) - Unique identifier for the remote key. - **name** (string) - The name of the remote key. - **key** (string) - The generated remote key. - **created_at** (datetime) - The timestamp when the remote key was created. #### Response Example { "id": "rem_key_123", "name": "Remote Deployment Key 1", "key": "pk_test_abcdef123456", "created_at": "2023-01-02T10:00:00.000Z" } ``` -------------------------------- ### Get Folder Metadata for POST Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Retrieves metadata for FileStorageFolder POST operations. ```APIDOC ## Get Folder Metadata for POST ### Description Retrieves metadata for `FileStorageFolder` POST operations. ### Method `client.filestorage.folders.metaPostRetrieve(requestOptions?: FoldersClient.RequestOptions)` ### Response #### Success Response (200) - **Merge.MetaResponse** - The metadata response. ### Response Example ```json { "fields": [ { "name": "name", "type": "string", "required": true } ] } ``` ``` -------------------------------- ### Ticketing Issues List Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Gets all issues for the organization. Supports pagination and filtering. ```APIDOC ## Ticketing Issues List ### Description Gets all issues for Organization. ### Method GET ### Endpoint /ticketing/issues ### Parameters #### Query Parameters - **request** (Merge.ticketing.IssuesListRequest) - Required - Parameters for listing issues. - **accountToken** (string) - Required - Indicates the account to perform the request on. - **cursor** (string) - Optional - The cursor value for the next page of results. - **endDate** (string) - Optional - If you have provided a `start_date`, then any values in `end_date` will be the end of the range (inclusive). - **endUserOrganizationName** (string) - Optional - If you want to filter issues by end user organization name. - **firstIncidentTimeAfter** (Date) - Optional - If you have provided a `start_date`, then any values in `first_incident_time_after` will be the first incident time after the date (inclusive). - **firstIncidentTimeBefore** (Date) - Optional - If you have provided a `start_date`, then any values in `first_incident_time_before` will be the first incident time before the date (inclusive). - **includeMuted** (string) - Optional - Whether to include muted issues. - **integrationName** (string) - Optional - If you want to filter issues by integration name. - **lastIncidentTimeAfter** (Date) - Optional - If you have provided a `start_date`, then any values in `last_incident_time_after` will be the last incident time after the date (inclusive). - **lastIncidentTimeBefore** (Date) - Optional - If you have provided a `start_date`, then any values in `last_incident_time_before` will be the last incident time before the date (inclusive). - **linkedAccountId** (string) - Optional - If you want to filter issues by linked account ID. - **pageSize** (number) - Optional - Number of results to return. - **startDate** (string) - Optional - If you have provided an `end_date`, then any values in `start_date` will be the start of the range (inclusive). - **status** (string) - Optional - If you want to filter issues by status. Possible values: `ONGOING`, `RESOLVED`. - **requestOptions** (IssuesClient.RequestOptions) - Required - Options for the request, such as API keys and timeouts. ### Response #### Success Response (200) - **response** (core.Page) - A paginated list of issues. ``` -------------------------------- ### List Payroll Runs with Merge Node Client Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Demonstrates how to list payroll runs using the Merge Node.js client, with options for pagination and data filtering. Includes examples for both async iteration and manual page-by-page fetching. ```typescript const pageableResponse = await client.hris.payrollRuns.list({ createdAfter: new Date("2024-01-15T09:30:00.000Z"), createdBefore: new Date("2024-01-15T09:30:00.000Z"), cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", endedAfter: new Date("2024-01-15T09:30:00.000Z"), endedBefore: new Date("2024-01-15T09:30:00.000Z"), includeDeletedData: true, includeRemoteData: true, includeShellData: true, modifiedAfter: new Date("2024-01-15T09:30:00.000Z"), modifiedBefore: new Date("2024-01-15T09:30:00.000Z"), pageSize: 1, remoteFields: "run_state", remoteId: "remote_id", runType: "CORRECTION", showEnumOrigins: "run_state", startedAfter: new Date("2024-01-15T09:30:00.000Z"), startedBefore: new Date("2024-01-15T09:30:00.000Z") }); for await (const item of pageableResponse) { console.log(item); } ``` ```typescript // Or you can manually iterate page-by-page let page = await client.hris.payrollRuns.list({ createdAfter: new Date("2024-01-15T09:30:00.000Z"), createdBefore: new Date("2024-01-15T09:30:00.000Z"), cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", endedAfter: new Date("2024-01-15T09:30:00.000Z"), endedBefore: new Date("2024-01-15T09:30:00.000Z"), includeDeletedData: true, includeRemoteData: true, includeShellData: true, modifiedAfter: new Date("2024-01-15T09:30:00.000Z"), modifiedBefore: new Date("2024-01-15T09:30:00.000Z"), pageSize: 1, remoteFields: "run_state", remoteId: "remote_id", runType: "CORRECTION", showEnumOrigins: "run_state", startedAfter: new Date("2024-01-15T09:30:00.000Z"), startedBefore: new Date("2024-01-15T09:30:00.000Z") }); while (page.hasNextPage()) { page = page.getNextPage(); } ``` ```typescript // You can also access the underlying response const response = page.response; ``` -------------------------------- ### client.hris.issues.list Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Gets all issues for an Organization. This method is part of the HRIS Issues resource. ```APIDOC ## client.hris.issues.list ### Description Gets all issues for Organization. ### Parameters #### Request Body - **request** (Merge.hris.IssuesListRequest) - Optional - Parameters for listing issues. - **requestOptions** (IssuesClient.RequestOptions) - Optional - Options for the request, such as timeout or idempotency. ### Response #### Success Response (200) - **response** (core.Page) - A paginated list of Issue objects. ``` -------------------------------- ### List and Download Files with Merge Node Client Source: https://context7.com/merge-api/merge-node-client/llms.txt Shows how to search for a PDF file by name and MIME type, then download its content using the Merge Node.js client. Requires environment variables MERGE_API_KEY and MERGE_ACCOUNT_TOKEN. ```typescript import { MergeClient } from '@mergeapi/merge-node-client'; import { pipeline } from 'stream/promises'; import * as fs from 'fs'; const merge = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN!, }); // Search for a file by name const listing = await merge.filestorage.files.list({ name: 'Q4_Report.pdf', mimeType: 'application/pdf', driveId: 'drive-uuid', }); const file = listing.response.results?.[0]; if (file?.id) { // Download it const stream = await merge.filestorage.files.downloadRetrieve(file.id); const dest = fs.createWriteStream(`/tmp/${file.name}`); await pipeline(stream as any, dest); console.log(`Downloaded ${file.name} to /tmp/`); } ``` -------------------------------- ### client.crm.auditTrail.list Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Gets a list of audit trail events with filtering and pagination capabilities. ```APIDOC ## client.crm.auditTrail.list ### Description Gets a list of audit trail events. ### Method GET ### Endpoint /crm/audit-trail ### Parameters #### Query Parameters - **cursor** (string) - Optional - The cursor for the next page of results. - **endDate** (string) - Optional - The end date for filtering audit events. - **eventType** (string) - Optional - The type of event to filter by. - **pageSize** (number) - Optional - The number of results per page. - **startDate** (string) - Optional - The start date for filtering audit events. - **userEmail** (string) - Optional - The email of the user to filter by. #### Request Body - **request** (Merge.crm.AuditTrailListRequest) - Required - The request object for listing audit trail events. - **requestOptions** (AuditTrailClient.RequestOptions) - Required - Options for the request. ### Response #### Success Response (200) - **response** (core.Page) - The paginated response containing audit log events. ``` -------------------------------- ### Create Activity Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Creates an Activity object with the specified values. ```APIDOC ## Create Activity ### Description Creates an `Activity` object with the given values. ### Method client.ats.activities.create({ ...params }) ### Parameters #### Request Body - **request**: Merge.ats.ActivityEndpointRequest - The activity data to create. #### Request Options - **requestOptions**: ActivitiesClient.RequestOptions - Optional parameters for the request. ### Parameters (Example) - **isDebugMode**: boolean - Optional - Enable debug mode. - **runAsync**: boolean - Optional - Run the creation asynchronously. - **model**: object - Required - The activity model data. - **remoteUserId**: string - Optional - The ID of the remote user. ``` -------------------------------- ### Get Scheduled Interview Metadata Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Retrieves metadata for ScheduledInterview POST requests. ```APIDOC ## Get Scheduled Interview Metadata ### Description Returns metadata for `ScheduledInterview` POSTs. ### Method `client.ats.interviews.metaPostRetrieve(requestOptions: InterviewsClient.RequestOptions)` ### Parameters No specific request body parameters are documented for this method. ### Request Example ```typescript await client.ats.interviews.metaPostRetrieve(); ``` ### Response #### Success Response (200) Returns a `Merge.MetaResponse` object. ``` -------------------------------- ### List Payroll Runs with Merge Node Client Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Returns a list of PayrollRun objects. This is a basic example, and further details on parameters or iteration would typically follow. ```typescript await client.hris.payrollRuns.list({ ...params }); ``` -------------------------------- ### client.ticketing.scopes.linkedAccountScopesRetrieve Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get all available permissions for Merge Common Models and fields for a single Linked Account. ```APIDOC ## linkedAccountScopesRetrieve ### Description Get all available permissions for Merge Common Models and fields for a single Linked Account. [Learn more](https://help.merge.dev/en/articles/5950052-common-model-and-field-scopes). ### Method GET ### Endpoint /ticketing/scopes/linked-account ### Parameters #### Query Parameters - **requestOptions** (ScopesClient.RequestOptions) - Optional - Options for the request. ### Response #### Success Response (200) - **example** (Merge.CommonModelScopeApi) - Scopes for a single Linked Account. ``` -------------------------------- ### List Offers Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Returns a list of Offer objects. Supports filtering by application ID, creation/modification dates, creator ID, and status, along with pagination. ```APIDOC ## Ats Offers ### Description Returns a list of `Offer` objects. ### Method client.ats.offers.list ### Parameters - **request**: Merge.ats.OffersListRequest - **requestOptions**: OffersClient.RequestOptions ### Request Example ```typescript const pageableResponse = await client.ats.offers.list({ applicationId: "application_id", createdAfter: new Date("2024-01-15T09:30:00.000Z"), createdBefore: new Date("2024-01-15T09:30:00.000Z"), creatorId: "creator_id", cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", includeDeletedData: true, includeRemoteData: true, includeShellData: true, modifiedAfter: new Date("2024-01-15T09:30:00.000Z"), modifiedBefore: new Date("2024-01-15T09:30:00.000Z"), pageSize: 1, remoteFields: "status", remoteId: "remote_id", showEnumOrigins: "status", status: "APPROVAL-SENT" }); for await (const item of pageableResponse) { console.log(item); } ``` ### Response - **Success Response**: `core.Page` ``` -------------------------------- ### client.crm.issues.retrieve() Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get a specific issue by its ID. This method retrieves detailed information about a single issue. ```APIDOC ## client.crm.issues.retrieve ### Description Get a specific issue. ### Method GET ### Endpoint /crm/issues/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the issue to retrieve. #### Query Parameters - **requestOptions** (IssuesClient.RequestOptions) - Optional - Options for the request, such as timeout and idempotency. ### Response #### Success Response (200) - **response** (Merge.Issue) - The requested issue object. ``` -------------------------------- ### List ATS Candidates with Manual Cursor Pagination Source: https://context7.com/merge-api/merge-node-client/llms.txt Demonstrates manual cursor-based pagination for listing ATS candidates. Use this when you need more control over fetching pages. Ensure MERGE_API_KEY and MERGE_ACCOUNT_TOKEN are set. ```typescript import { MergeClient } from '@mergeapi/merge-node-client'; const merge = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN!, }); // Manual cursor pagination let current = await merge.ats.candidates.list({ pageSize: 25 }); while (current.hasNextPage()) { current = await current.getNextPage(); for (const c of current.response.results ?? []) { console.log(c.id, c.firstName); } } ``` -------------------------------- ### Get Ticketing Comment Metadata Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Retrieves metadata for comment POST operations. This endpoint does not require any parameters. ```typescript await client.ticketing.comments.metaPostRetrieve(); ``` -------------------------------- ### List Employees with Pagination in Node.js Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Demonstrates how to list employees using the Merge Node.js client, supporting both async iteration and manual page-by-page fetching. Includes access to the raw response. ```typescript const pageableResponse = await client.hris.employees.list({ companyId: "company_id", createdAfter: new Date("2024-01-15T09:30:00.000Z"), createdBefore: new Date("2024-01-15T09:30:00.000Z"), cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", displayFullName: "display_full_name", employeeNumber: "employee_number", employmentStatus: "ACTIVE", employmentType: "employment_type", firstName: "first_name", groups: "groups", homeLocationId: "home_location_id", includeDeletedData: true, includeRemoteData: true, includeSensitiveFields: true, includeShellData: true, jobTitle: "job_title", lastName: "last_name", managerId: "manager_id", modifiedAfter: new Date("2024-01-15T09:30:00.000Z"), modifiedBefore: new Date("2024-01-15T09:30:00.000Z"), pageSize: 1, payGroupId: "pay_group_id", personalEmail: "personal_email", remoteFields: "employment_status", remoteId: "remote_id", showEnumOrigins: "employment_status", startedAfter: new Date("2024-01-15T09:30:00.000Z"), startedBefore: new Date("2024-01-15T09:30:00.000Z"), teamId: "team_id", terminatedAfter: new Date("2024-01-15T09:30:00.000Z"), terminatedBefore: new Date("2024-01-15T09:30:00.000Z"), workEmail: "work_email", workLocationId: "work_location_id" }); for await (const item of pageableResponse) { console.log(item); } // Or you can manually iterate page-by-page let page = await client.hris.employees.list({ companyId: "company_id", createdAfter: new Date("2024-01-15T09:30:00.000Z"), createdBefore: new Date("2024-01-15T09:30:00.000Z"), cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", displayFullName: "display_full_name", employeeNumber: "employee_number", employmentStatus: "ACTIVE", employmentType: "employment_type", firstName: "first_name", groups: "groups", homeLocationId: "home_location_id", includeDeletedData: true, includeRemoteData: true, includeSensitiveFields: true, includeShellData: true, jobTitle: "job_title", lastName: "last_name", managerId: "manager_id", modifiedAfter: new Date("2024-01-15T09:30:00.000Z"), modifiedBefore: new Date("2024-01-15T09:30:00.000Z"), pageSize: 1, payGroupId: "pay_group_id", personalEmail: "personal_email", remoteFields: "employment_status", remoteId: "remote_id", showEnumOrigins: "employment_status", startedAfter: new Date("2024-01-15T09:30:00.000Z"), startedBefore: new Date("2024-01-15T09:30:00.000Z"), teamId: "team_id", terminatedAfter: new Date("2024-01-15T09:30:00.000Z"), terminatedBefore: new Date("2024-01-15T09:30:00.000Z"), workEmail: "work_email", workLocationId: "work_location_id" }); while (page.hasNextPage()) { page = page.getNextPage(); } // You can also access the underlying response const response = page.response; ``` -------------------------------- ### client.filestorage.webhookReceivers.create Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Creates a WebhookReceiver object with the given values. ```APIDOC ## client.filestorage.webhookReceivers.create ### Description Creates a `WebhookReceiver` object with the given values. ### Method Not specified (assumed to be a client SDK method) ### Endpoint Not specified (client SDK method) ### Parameters #### Request Body - **request** (Merge.filestorage.WebhookReceiverRequest) - Required - The webhook receiver details. - **event** (string) - Required - The event to trigger the webhook. - **isActive** (boolean) - Required - Whether the webhook receiver is active. #### Query Parameters - **requestOptions** (WebhookReceiversClient.RequestOptions) - Optional - Options for the request. ### Request Example ```typescript await client.filestorage.webhookReceivers.create({ event: "event", isActive: true }); ``` ### Response #### Success Response (200) - **WebhookReceiver** - The created webhook receiver object. ``` -------------------------------- ### Retrieve a Specific Ticketing Issue Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get a specific issue by its ID. This is a direct retrieval method and does not involve pagination. ```typescript await client.ticketing.issues.retrieve("id"); ``` -------------------------------- ### client.ats.asyncPassthrough.create Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Asynchronously pull data from an endpoint not currently supported by Merge. ```APIDOC ## client.ats.asyncPassthrough.create ### Description Asynchronously pull data from an endpoint not currently supported by Merge. ### Parameters - **request:** `Merge.DataPassthroughRequest` - The request body containing the data passthrough details. - **requestOptions:** `AsyncPassthroughClient.RequestOptions` - Options for the request. ### Usage Example ```typescript await client.ats.asyncPassthrough.create({ method: "GET", path: "/scooters" }); ``` ``` -------------------------------- ### client.ticketing.scopes.defaultScopesRetrieve Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get the default permissions for Merge Common Models and fields across all Linked Accounts of a given category. ```APIDOC ## defaultScopesRetrieve ### Description Get the default permissions for Merge Common Models and fields across all Linked Accounts of a given category. [Learn more](https://help.merge.dev/en/articles/5950052-common-model-and-field-scopes). ### Method GET ### Endpoint /ticketing/scopes/default ### Parameters #### Query Parameters - **requestOptions** (ScopesClient.RequestOptions) - Optional - Options for the request. ### Response #### Success Response (200) - **example** (Merge.CommonModelScopeApi) - Default scopes for Ticketing. ``` -------------------------------- ### Retrieve Ticketing Contact Metadata Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Use this method to get metadata for TicketingContact POST requests. It does not require any parameters. ```typescript await client.ticketing.contacts.metaPostRetrieve(); ``` -------------------------------- ### Instantiate MergeClient Source: https://context7.com/merge-api/merge-node-client/llms.txt Create a new MergeClient instance with API key and optional account token. Supports different regions and custom request options. ```typescript import { MergeClient, MergeEnvironment } from '@mergeapi/merge-node-client'; // Production (default) const merge = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN, }); // EU region const mergeEu = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN, environment: MergeEnvironment.ProductionEu, }); // Sandbox with custom timeout and retries const mergeSandbox = new MergeClient({ apiKey: process.env.MERGE_API_KEY!, accountToken: process.env.MERGE_ACCOUNT_TOKEN, environment: MergeEnvironment.Sandbox, timeoutInSeconds: 30, maxRetries: 3, }); ``` -------------------------------- ### client.ticketing.auditTrail.list Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Gets a list of audit trail events, providing a history of actions performed within the ticketing system. ```APIDOC ## GET /ticketing/audit-trail ### Description Retrieves a paginated list of audit trail events. ### Method GET ### Endpoint /ticketing/audit-trail ### Parameters #### Query Parameters - **created_after** (datetime) - Optional - If provided, only events created after this date will be included. - **created_before** (datetime) - Optional - If provided, only events created before this date will be included. - **cursor** (string) - Optional - For paginating through results. - **page_size** (integer) - Optional - Number of results to return per page. ### Response #### Success Response (200) - **data** (array[AuditLogEvent]) - Array of AuditLogEvent objects. - **has_more** (boolean) - Indicates if there are more pages of results. - **next_page** (string) - URL to the next page of results. ### Response Example ```json { "data": [ { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "created_at": "2023-10-20T10:00:00.000Z", "event_type": "ticket.created", "actor": { "type": "user", "id": "user_123", "name": "John Doe" }, "ticket_id": "a47a-9184-477c-9187-742244636131", "actor_type": "user", "actor_id": "user_123" } ], "has_more": true, "next_page": "https://api.merge.com/ticketing/audit-trail?cursor=next_cursor" } ``` ``` -------------------------------- ### Create Lead Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Creates a Lead object with the given values. Supports asynchronous execution and debugging. ```APIDOC ## Create Lead ### Description Creates a Lead object with the given values. Supports asynchronous execution and debugging. ### Method `client.crm.leads.create(request: Merge.crm.LeadEndpointRequest, requestOptions?: LeadsClient.RequestOptions): Promise` ### Parameters #### Request Body Parameters - **isDebugMode** (boolean) - Optional - Enable debug mode for the request. - **runAsync** (boolean) - Optional - Run the request asynchronously. - **model** (object) - Required - The Lead object data. ### Request Example ```typescript await client.crm.leads.create({ isDebugMode: true, runAsync: true, model: {} }); ``` ### Response #### Success Response (200) - **id** (string) - The ID of the created Lead. - **remote_id** (string) - The remote ID of the created Lead. - **created_at** (string) - The creation timestamp. - **modified_at** (string) - The modification timestamp. - **model** (object) - The created Lead object data. - **operation_id** (string) - The ID of the asynchronous operation. - **status** (string) - The status of the operation. #### Response Example ```json { "id": "string", "remote_id": "string", "created_at": "string", "modified_at": "string", "model": {}, "operation_id": "string", "status": "string" } ``` ``` -------------------------------- ### Retrieve HRIS Timesheet Entry Metadata Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Gets metadata for TimesheetEntry POST requests. No parameters are required for this operation. ```typescript await client.hris.timesheetEntries.metaPostRetrieve(); ``` -------------------------------- ### Create an Accounting Account Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Creates an `Account` object. Use this when you need to add a new account to the system. The `isDebugMode` and `runAsync` options can be used for testing and asynchronous execution. ```typescript await client.accounting.accounts.create({ isDebugMode: true, runAsync: true, model: {} }); ``` -------------------------------- ### Retrieve CRM Issue by ID Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get a specific issue by its ID. Requires the issue ID as a string parameter. ```typescript await client.crm.issues.retrieve("id"); ``` -------------------------------- ### client.filestorage.webhookReceivers.list Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Returns a list of WebhookReceiver objects. ```APIDOC ## client.filestorage.webhookReceivers.list ### Description Returns a list of `WebhookReceiver` objects. ### Method Not specified (assumed to be a client SDK method) ### Endpoint Not specified (client SDK method) ### Parameters #### Query Parameters - **requestOptions** (WebhookReceiversClient.RequestOptions) - Optional - Options for the request. ### Request Example ```typescript await client.filestorage.webhookReceivers.list(); ``` ### Response #### Success Response (200) - **WebhookReceiver[]** - A list of webhook receiver objects. ``` -------------------------------- ### Create Folder Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Creates a new Folder object with the specified details. Supports asynchronous execution. ```APIDOC ## Create Folder ### Description Creates a new Folder object with the specified details. Supports asynchronous execution. ### Method `client.filestorage.folders.create(request: FileStorageFolderEndpointRequest, requestOptions?: FoldersClient.RequestOptions)` ### Parameters #### Request Body - **isDebugMode** (boolean) - Optional - Enables debug mode for the operation. - **runAsync** (boolean) - Optional - Runs the operation asynchronously. - **model** (object) - Required - The model object containing folder details. ### Request Example ```typescript await client.filestorage.folders.create({ isDebugMode: true, runAsync: true, model: {} }); ``` ### Response #### Success Response (200) - **Merge.FileStorageFolderResponse** - The created Folder object. #### Response Example ```typescript // Example response structure (actual fields depend on the 'model' provided) { "id": "folder_id", "name": "New Folder", "created_at": "2024-01-15T09:30:00.000Z" } ``` ``` -------------------------------- ### Get Contact Source: https://github.com/merge-api/merge-node-client/blob/main/README.md Retrieves a specific contact's details from the Accounting system using their unique contact ID. ```APIDOC ## Get Contact ### Description Retrieves a specific contact by their ID. ### Method `merge.accounting.contacts.retrieve(contactId)` ### Parameters #### Path Parameters - **contactId** (string) - Required - The ID of the contact to retrieve. ### Response #### Success Response (200) - **contact** (object) - The contact object containing details. ``` -------------------------------- ### Generate Key - Create Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Create a remote key. ```APIDOC ## Generate Key - Create ### Description Create a remote key. ### Method POST ### Endpoint `/hris/generate/key` ### Parameters #### Request Body - **request** (Merge.hris.GenerateRemoteKeyRequest) - Required - The details for generating the remote key. - **name** (string) - Required - The name of the remote key. - **requestOptions** (GenerateKeyClient.RequestOptions) - Optional - Options for the request. ### Request Example ```typescript await client.hris.generateKey.create({ name: "Remote Deployment Key 1" }); ``` ### Response #### Success Response (200) - **remote_key** (Merge.RemoteKey) - The created remote key. #### Response Example ```json { "remote_key": { "id": "a7a4f777-7241-4071-9b7b-08d910659222", "name": "Remote Deployment Key 1", "key": "key_abc123", "created_at": "2023-01-01T00:00:00Z", "last_used_at": null, "expires_at": null } } ``` ``` -------------------------------- ### Get Candidate Source: https://github.com/merge-api/merge-node-client/blob/main/README.md Retrieves a specific candidate's details from the ATS system using their unique candidate ID. ```APIDOC ## Get Candidate ### Description Retrieves a specific candidate by their ID. ### Method `merge.ats.candidates.retrieve(candidateId)` ### Parameters #### Path Parameters - **candidateId** (string) - Required - The ID of the candidate to retrieve. ### Response #### Success Response (200) - **candidate** (object) - The candidate object containing details. ``` -------------------------------- ### client.filestorage.folders.list Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Returns a list of Folder objects. ```APIDOC ## client.filestorage.folders.list ### Description Returns a list of `Folder` objects. ### Method ```typescript client.filestorage.folders.list({ ...params }) ``` ### Parameters This method accepts optional parameters for filtering and pagination. Please refer to the Merge API documentation for a full list of available parameters. ``` -------------------------------- ### Get Employee Source: https://github.com/merge-api/merge-node-client/blob/main/README.md Retrieves a specific employee's details from the HRIS system using their unique employee ID. ```APIDOC ## Get Employee ### Description Retrieves a specific employee by their ID. ### Method `merge.hris.employees.retrieve(employeeId)` ### Parameters #### Path Parameters - **employeeId** (string) - Required - The ID of the employee to retrieve. ### Response #### Success Response (200) - **employee** (object) - The employee object containing details. ``` -------------------------------- ### List Accounting Items with Pagination Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Demonstrates how to list accounting items using the client. Supports automatic iteration over all pages or manual page-by-page fetching. Access the underlying response object if needed. ```typescript const pageableResponse = await client.accounting.items.list({ companyId: "company_id", createdAfter: new Date("2024-01-15T09:30:00.000Z"), createdBefore: new Date("2024-01-15T09:30:00.000Z"), cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", includeDeletedData: true, includeRemoteData: true, includeShellData: true, modifiedAfter: new Date("2024-01-15T09:30:00.000Z"), modifiedBefore: new Date("2024-01-15T09:30:00.000Z"), name: "name", pageSize: 1, remoteFields: "status", remoteId: "remote_id", showEnumOrigins: "status" }); for await (const item of pageableResponse) { console.log(item); } // Or you can manually iterate page-by-page let page = await client.accounting.items.list({ companyId: "company_id", createdAfter: new Date("2024-01-15T09:30:00.000Z"), createdBefore: new Date("2024-01-15T09:30:00.000Z"), cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", includeDeletedData: true, includeRemoteData: true, includeShellData: true, modifiedAfter: new Date("2024-01-15T09:30:00.000Z"), modifiedBefore: new Date("2024-01-15T09:30:00.000Z"), name: "name", pageSize: 1, remoteFields: "status", remoteId: "remote_id", showEnumOrigins: "status" }); while (page.hasNextPage()) { page = page.getNextPage(); } // You can also access the underlying response const response = page.response; ``` -------------------------------- ### Linked Account Scopes Retrieve Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Get all available permissions for Merge Common Models and fields for a single Linked Account. ```APIDOC ## Linked Account Scopes Retrieve ### Description Get all available permissions for Merge Common Models and fields for a single Linked Account. [Learn more](https://help.merge.dev/en/articles/5950052-common-model-and-field-scopes). ### Method ```typescript client.hris.scopes.linkedAccountScopesRetrieve(requestOptions?: ScopesClient.RequestOptions) ``` ### Parameters #### Request Body - **requestOptions** (ScopesClient.RequestOptions) - Optional - Options for the client request. ### Request Example ```typescript await client.hris.scopes.linkedAccountScopesRetrieve(); ``` ### Response #### Success Response (200) - **Merge.CommonModelScopeApi** - An object containing the linked account scopes. ``` -------------------------------- ### List Journal Entry Lines with Pagination Source: https://github.com/merge-api/merge-node-client/blob/main/reference.md Demonstrates how to fetch journal entry lines using the client. Supports asynchronous iteration and manual page-by-page fetching. Access the underlying response object if needed. ```typescript const pageableResponse = await client.accounting.journalEntries.linesRemoteFieldClassesList({ cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", includeDeletedData: true, includeRemoteData: true, includeShellData: true, isCommonModelField: true, isCustom: true, pageSize: 1 }); for await (const item of pageableResponse) { console.log(item); } // Or you can manually iterate page-by-page let page = await client.accounting.journalEntries.linesRemoteFieldClassesList({ cursor: "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw", includeDeletedData: true, includeRemoteData: true, includeShellData: true, isCommonModelField: true, isCustom: true, pageSize: 1 }); while (page.hasNextPage()) { page = page.getNextPage(); } // You can also access the underlying response const response = page.response; ```