Skip to content

Commit 865adb7

Browse files
Update api-proxy.mdx (#16168)
1 parent 701cef6 commit 865adb7

File tree

1 file changed

+27
-54
lines changed

1 file changed

+27
-54
lines changed

docs-v2/pages/connect/api-proxy.mdx

Lines changed: 27 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,36 @@ You can send requests to the Connect proxy using the [Pipedream SDK](/connect/sd
3333

3434
Refer to the full Connect API [here](/connect/api/).
3535

36-
### Authenticating on behalf of your user
36+
### Authenticating on behalf of your users
3737

38-
Most API integrations that use OAuth to authenticate requests require that you pass a user's access token in the `Authorization` header with the `Bearer` prefix. For these apps, the Connect proxy will automatically handle that for you — you don't need to pass any reference to their OAuth access token in this case.
38+
One of the core benefits of using the Connect API Proxy is not having to deal with storing or retrieving sensitive credentials for your end users.
3939

40-
For apps that require a different authentication method, you should include the necessary headers with the value surrounded by `{{ }}` in your request to the proxy, and Pipedream will automatically replace the macro with the real values and forward to the upstream API. For example:
40+
Since Pipedream has {process.env.PUBLIC_APPS}+ integrated apps, we know how the upstream APIs are expecting to receive access tokens or API keys. When you send a request to the proxy, Pipedream will look up the corresponding connected account for the relevant user, and **automatically insert the authorization credentials in the appropriate header or URL param**.
4141

42-
```javascript
43-
/*
44-
OpenAI requires that you pass the API key
45-
in the `Authorization` header with the `Bearer` prefix:
46-
*/
42+
### Sending requests
4743

48-
headers: {
49-
authorization: "Bearer {{api_key}}",
50-
}
44+
**URL**
5145

52-
// Pipedream will replace the `{{api_key}}` macro with the actual API key
53-
```
46+
- The URL of the API you want to call (ex, `https://slack.com/api/chat.postMessage`)
47+
- When using the REST API, this should be an URL-safe Base64 encoded string (ex, `aHR0cHM6Ly9zbGFjay5jb20vYXBpL2NoYXQucG9zdE1lc3NhZ2U`)
5448

55-
```javascript
56-
/*
57-
Zoho apps require that you pass the OAuth access token
58-
in the `Authorization` header with a custom `Zoho-oauthtoken` prefix:
59-
*/
49+
<Callout type="info">
50+
- Some APIs like Zendesk, Zoho, and others use dynamic base domains that are account-specific (e.g, `https://foo.zendesk.com`). For any of these apps, you should pass a relative path as the `url` in your proxy request, like `/api/v2/chat/chats` for example.
51+
- Those dynamic fields are typically defined by the end user during the account connection flow, so the domain value will be stored as part of their connected account credentials in Pipedream.
52+
</Callout>
6053

61-
headers: {
62-
authorization: "Zoho-oauthtoken {{oauth_access_token}}",
63-
}
54+
**HTTP method**
6455

65-
// Pipedream will replace the `{{oauth_access_token}}` macro with the actual token
66-
```
56+
- Use the HTTP method required by the upstream API
6757

68-
<Callout type="info">
69-
Refer to the relevant API's developer documentation for the correct way to authenticate requests.
70-
</Callout>
58+
**Body**
59+
60+
- Optionally include a body to send to the upstream API
7161

72-
### Making a request
62+
**Headers**
63+
64+
- If using the REST API, include the `Authorization` header with your Pipedream OAuth access token (`Bearer {access_token}`)
65+
- Headers that contain the prefix `x-pd-proxy` will get forwarded to the upstream API
7366

7467
#### Using the Pipedream SDK
7568

@@ -80,7 +73,7 @@ import { createBackendClient } from "@pipedream/sdk/server";
8073

8174
const pd = createBackendClient({
8275
environment: {development | production},
83-
projectId: {your_projectId},
76+
projectId: {your_pipedream_project_i_d},
8477
credentials: {
8578
clientId: {your_oauth_client_id},
8679
clientSecret: {your_oauth_client_secret}
@@ -116,30 +109,7 @@ console.log(resp);
116109

117110
#### Using the REST API
118111

119-
You can also send a request to the Connect REST API with the below config:
120-
121-
**URL**
122-
123-
- The URL of the API you want to call (ex, `https://slack.com/api/chat.postMessage`)
124-
- When using the REST API, this should be an URL-safe Base64 encoded string (ex, `aHR0cHM6Ly9zbGFjay5jb20vYXBpL2NoYXQucG9zdE1lc3NhZ2U`)
125-
126-
**HTTP method**
127-
128-
- Use the HTTP method required by the upstream API
129-
130-
**Body**
131-
132-
- Optionally include a body to send to the upstream API
133-
134-
**Headers**
135-
136-
- If using the REST API, include the `Authorization` header with your Pipedream OAuth access token (`Bearer {access_token}`)
137-
- Headers that contain the prefix `x-pd-proxy` will get forwarded to the upstream API
138-
- If the upstream API requires [custom authorization headers](#authenticating-on-behalf-of-your-user), make sure to prepend with `x-pd-proxy` and include the macro `{{ }}` that Pipedream will replace with the actual value. For example,
139-
140-
```javascript
141-
"x-pd-proxy-apiKey: {{api_key}}"
142-
```
112+
You can also use the Connect REST API directly. If using the REST API, send your Pipedream OAuth access token in the `Authorization` header:
143113

144114
```bash
145115
# First, obtain an OAuth access token to authenticate to the Pipedream API
@@ -165,6 +135,9 @@ curl -X POST "https://api.pipedream.com/v1/connect/{your_project_id}/proxy/{url_
165135
# Parse and return the data you need
166136
```
167137

168-
## Rate limits
138+
## Limits
169139

170-
The Connect proxy limits API requests to **100 per minute per project**. [Let us know](https://pipedream.com/support) if you need higher limits.
140+
The Connect proxy limits API requests to,
141+
- 100 requests per minute per project. Requests that surpass this limit will receive a `429` response.
142+
- A maximum timeout of 30 seconds. Requests that take longer than 30 seconds will be terminated, and Pipedream will return a `504` error to the caller.
143+
- [Let us know](https://pipedream.com/support) if you need higher limits.

0 commit comments

Comments
 (0)