This topic was automatically generated from Slack. You can find the original thread here.
My use case:
After connecting through the integration—for example, Google Drive—we receive an account ID. However, when the user disconnects from our platform, the account ID still remains on Pipedream. Is there an API or method to programmatically delete or disconnect that account from Pipedream, so that multiple account connections don’t persist?
Yes, you can programmatically delete or disconnect a connected account from Pipedream using their API. ### How to Programmatically Delete a Connected Account Pipedream provides an API endpoint to delete specific connected accounts. Here’s how you can do it: bash curl -X DELETE "https://api.pipedream.com/v1/connect/{project_id}/accounts/{account_id}" \ -H "Authorization: Bearer {access_token}" - Replace {project_id} with your Pipedream Connect project ID. - Replace {account_id} with the ID of the connected account you want to remove. - Replace {access_token} with your Pipedream API access token. This will remove the connected account from Pipedream, ensuring that old or unused connections do not persist after a user disconnects from your platform. For more details and code examples in TypeScript or Node.js, refer to the Pipedream Connect API reference. — You can also manage connected accounts via the Pipedream UI under the Connect > Users tab, but the API is best for automated or programmatic removal. Let me know if you need a Node.js code example or further details!
**** @U05FUC30Q01
How can I retrieve the access token and check for the projectId you’re referring to here?
Do we receive the projectId along with the account_id when connecting to the integration?
To answer your questions step-by-step: — ### 1. How can I retrieve the access token? To interact with the Pipedream Connect API (for example, to delete a connected account), you need an access token. This is not the same as the OAuth access token for Google or another integration—it’s a token for authenticating with the Pipedream API itself. You can retrieve this token using your Pipedream client ID and client secret. Here’s how: #### Option A: Using the API directly bash curl https://api.pipedream.com/v1/oauth/token \ -H 'Content-Type: application/json' \ -d '{ "grant_type": "client_credentials", "client_id": "<client_id>", "client_secret": "<client_secret>" }' This will return a JSON response with an access_token you can use in API requests. Access tokens expire after 1 hour, so you’ll need to refresh them as needed. #### Option B: Using the Pipedream SDK If you’re using Node.js, you can use the Pipedream SDK: import { createBackendClient } from "@pipedream/sdk/server"; const pd = createBackendClient({ credentials: { clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET", }, projectId: "YOUR_PROJECT_ID", }); // Now you can use pd to make authorized requests — ### 2. How do I find the projectId? The projectId is a unique identifier for your Pipedream Connect project. You do not receive it automatically with the account_id when a user connects an integration. To find your projectId: - Visit your Pipedream Projects page. - Click on your project. - The URL will look like: https://pipedream.com/projects/p_abc123xyz - The part after /projects/ (e.g., p_abc123xyz) is your projectId. You’ll need this value for API calls like deleting a connected account. — ### 3. Do we receive the projectId with the account_id when connecting? No, you do not receive the projectId along with the account_id when a user connects their account. You must keep track of your projectId separately (see above). — ### Summary - Access token: Retrieve using your Pipedream client ID and secret. - projectId: Find it in your Pipedream project URL. - account_id: You get this when a user connects an integration. - You need all three (access token, projectId, account_id) to make authenticated API requests to manage connected accounts. If you need more help or run into issues, please visit Support - Pipedream.
Currently, there is no public Pipedream API endpoint or SDK method to programmatically retrieve your projectId. The official documentation states: > 1. Open an existing Pipedream project or create a new one at pipedream.com/projects > 2. Click the Settings tab, then copy your Project ID This means the only supported way to get your projectId is to manually copy it from the Pipedream UI. Workaround: If you want to avoid checking the UI every time, you can: - Copy your projectId once and store it securely in an environment variable, config file, or Pipedream Data Store for use in your code. - Reference this stored value in your scripts or API calls. Summary: - There is no API to fetch your projectId programmatically. - You must copy it from the UI once, then store and reuse it as needed. If you need this feature, consider submitting a request or feedback to Pipedream. If you have further questions or need help, please visit Support - Pipedream.
No, the projectId is not unique per user—it is unique per Pipedream project. - The projectId identifies your Pipedream Connect project. It is the same for all users who connect to your integration within that project. - When different users connect their accounts to your integration, they are all associated with the same projectId, but each user will have their own unique external_user_id (your user’s ID in your system) and their own connected account(s). - So, all users connecting to your integration within the same Pipedream project will use the same projectId. If you create multiple Pipedream projects, each will have its own unique projectId. Summary: - The projectId is the same for all users of a given Pipedream project. - It is not unique per user, but per project. If you have more questions or need help, please visit Support - Pipedream.
To get the access_token used in the Pipedream Connect API (for example, to delete a connected account), you need to use your Pipedream Connect OAuth client credentials (client ID and client secret) to request an access token. This is not the same as a user access token—it’s a token you generate for your Connect project. Here’s how you can get the access_token: ### 1. Using the /oauth/token API endpoint You can request an access token by making a POST request to the Pipedream API: bash curl https://api.pipedream.com/v1/oauth/token \ -H 'Content-Type: application/json' \ -d '{ "grant_type": "client_credentials", "client_id": "<YOUR_CLIENT_ID>", "client_secret": "<YOUR_CLIENT_SECRET>" }' - Replace <YOUR_CLIENT_ID> and <YOUR_CLIENT_SECRET> with your Connect project’s credentials. - The response will include an access_token you can use in the Authorization header. ### 2. Using the Pipedream SDK (Node.js example) If you’re running JavaScript/TypeScript, you can use the Pipedream SDK, which handles token refresh for you: ```
import { createBackendClient } from “@pipedream/sdk/server”; const pd = createBackendClient({ credentials: { clientId: “YOUR_CLIENT_ID”, clientSecret: “YOUR_CLIENT_SECRET”, }, projectId: “YOUR_PROJECT_ID”, }); // Example: get all accounts const accounts = await pd.getAccounts({ include_credentials: 1 }); // Or make any authorized request const response = await pd.makeAuthorizedRequest(“/accounts”, { method: “GET”, params: { include_credentials: 1 }, });