A connected account represents a user’s authorized connection to a third-party provider through Pipes. Connected accounts store the OAuth credentials and scopes granted during the authorization flow.
When listing providers for a user, each provider includes a nested connected_account showing the user’s connection status.
Generates an OAuth authorization URL to initiate the connection flow for a user. Redirect the user to the returned URL to begin the OAuth flow with the third-party provider.
curl --request POST \ --url "https://api.workos.com/data-integrations/github/authorize" \ --header "Authorization: Bearer sk_example_123456789" \ --header "Content-Type: application/json" \ -d @- <<'BODY' { "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT" } BODY
{ "url": "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" }
| curl --request POST \ | |
| --url "https://api.workos.com/data-integrations/github/authorize" \ | |
| --header "Authorization: Bearer sk_example_123456789" \ | |
| --header "Content-Type: application/json" \ | |
| -d @- <<'BODY' | |
| { | |
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT" | |
| } | |
| BODY |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.pipes.authorize_data_integration( | |
| slug: "github", | |
| user_id: "user_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.pipes.authorize_data_integration( | |
| slug="github", user_id="user_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.Pipes().AuthorizeDataIntegration(context.Background(), "github", &workos.PipesAuthorizeDataIntegrationParams{ | |
| UserID: "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->pipes() | |
| ->authorizeDataIntegration( | |
| slug: "github", | |
| userId: "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| ); |
| import com.workos.WorkOS; | |
| import com.workos.pipes.PipesApi.AuthorizeDataIntegrationOptions; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| AuthorizeDataIntegrationOptions options = AuthorizeDataIntegrationOptions.builder() | |
| .userId("user_01EHZNVPK3SFK441A1RGBFSHRT") | |
| .build(); | |
| workos.pipes.authorizeDataIntegration("github", options); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.Pipes.AuthorizeDataIntegrationAsync("github", new PipesAuthorizeDataIntegrationOptions { | |
| UserId = "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| }); |
| use workos::Client; | |
| use workos::pipes::AuthorizeDataIntegrationParams; | |
| #[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() | |
| .authorize_data_integration( | |
| "github", | |
| AuthorizeDataIntegrationParams { | |
| user_id: "user_01EHZNVPK3SFK441A1RGBFSHRT".into(), | |
| ..Default::default() | |
| } | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "url": "https://api.workos.com/data-integrations/q2czJKmVAraSBg8xFpT7M9uR/authorize-redirect" | |
| } |
POST/data-integrations /:slug /authorizeParameters Returns Retrieves a user’s connected account for a specific provider.
curl "https://api.workos.com/user_management/users/user_01EHZNVPK3SFK441A1RGBFSHRT/connected_accounts/github" \ --header "Authorization: Bearer sk_example_123456789"
{ "object": "connected_account", "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", "organization_id": null, "scopes": [ "repo", "user:email" ], "auth_method": "oauth", "api_key_last_4": null, "state": "connected", "created_at": "2024-01-16T14:20:00.000Z", "updated_at": "2024-01-16T14:20:00.000Z" }
| curl "https://api.workos.com/user_management/users/user_01EHZNVPK3SFK441A1RGBFSHRT/connected_accounts/github" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.pipes.get_user_connected_account( | |
| user_id: "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| slug: "github" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.pipes.get_user_connected_account( | |
| user_id="user_01EHZNVPK3SFK441A1RGBFSHRT", slug="github" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.Pipes().GetUserConnectedAccount(context.Background(), "user_01EHZNVPK3SFK441A1RGBFSHRT", "github") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->pipes() | |
| ->getUserConnectedAccount( | |
| userId: "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| slug: "github", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.pipes.getUserConnectedAccount("user_01EHZNVPK3SFK441A1RGBFSHRT", "github"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.Pipes.GetUserConnectedAccountAsync("user_01EHZNVPK3SFK441A1RGBFSHRT", "github"); |
| use workos::Client; | |
| #[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() | |
| .get_user_connected_account( | |
| "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "github" | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "connected_account", | |
| "id": "data_installation_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "organization_id": null, | |
| "scopes": [ | |
| "repo", | |
| "user:email" | |
| ], | |
| "auth_method": "oauth", | |
| "api_key_last_4": null, | |
| "state": "connected", | |
| "created_at": "2024-01-16T14:20:00.000Z", | |
| "updated_at": "2024-01-16T14:20:00.000Z" | |
| } |
GET/user_management /users /:user_id /connected_accounts /:slugParameters Returns Disconnects WorkOS’s account for the user, including removing any stored access and refresh tokens. The user will need to reauthorize if they want to reconnect.
This does not revoke access on the provider side. The user may need to disconnect the application directly from the provider’s settings.
Returns a 204 No Content response on success.
curl --request DELETE \ --url "https://api.workos.com/user_management/users/user_01EHZNVPK3SFK441A1RGBFSHRT/connected_accounts/github" \ --header "Authorization: Bearer sk_example_123456789"
| curl --request DELETE \ | |
| --url "https://api.workos.com/user_management/users/user_01EHZNVPK3SFK441A1RGBFSHRT/connected_accounts/github" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.pipes.delete_user_connected_account( | |
| user_id: "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| slug: "github" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.pipes.delete_user_connected_account( | |
| user_id="user_01EHZNVPK3SFK441A1RGBFSHRT", slug="github" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v9" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.Pipes().DeleteUserConnectedAccount(context.Background(), "user_01EHZNVPK3SFK441A1RGBFSHRT", "github") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->pipes() | |
| ->deleteUserConnectedAccount( | |
| userId: "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| slug: "github", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.pipes.deleteUserConnectedAccount("user_01EHZNVPK3SFK441A1RGBFSHRT", "github"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.Pipes.DeleteUserConnectedAccountAsync("user_01EHZNVPK3SFK441A1RGBFSHRT", "github"); |
| use workos::Client; | |
| #[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() | |
| .delete_user_connected_account( | |
| "user_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "github" | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
DELETE/user_management /users /:user_id /connected_accounts /:slugParameters Returns