Merge Docs

Authenticated Pass-through Request

Learn how to create a new authenticated request to the integration API using stored linked account credentials.

Overview

Using Merge's authenticated pass-through request, you can make requests directly to an integration's API.

Merge makes it easy to make API requests to any of Merge's supported integrations with the account tokens that you've stored on behalf of your users. These requests are sent directly to the integration's API and follow each integration's specific API formats instead of Merge's unified format. This approach is ideal for when you're looking to fetch data that Merge may not make requests for.

If you believe Merge already pulls this data in its standard queries, you can avoid an additional API request to the integration platform by querying for Remote Data instead.


API Endpoint

Send POST requests to the URL below with the required body parameters to create a pass-through request.

https://api.merge.dev/api/CATEGORY/v1/passthrough

Replace CATEGORY in the URL with hris, ats, or accounting depending on the relevant category you're making an API request to.


Body Parameters

Reference the integration's API documentation to accurately fill out the body parameters for the specific pass-through request you're looking to make.


methodString
Required
The method for the third-party request, such as GET or POST.

pathString
Required
The path for the third-party request, such as /levels.

dataHash
Optional
The data for the request body.

headersHash
Optional
The headers to use for the request (Merge will handle the accounts authorization headers).

Fetching with the Merge SDK

See below for an example of how to create an authenticated pass-through request with Merge's SDK:

Pass-through Request via SDK
1from __future__ import print_function
2import json
3import MergeATSClient
4from MergeATSClient.api import passthrough_api
5from MergeATSClient.model.data_passthrough import DataPassthrough
6
7configuration = MergeATSClient.Configuration()
8api_client = MergeATSClient.ApiClient(configuration)
9api_instance = passthrough_api.PassthroughApi(api_client)
10passthrough_object = DataPassthrough(method="POST", path="/unique-data", data={"id": 123, "value": "ABC"}, headers={"EXTRA-HEADER": "header_value"})
11
12try:
13    api_response = api_instance.passthrough_create(x_account_token, passthrough_object)
14    print(api_response)
15except MergeATSClient.ApiException as e:
16    print("Exception when calling passthrough_create: %s" % e)

Response

The response to your query will look like the following:

Sample Response to Passthrough Request
JSON
1{
2  "method": "GET",
3  "path": "/unique-data",
4  "status": 200,
5  "response": {
6    "id": 23454,
7    "value": "ABC"
8  },
9  "headers": {
10    ...
11    "Authorization": "<redacted>"
12  }
13}