---
title: Enable pass-through API
slug: enable-pass-through-api
docTags: 
createdAt: 2020-04-06T10:50:07.000Z
---

Once you have setup your OAuth Connect button, you will need to make every API call through Pathfix so we can stamp every required token to the API before passing it on to the provider (i.e. pass-through).&#x20;

You will need to complete the End-user Authorization with the provider to be able to consume any provider endpoint. Once completed, you can setup the API call between the 2 apps using the `API Call` code.

Need documentation for End-user Authorization setup?  Check it here [End-user authorization](docId\:MsCMNgUGRsGrzSCMLCiXf)&#x20;

### &#xA;API Call Template

Each providers API call is different and would be explained in detail on their own developer documentation. Here is template of how an API call would be created to go through Pathfix.&#x20;

- Select the app you would like to make the API call for, click on `Setup` and select `API Call`&#x20;



::Image[]{src="https://api.archbee.com/api/optimize/E6H_--BmYJWG_yGaOUOxt/T-wPOA3bXwxP__W7i6rPp_image.png" size="76" width="1763" height="1303" caption="Image: API Code" position="center" showCaption="true"}



You can write either **client-side or server-side code** to send messages to your end user’s application. Copy the code and paste it to your desired code base.



:::CodeblockTabs
HTTP

```html
POST https://labs.pathfix.com/oauth/method/slackv2/call?user_id=MarketSaaS_end_user_id&public_key=2370A0BA-9FE4-4B20-916D-00D0F15A43E1&private_key=BA3176F4-DCFE-42FC-860F-1F9E817C0861                            
Content-Type: application/json
{
    "url":      "url_to_slackv2_API",
    "method":   "method_to_use_with_this_call",
    "payload":  {payload_as_requested_by_slackv2},
    "headers":  {header_if_requested_by_slackv2}
}
                                    
```

```csharp

var client = new RestClient("https://labs.pathfix.com/oauth/method/drift/call?userId=myapp_end_user_id&pinc_client_id=9A68BECF-90BD-4583-89B5-18FF6B68F7B0");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\"url\": \"url_to_drift_API",\"method\": \"method_to_use_with_this_call\",\"payload\": {payload_as_requested_by_drift},\"headers\": {headers_if_requested_by_drift}}",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

                            
```

```javascript

/*
    When using Javascript make sure to include a reference to the script file defined in the previous step
    client side invocations need some additional information to authenticate the request.
                            
*/
var settings = {
    "url": "https://labs.pathfix.com/oauth/method/drift/call?userId=myapp_end_user_id&public_key9A68BECF-90BD-4583-89B5-18FF6B68F7B0",
    "method": "POST",
    "timeout": 0,
    "headers": {
    "Content-Type": "application/json"
},
"data": JSON.stringify({
                "url":"url_to_drift_API",
                "method":"method_to_use_with_this_call",
                "payload":{
                    payload_as_requested_by_drift
                },
                "headers":{
                    headers_if_requested_by_drift
                }

            })
};

$.ajax(settings).done(function (response) {
    console.log(response);
});
                            
```

```none

POST /oauth/method/drift/call?userId=test4_end_user_id&pinc_client_id=9A68BECF-90BD-4383-89B5-18FF6B68F7B0 HTTP/1.1
Host: labs.pathfix.com
Content-Type: application/json{
    "url": "url_to_drift_API",
    "method": "method_to_use_with_this_call",
    "payload": {
    payload_as_requested_by_drift
    },
    "headers": {
    header_if_requested_by_drift
    }
}
                            
```

```python

import requests

url = "https://labs.pathfix.com/oauth/method/drift/call?userId=myapp_end_user_id&pinc_client_id=9A68BECF-90BD-4583-89B5-18FF6B68F7B0"

payload = "{\"url\": \"url_to_drift_API",\"method\": \"method_to_use_with_this_call\",\"payload\": {payload_as_requested_by_drift},\"headers\": {headers_if_requested_by_drift}}"
headers = {
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
                            
```

```typescript
```
:::

:::hint{type="success"}
**Replacements**

\- MarketSaaS\_end\_user\_id  – Change the MarketSaaS\_end\_user\_id with the user ID associated with your app. This is generally the email address or username or any unique ID associated with your user in your app.

 - url\_to\_provider\_API – This is different for each application and refers to the Endpoint to the Provider’s Web API. Please note: Each method call for the provider will have its own URL.

\- method\_to\_use\_with\_this\_call – Enter a supported HTTP method which is defined by the Provider. These usually are GET, POST, DELETE, PUT

\- payload\_as\_requested\_by\_provider – Most API integrations accept the information as application/json when pushing information. While using an API to pull information from them this section is usually empty. If there is no payload make sure you pass an empty \{}

When parameters are sent using the GET you can add them to the Endpoint URL as defined by the provider
:::



### Sample API Call setup

There are a few sample API calls available for each provider that you can access. Click on **Test Connection** and select a **Sample Method** from the dropdown.&#x20;

Here is a sample call setup for Slack:

::Image[]{src="https://api.archbee.com/api/optimize/E6H_--BmYJWG_yGaOUOxt/omWaZV-YiS8Hj4hY4N8Si_image.png" size="82" width="1528" height="480" caption="Image: Sample API call setup to Slack" position="center" showCaption="true"}





That’s it, you can make calls to any providers API using Pathfix's API passthrough for all of your connected users.&#x20;





Having trouble? Reach out to us at support\@pathfix.com and we would be happy to help you.






