<!-- llms.txt: https://workos.com/llms.txt -->

# Pipes

Pipes provides OAuth integrations with third-party providers that allow your users to securely connect their accounts to your application. Pipes handles the complete OAuth lifecycle including token refresh and credential storage.

Read more in the [Pipes guide](https://workos.com/docs/pipes).

## Upsert client credentials for a connected account

Creates or updates a client-credentials-based installation for the specified integration and user. If an installation already exists, the stored client credentials are rotated to the new values.

:::code-group

```bash language="curl" title="Request" tab="1"
curl --request PUT \
  --url "https://api.workos.com/data-integrations/salesforce/client-credentials" \
  --header "Authorization: Bearer sk_example_123456789" \
  --header "Content-Type: application/json" \
  -d @- <<'BODY'
    {
        "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
        "client_id": "3MVG9...",
        "client_secret": "shhh-secret"
    }
BODY
```

```rb language="ruby" title="Request" tab="1"
require "workos"

WorkOS.configure do |config|
  config.api_key = "sk_example_123456789"
end

WorkOS.client.pipes.update_data_integration_client_credentials(
  slug: "salesforce",
  user_id: "user_01EHZNVPK3SFK441A1RGBFSHRT",
  client_id: "3MVG9...",
  client_secret: "shhh-secret"
)
```

```py language="python" title="Request" tab="1"
from workos import WorkOSClient

client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789")

client.pipes.update_data_integration_client_credentials(
    slug="salesforce",
    user_id="user_01EHZNVPK3SFK441A1RGBFSHRT",
    client_id="3MVG9...",
    client_secret="shhh-secret",
)
```

```go language="go" title="Request" tab="1"
package main

import (
	"context"

	"github.com/workos/workos-go/v10"
)

func main() {
	client := workos.NewClient("sk_example_123456789")

	_, err := client.Pipes().UpdateDataIntegrationClientCredentials(context.Background(), "salesforce", &workos.PipesUpdateDataIntegrationClientCredentialsParams{
		UserID:       "user_01EHZNVPK3SFK441A1RGBFSHRT",
		ClientID:     "3MVG9...",
		ClientSecret: "shhh-secret",
	})
	if err != nil {
		panic(err)
	}
}
```

```php language="php" title="Request" tab="1"
<?php

use WorkOS\WorkOS;

$workos = new WorkOS(
    apiKey: "sk_example_123456789",
    clientId: "client_123456789",
);

$workos
    ->pipes()
    ->updateDataIntegrationClientCredentials(
        slug: "salesforce",
        userId: "user_01EHZNVPK3SFK441A1RGBFSHRT",
        clientId: "3MVG9...",
        clientSecret: "shhh-secret",
    );
```

```java language="java" title="Request" tab="1"
import com.workos.WorkOS;
import com.workos.pipes.PipesApi.UpdateDataIntegrationClientCredentialsOptions;

WorkOS workos = new WorkOS("sk_example_123456789");

UpdateDataIntegrationClientCredentialsOptions options =
    UpdateDataIntegrationClientCredentialsOptions.builder()
        .userId("user_01EHZNVPK3SFK441A1RGBFSHRT")
        .clientId("3MVG9...")
        .clientSecret("shhh-secret")
        .build();

workos.pipes.updateDataIntegrationClientCredentials("salesforce", options);
```

```cs language="dotnet" title="Request" tab="1"
using WorkOS;

var client = new WorkOSClient(new WorkOSOptions {
    ApiKey = "sk_example_123456789",
    ClientId = "client_123456789",
});

await client.Pipes.UpdateDataIntegrationClientCredentialsAsync("salesforce",
                                                               new PipesUpdateDataIntegrationClientCredentialsOptions {
                                                                   UserId = "user_01EHZNVPK3SFK441A1RGBFSHRT",
                                                                   ClientId = "3MVG9...",
                                                                   ClientSecret = "shhh-secret",
                                                               });
```

```rust language="rust" title="Request" tab="1"
use workos::Client;
use workos::pipes::UpdateDataIntegrationClientCredentialsParams;

#[tokio::main]
async fn main() -> Result<(), workos::Error> {
    let client = Client::builder()
        .api_key("sk_example_123456789")
        .client_id("client_123456789")
        .build();

    let _result = client
        .pipes()
        .update_data_integration_client_credentials(
            "salesforce",
            UpdateDataIntegrationClientCredentialsParams {
                user_id: "user_01EHZNVPK3SFK441A1RGBFSHRT".into(),
                client_id: "3MVG9...".into(),
                client_secret: "shhh-secret".into(),
                ..Default::default()
            }
        )
        .await?;

    Ok(())
}
```

```json language="json" title="Response" tab="2"
{
  "object": "connected_account",
  "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT",
  "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT",
  "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT",
  "scopes": [],
  "auth_method": "client_credentials",
  "state": "connected",
  "created_at": "2024-01-16T14:20:00.000Z",
  "updated_at": "2024-01-16T14:20:00.000Z"
}
```

:::

### PUT /data-integrations/{slug}/client-credentials

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | string | Yes | A [User](/reference/authkit/user) identifier. |
| `organization_id` | string | No | An [Organization](/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. |
| `client_id` | string | Yes | The OAuth client ID to store for this integration. |
| `client_secret` | string | Yes | The OAuth client secret to store for this integration. |
| `config` | object | No | Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors. |

#### Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `slug` | string | Yes | The identifier of the integration. |

#### Returns

| Field | Type | Description |
| --- | --- | --- |
| `connected_account` | object | Distinguishes the connected account object. |