---
title: "How to use the Passthrough API"
img: https://s3.us-east-2.amazonaws.com/unified-article-images/how_to_use_the_passthrough_api-icon.png
date: 2024-11-25T00:00:00.000Z
tag: Guides
description: "This guide shows you how to make requests using Unified.to's Passthrough API with practical examples."
url: "https://docs.unified.to/guides/how_to_use_the_passthrough_api"
---

# How to use the Passthrough API
------
_November 25, 2024_

This guide shows you how to make requests using Unified.to's Passthrough API with practical examples.


## Before you begin


You should have:

- At least one active connection for an integration
- The connection ID for the integration you want to access

## Making Passthrough requests


The following examples demonstrate calls to mock endpoints with the Passthrough API.


**NOTE:** There is only one reserved URL parameter, and that is `__domain`. Use it to override the default API URL for that integration.


### Using the REST API directly


```javascript
// GET request example
const response = await fetch('https://api.unified.to/passthrough/{connection_id}/v2/customers', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});

// POST request example
const response = await fetch('https://api.unified.to/passthrough/{connection_id}/v2/customers', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'John Doe',
    email: 'john@example.com'
  })
});
```


### Using the [Unified.to](https://unified.to/) SDK


```javascript
// GET request
const response = await unified.passthrough.listPassthroughs({
  connectionId: 'YOUR_CONNECTION_ID',
  path: '/v2/customers'
});

// POST request
const response = await unified.passthrough.createPassthrough({
  connectionId: 'YOUR_CONNECTION_ID',
  path: '/v2/customers',
  data: {
    name: 'John Doe',
    email: 'john@example.com'
  }
});

// With custom headers
const response = await unified.passthrough.listPassthroughs(
  {
    connectionId: 'YOUR_CONNECTION_ID',
    path: '/v2/customers'
  },
  {
    fetchOptions: {
      headers: {
        'x-api-version': '2023-06-01'
      }
    }
  }
);
```


## Real-world examples


### Example 1: Fetching HubSpot properties


This example demonstrates how to fetch custom properties for HubSpot contacts.


```javascript
const response = await unified.passthrough.listPassthroughs({
  connectionId: HUBSPOT_CONNECTION_ID,
  path: '/crm/v3/properties/{objectType}/batch/read'
});

// Response will contain raw HubSpot property definitions
console.log(response.data);
```


**API reference:** [Hubspot CRM Properties](https://developers.hubspot.com/beta-docs/reference/api/crm/properties#get-%2Fcrm%2Fv3%2Fproperties%2F%7Bobjecttype%7D)


### Example 2: Creating a Slack channel


This example demonstrates creating a channel in Slack.


```javascript
// Create a private Slack channel
const response = await unified.passthrough.createPassthrough({
  connectionId: SLACK_CONNECTION_ID,
  path: '/conversations.create',
  data: {
    name: 'project-discussion',
    is_private: true
  }
});

// Check the response
if (response.data.ok) {
  console.log('Channel created:', response.data.channel.id);
}
```


**API reference**: [conversations.create](https://api.slack.com/methods/conversations.create)


### Example 3: Creating a Salesforce record


This example demonstrates two ways of creating a new Account record in Salesforce using their sObject API.


```javascript
// Using the SDK
const response = await unified.passthrough.createPassthrough({
  connectionId: SALESFORCE_CONNECTION_ID,
// Note: path starts with 'services/data/v62.0' as required by Salesforce
  path: 'services/data/v62.0/sobjects/Account/',
  data: {
    "Name": "Express Logistics and Transport"
  }
});


const response = await fetch('https://api.unified.to/passthrough/{connection_id}/services/data/v62.0/sobjects/Account/', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_UNIFIED_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "Name": "Express Logistics and Transport"
  })
});

// The response will contain the new record ID if successful:
// {
//   "id": "001D000000IqhSLIAZ",
//   "errors": [],
//   "success": true
// }
```


**API reference:** [Create a Record](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm)


## See also

- [Passthrough API Overview](https://docs.unified.to/passthrough/overview)