Skip to content

Commit 49a299f

Browse files
Danny/connect proxy macro docs (#15602)
* Adding refs to proxy macros * Update pnpm-lock.yaml * Update pnpm-lock.yaml * Update api-proxy.mdx * Update api-proxy.mdx * Update api-proxy.mdx * Update api-proxy.mdx
1 parent 55f5c24 commit 49a299f

File tree

3 files changed

+60
-10
lines changed

3 files changed

+60
-10
lines changed

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

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,45 @@ 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-
### Using the Pipedream SDK (preferred)
36+
### Authenticating on behalf of your user
37+
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.
39+
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 downstream API. For example:
41+
42+
```javascript
43+
/*
44+
OpenAI requires that you pass the API key
45+
in the `Authorization` header with the `Bearer` prefix:
46+
*/
47+
48+
headers: {
49+
authorization: "Bearer {{api_key}}",
50+
}
51+
52+
// Pipedream will replace the `{{api_key}}` macro with the actual API key
53+
```
54+
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+
*/
60+
61+
headers: {
62+
authorization: "Zoho-oauthtoken {{oauth_access_token}}",
63+
}
64+
65+
// Pipedream will replace the `{{oauth_access_token}}` macro with the actual token
66+
```
67+
68+
<Callout type="info">
69+
Refer to the relevant API's developer documentation for the correct way to authenticate requests.
70+
</Callout>
71+
72+
### Making a request
73+
74+
#### Using the Pipedream SDK
3775

3876
You can use the [Pipedream SDK](https://www.npmjs.com/package/@pipedream/sdk) to send a fetch-style request:
3977

@@ -61,8 +99,8 @@ const resp = await pd.makeProxyRequest(
6199
url: "https://slack.com/api/chat.postMessage", // Include any query params you need; no need to Base64 encode the URL if using the SDK
62100
options: {
63101
method: "POST",
64-
headers: {
65-
hello: "world!" // These get sent to the downstream API
102+
headers: {
103+
hello: "world!" // Include any headers you need to send to the downstream API
66104
},
67105
body: {
68106
text: "hello, world",
@@ -76,7 +114,7 @@ const resp = await pd.makeProxyRequest(
76114
console.log(resp);
77115
```
78116

79-
### Using the REST API
117+
#### Using the REST API
80118

81119
You can also send a request to the Connect REST API with the below config:
82120

@@ -97,9 +135,15 @@ You can also send a request to the Connect REST API with the below config:
97135

98136
- If using the REST API, include the `Authorization` header with your Pipedream OAuth access token (`Bearer {access_token}`)
99137
- Headers that contain the prefix `x-pd-proxy` will get forwarded to the downstream API
138+
- If the downstream 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+
```
100143

101144
```bash
102-
# First, obtain an OAuth access token
145+
# First, obtain an OAuth access token to authenticate to the Pipedream API
146+
103147
curl -X POST https://api.pipedream.com/v1/oauth/token \
104148
-H "Content-Type: application/json" \
105149
-d '{
@@ -119,4 +163,8 @@ curl -X POST "https://api.pipedream.com/v1/connect/{your_project_id}/proxy/{url_
119163
}'
120164

121165
# Parse and return the data you need
122-
```
166+
```
167+
168+
## Rate limits
169+
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.

docs-v2/pages/connect/api.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ External User IDs are limited to 250 characters.
147147
| API Endpoint | Rate Limit |
148148
|----------------------------|------------------------------------------------------|
149149
| `POST /tokens` | 100 requests per minute per `external_user_id` |
150-
| `GET */accounts/*`| The sum of requests across all `*/accounts/*` endpoints must not exceed 100 requests per minute. This includes requests to `/accounts`, `/apps/:app_id/accounts`, `/accounts/:account_id`, and more — any request for account metadata and credentials is counted towards this total. |
150+
| `GET /accounts`| 100 requests per minute per project <br /><br />The sum of requests across all `*/accounts/*` endpoints must not exceed 100 requests per minute. This includes requests to,<br />• `/accounts`<br />• `/apps/:app_id/accounts`<br />• `/accounts/:account_id` |
151+
| `/proxy` | 100 requests per minute per project |
151152

152153
If you need higher rate limits, please [reach out](https://pipedream.com/support).
153154

docs-v2/pages/connect/managed-auth/oauth-clients.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ For any OAuth app that supports it, **you can always use your own client.** Your
2121
<div className="highlightHeaderRowTable">
2222
| Operation | Details | Environment |
2323
|--------|---------|------------------------------|
24-
| [Retrieve credentials via API](/connect/api#accounts) | Fetch the credentials for your end user from Pipedream's API to use in your application. |`development`<br />❌ `production` |
25-
| [Invoke workflows](/connect/workflows) | Trigger any Pipedream workflow and use the connected account of your end user |`development`<br />❌ `production` |
26-
| [Run components via API](/connect/components) | Run any action and deploy any trigger directly from your application |`development`<br />✅ `production` |
24+
| Retrieve user credentrials | [Fetch the credentials](/connect/api#accounts) for your end user from Pipedream's API to use in your app |`development`<br />❌ `production` |
25+
| Invoke workflows | [Trigger any Pipedream workflow](/connect/workflows) and use the connected account of your end users |`development`<br />❌ `production` |
26+
| Embed prebuilt tools | [Run any action and deploy any trigger](/connect/components) directly from your AI agent or app |`development`<br />✅ `production` |
27+
| Proxy API requests | [Write custom code to interface with any integrated API](/connect/api-proxy) while avoiding dealing with user auth |`development`<br />✅ `production` |
2728
</div>
2829

2930
## Using a custom OAuth client

0 commit comments

Comments
 (0)