We use OAuth for the majority of the API, for a few reasons:✅ OAuth clients are tied to the workspace and are administered by workspace admins
✅ Tokens are short-lived
✅ OAuth clients support scopes, limiting access to specific operations
✅ Limit access to specific Pipedream projects (coming soon)
Workspace administrators can create OAuth clients in your workspace’s API settings.Since API requests are meant to be made server-side, and since grants are not tied to individual end users, all OAuth clients are Client Credentials applications.
In the client credentials model, you exchange your OAuth client ID and secret for an access token. Then you use the access token to make API requests.If you’re running a server that executes JavaScript, we recommend using the Pipedream SDK, which automatically refreshes tokens for you.
Copy
Ask AI
import { PipedreamClient } from "@pipedream/sdk";// These secrets should be saved securely and passed to your environmentconst client = new PipedreamClient({ clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", projectId: "YOUR_PROJECT_ID", // This is typically required for most Connect API endpoints projectEnvironment: "development" // or "production"});// Use the SDK's helper methods to make requestsconst accounts = await client.accounts.list({ include_credentials: 1 });// Or make any Pipedream API request with the fresh tokenconst accounts = await client.makeAuthorizedRequest("/accounts", { method: "GET", params: { include_credentials: 1, }});
You can also manage this token refresh process yourself, using the /oauth/token API endpoint:
User API keys are only supported for a limited number of endpoints. You should use OAuth instead.
When you sign up for Pipedream, an API key is automatically generated for your user account. You can use this key to authorize requests to the API.You’ll find this API key in your User Settings (My Account -> API Key).This key is tied to your user account and provides full access to any resources your user has access to, across workspaces.
You can revoke your API key in your Account Settings (Settings -> Account). Click on the REVOKE button directly to the right of your API key.This will revoke your original API key, generating a new one. Any API requests made with the original token will yield a 401 Unauthorized error.
Whether you use OAuth access tokens or user API keys, Pipedream uses Bearer Authentication to authorize your access to the API or SSE event streams. When you make API requests, pass an Authorization header of the following format:
Copy
Ask AI
# OAuth access tokenAuthorization: Bearer <access token># User API keyAuthorization: Bearer <api key>
For example, here’s how you can use cURL to fetch profile information for the authenticated user: