WorkOS PHP SDK

Pipes
in package

Table of Contents

Properties

$client  : HttpClient

Methods

__construct()  : mixed
authorizeDataIntegration()  : DataIntegrationAuthorizeUrlResponse
Get authorization URL
createDataIntegration()  : DataIntegration
Create a data integration
createDataIntegrationCredential()  : DataIntegrationCredentialsResponse
Vend credentials for a connected account
createOrganizationConnectedAccount()  : ConnectedAccount
Import an organization connected account
createUserConnectedAccount()  : ConnectedAccount
Import a connected account
deleteDataIntegration()  : void
Delete a data integration
deleteDataIntegrationOrganization()  : void
Delete an organization-owned data integration
deleteOrganizationConnectedAccount()  : void
Delete an organization connected account
deleteUserConnectedAccount()  : void
Delete a connected account
getAccessToken()  : DataIntegrationAccessTokenResponse
Get an access token for a connected account
getDataIntegration()  : DataIntegration
Get a data integration
getOrganizationConnectedAccount()  : ConnectedAccount
Get an organization connected account
getUserConnectedAccount()  : ConnectedAccount
Get a connected account
listDataIntegrationOrganization()  : DataIntegration
Get an organization-owned data integration
listDataIntegrations()  : PaginatedResponse<string|int, DataIntegration>
List data integrations
listOrganizationDataProviders()  : DataIntegrationsListResponse
List providers for an organization
listUserDataProviders()  : DataIntegrationsListResponse
List providers for a user
updateDataIntegration()  : DataIntegration
Update a data integration
updateDataIntegrationApiKey()  : ConnectedAccount
Upsert an API key for a connected account
updateDataIntegrationClientCredentials()  : ConnectedAccount
Upsert client credentials for a connected account
updateDataIntegrationOrganization()  : DataIntegration
Update an organization-owned data integration
updateOrganizationConnectedAccount()  : ConnectedAccount
Update an organization connected account
updateUserConnectedAccount()  : ConnectedAccount
Update a connected account

Properties

Methods

authorizeDataIntegration()

Get authorization URL

public authorizeDataIntegration(string $slug, string $userId[, string|null $organizationId = null ][, PipesOwnership|null $connectionOwner = null ][, string|null $returnTo = null ][, array<string, string>|null $config = null ][, RequestOptions|null $options = null ]) : DataIntegrationAuthorizeUrlResponse

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.

Parameters
$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$userId : string

The ID of the user to authorize. When connection_owner is organization, this is the user authorizing on behalf of the organization; they must be an active member of the organization and do not become the owner of the resulting connected account.

$organizationId : string|null = null

An organization ID to scope the authorization to a specific organization. Required when connection_owner is organization.

$connectionOwner : PipesOwnership|null = null

Who will own the connected account. user (the default) connects the user's own account. organization connects the organization's shared account and requires organization_id.

$returnTo : string|null = null

The URL to redirect the user to after authorization.

$config : array<string, string>|null = null

Connect-time config values for the provider-declared installation-scope fields (e.g. a Zendesk subdomain), keyed by the config field. Only fields the provider declares may be supplied, and required fields must be provided unless already pinned on the integration.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegrationAuthorizeUrlResponse

createDataIntegration()

Create a data integration

public createDataIntegration(string $provider[, PipesOwnership|null $ownership = null ][, string|null $description = null ][, bool|null $enabled = null ][, array<string|int, string>|null $scopes = null ][, array<string|int, DataIntegrationAuthMethods>|null $authMethods = null ][, array<string, string>|null $config = null ][, DataIntegrationCredentialsInput|null $credentials = null ][, ApiKeyInstallation|null $apiKey = null ][, CustomProviderDefinition|null $customProvider = null ][, RequestOptions|null $options = null ]) : DataIntegration

Creates a data integration for a provider. Set credentials.type to custom to use your own OAuth app credentials or organization to have each organization supply its own. Set auth_methods to ["api_key"] to create an API key integration; you may optionally supply an api_key block to install a first tenant in the same call. Set auth_methods to ["client_credentials"] to create a client-credentials integration; client credentials are installed per-tenant afterwards. Set ownership to organization to create the integration organizations connect to instead of the default user-owned one; a provider may have one of each. For a built-in provider, pass its slug as provider. For a custom provider, pass a new slug plus a custom_provider definition, or the slug of an existing custom provider (without custom_provider) to add the other ownership.

Parameters
$provider : string

The provider to create a Data Integration for. For a built-in provider use its slug (e.g. github, slack). For a custom provider, this is the new provider slug and custom_provider must be supplied. A custom provider slug cannot shadow an existing global provider slug.

$ownership : PipesOwnership|null = null

Who owns the Data Integration. user (the default) creates the integration users connect their own accounts to; organization creates the root organizations connect to. Ownership is fixed at creation, and one integration of each ownership may exist per provider. Independent of credentials.type.

$description : string|null = null

An optional description of the Data Integration.

$enabled : bool|null = null

Whether the Data Integration is enabled. Defaults to false.

$scopes : array<string|int, string>|null = null

The OAuth scopes to request for the Data Integration. Defaults to the provider's configured scopes when omitted.

$authMethods : array<string|int, DataIntegrationAuthMethods>|null = null

How accounts authenticate with the provider. Defaults to ["oauth"]. Use ["api_key"] to declare an API key integration; credentials is then not required and keys are supplied per-tenant (optionally via api_key on this request). Use ["client_credentials"] to declare a client-credentials integration; credentials is likewise not required and client credentials are supplied per-tenant.

$config : array<string, string>|null = null

Provider-specific config values (e.g. a Snowflake account), keyed by the config field. Only fields the built-in provider declares are accepted.

$credentials : DataIntegrationCredentialsInput|null = null

The OAuth credentials to configure for the Data Integration. Required for OAuth integrations; omit when auth_methods is ["api_key"].

$apiKey : ApiKeyInstallation|null = null

An optional API key to install for the first tenant on an api_key integration. Omit to declare a keyless integration; tenants can be added later via the per-installation API key path.

$customProvider : CustomProviderDefinition|null = null

The OAuth definition for a custom provider. Supply this to define a custom provider; omit it to create an integration for a built-in provider.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegration

createDataIntegrationCredential()

Vend credentials for a connected account

public createDataIntegrationCredential(string $slug, string $userId[, string|null $organizationId = null ][, string|null $connectedAccountId = null ][, PipesOwnership|null $connectionOwner = null ][, bool|null $supportsMultipleConnections = null ][, RequestOptions|null $options = null ]) : DataIntegrationCredentialsResponse

Returns credentials for a user's connected account. Branches on the installation's auth_method: OAuth installations return an access token (refreshed if needed); API-key installations return the stored secret.

Parameters
$slug : string

The identifier of the integration.

$userId : string

A User identifier. When connection_owner is organization, this is the user the credentials are vended on behalf of; they must be an active member of the organization.

$organizationId : string|null = null

An Organization identifier. Optional parameter to scope the connection to a specific organization. Required when connection_owner is organization.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select a specific connection when the user has several for this provider.

$connectionOwner : PipesOwnership|null = null

Which connection to vend from. user (the default) vends the user's own connection and requires user_id. organization vends the organization's shared connection and requires organization_id.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. If no connected_account_id is supplied and several connections match, the request returns account_selection_required. When omitted or false, only the compatibility connection is considered.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegrationCredentialsResponse

createOrganizationConnectedAccount()

Import an organization connected account

public createOrganizationConnectedAccount(string $organizationId, string $slug[, string|null $accessToken = null ][, string|null $refreshToken = null ][, DateTimeImmutable|null $expiresAt = null ][, array<string|int, string>|null $scopes = null ][, PipeConnectedAccountState|null $state = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Imports an organization-owned connected account by providing OAuth tokens directly. Use this to migrate existing connections or set up connections without going through the OAuth flow.

Parameters
$organizationId : string

An Organization identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$accessToken : string|null = null

The OAuth access token for the connected account.

$refreshToken : string|null = null

The OAuth refresh token for the connected account.

$expiresAt : DateTimeImmutable|null = null

The ISO-8601 timestamp when the access token expires. Required when access_token is provided for tokens that expire.

$scopes : array<string|int, string>|null = null

The OAuth scopes granted for this connection.

$state : PipeConnectedAccountState|null = null

Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount

createUserConnectedAccount()

Import a connected account

public createUserConnectedAccount(string $userId, string $slug[, string|null $accessToken = null ][, string|null $refreshToken = null ][, DateTimeImmutable|null $expiresAt = null ][, array<string|int, string>|null $scopes = null ][, PipeConnectedAccountState|null $state = null ][, string|null $organizationId = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Imports a connected account for a user by providing OAuth tokens directly. Use this to migrate existing connections or set up connections without going through the OAuth flow.

Parameters
$userId : string

A User identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$accessToken : string|null = null

The OAuth access token for the connected account.

$refreshToken : string|null = null

The OAuth refresh token for the connected account.

$expiresAt : DateTimeImmutable|null = null

The ISO-8601 timestamp when the access token expires. Required when access_token is provided for tokens that expire.

$scopes : array<string|int, string>|null = null

The OAuth scopes granted for this connection.

$state : PipeConnectedAccountState|null = null

Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.

$organizationId : string|null = null

An Organization identifier. Optional parameter if the connection is scoped to an organization.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount

deleteDataIntegration()

Delete a data integration

public deleteDataIntegration(string $slug[, RequestOptions|null $options = null ]) : void

Deletes the user-owned data integration and all of its connected installations. For a custom provider, the provider definition is deleted once no organization-owned root references it either.

Parameters
$slug : string

The slug identifier of the data integration.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

deleteDataIntegrationOrganization()

Delete an organization-owned data integration

public deleteDataIntegrationOrganization(string $slug[, RequestOptions|null $options = null ]) : void

Deletes the organization-owned data integration for a provider and all of its connected installations. For a custom provider, the provider definition is deleted once no user-owned root references it either. The /organization suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.

Parameters
$slug : string

The slug identifier of the data integration.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

deleteOrganizationConnectedAccount()

Delete an organization connected account

public deleteOrganizationConnectedAccount(string $organizationId, string $slug[, bool|null $supportsMultipleConnections = null ][, string|null $connectedAccountId = null ][, RequestOptions|null $options = null ]) : void

Disconnects the organization's account for the provider, including removing any stored access and refresh tokens. A member will need to reauthorize if the organization wants to reconnect. This does not revoke access on the provider side.

Parameters
$organizationId : string

An Organization identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select the connection to delete.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

deleteUserConnectedAccount()

Delete a connected account

public deleteUserConnectedAccount(string $userId, string $slug[, string|null $organizationId = null ][, bool|null $supportsMultipleConnections = null ][, string|null $connectedAccountId = null ][, RequestOptions|null $options = null ]) : void

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. Access is not revoked on the provider side, except for the WorkOS OAuth provider, whose underlying AuthKit grant is revoked.

Parameters
$userId : string

A User identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$organizationId : string|null = null

An Organization identifier. Optional parameter if the connection is scoped to an organization.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select the connection to delete.

$options : RequestOptions|null = null
Tags
throws
WorkOSException

getAccessToken()

Get an access token for a connected account

public getAccessToken(string $provider, string $userId[, string|null $organizationId = null ][, string|null $connectedAccountId = null ][, PipesOwnership|null $connectionOwner = null ][, bool|null $supportsMultipleConnections = null ][, RequestOptions|null $options = null ]) : DataIntegrationAccessTokenResponse

Fetches a valid OAuth access token for a user's connected account. WorkOS automatically handles token refresh, ensuring you always receive a valid, non-expired token.

Parameters
$provider : string

The identifier of the integration.

$userId : string

A User identifier. When connection_owner is organization, this is the user the credentials are vended on behalf of; they must be an active member of the organization.

$organizationId : string|null = null

An Organization identifier. Optional parameter to scope the connection to a specific organization. Required when connection_owner is organization.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select a specific connection when the user has several for this provider.

$connectionOwner : PipesOwnership|null = null

Which connection to vend from. user (the default) vends the user's own connection and requires user_id. organization vends the organization's shared connection and requires organization_id.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. If no connected_account_id is supplied and several connections match, the request returns account_selection_required. When omitted or false, only the compatibility connection is considered.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegrationAccessTokenResponse

getOrganizationConnectedAccount()

Get an organization connected account

public getOrganizationConnectedAccount(string $organizationId, string $slug[, bool|null $supportsMultipleConnections = null ][, string|null $connectedAccountId = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Retrieves an organization's connected account for a specific provider.

Parameters
$organizationId : string

An Organization identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select a specific connection when the organization has several for this provider.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount

getUserConnectedAccount()

Get a connected account

public getUserConnectedAccount(string $userId, string $slug[, string|null $organizationId = null ][, bool|null $supportsMultipleConnections = null ][, string|null $connectedAccountId = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Retrieves a user's connected account for a specific provider.

Parameters
$userId : string

A User identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$organizationId : string|null = null

An Organization identifier. Optional parameter if the connection is scoped to an organization.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select a specific connection when the user has several for this provider.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount

listDataIntegrationOrganization()

Get an organization-owned data integration

public listDataIntegrationOrganization(string $slug[, RequestOptions|null $options = null ]) : DataIntegration

Retrieves the organization-owned data integration for a provider by its slug. The /organization suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.

Parameters
$slug : string

The slug identifier of the data integration.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegration

listDataIntegrations()

List data integrations

public listDataIntegrations([string|null $before = null ][, string|null $after = null ][, int|null $limit = null ][, PaginationOrder $order = PaginationOrder::Desc ][, PipesOwnership|null $ownership = null ][, RequestOptions|null $options = null ]) : PaginatedResponse<string|int, DataIntegration>

Lists the environment's data integrations configured with custom or organization credentials, including custom providers and API key integrations. Both user-owned and organization-owned roots are returned, each as its own row with an ownership; filter with ownership to return only one kind.

Parameters
$before : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with "obj_123", your subsequent call can include before="obj_123" to fetch a new batch of objects before "obj_123".

$after : string|null = null

An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with "obj_123", your subsequent call can include after="obj_123" to fetch a new batch of objects after "obj_123".

$limit : int|null = null

Upper limit on the number of objects to return, between 1 and 100. Defaults to 10.

$order : PaginationOrder = PaginationOrder::Desc

Order the results by the creation time. Supported values are "asc" (ascending), "desc" (descending), and "normal" (descending with reversed cursor semantics where before fetches older records and after fetches newer records). Defaults to "desc".

$ownership : PipesOwnership|null = null

Only return Data Integrations with this ownership: user for the integrations users connect their own accounts to, or organization for the roots organizations connect to. Omit to return both.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
PaginatedResponse<string|int, DataIntegration>

listOrganizationDataProviders()

List providers for an organization

public listOrganizationDataProviders(string $organizationId[, bool|null $supportsMultipleConnections = null ][, RequestOptions|null $options = null ]) : DataIntegrationsListResponse

Retrieves the organization-owned providers configured for your environment and the organization's connected account information for each. Providers owned by individual users are not included.

Parameters
$organizationId : string

An Organization identifier to list providers and connected accounts for.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegrationsListResponse

listUserDataProviders()

List providers for a user

public listUserDataProviders(string $userId[, string|null $organizationId = null ][, bool|null $supportsMultipleConnections = null ][, RequestOptions|null $options = null ]) : DataIntegrationsListResponse

Retrieves a list of available providers and the user's connection status for each. Returns all providers configured for your environment, along with the user's connected account information where applicable.

Parameters
$userId : string

A User identifier to list providers and connected accounts for.

$organizationId : string|null = null

An Organization identifier. Optional parameter to filter connections for a specific organization.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegrationsListResponse

updateDataIntegration()

Update a data integration

public updateDataIntegration(string $slug[, string|null $description = null ][, bool|null $enabled = null ][, array<string|int, string>|null $scopes = null ][, DataIntegrationCredentialsInput|null $credentials = null ][, ApiKeyInstallation|null $apiKey = null ][, UpdateCustomProviderDefinition|null $customProvider = null ][, RequestOptions|null $options = null ]) : DataIntegration

Updates the description, enabled state, or custom credentials of the user-owned data integration. For custom providers, custom_provider updates the OAuth definition.

Parameters
$slug : string

The slug identifier of the data integration.

$description : string|null = null

An optional description of the Data Integration.

$enabled : bool|null = null

Whether the Data Integration is enabled.

$scopes : array<string|int, string>|null = null

The OAuth scopes to request for the Data Integration. Pass null to reset to the provider's configured scopes.

$credentials : DataIntegrationCredentialsInput|null = null

New OAuth credentials for the Data Integration. When provided, rotates the stored client secret. Mutually exclusive with api_key.

$apiKey : ApiKeyInstallation|null = null

An API key to install or rotate for a tenant on an api_key integration. Upserts the tenant installation identified by user_id (and optional organization_id).

$customProvider : UpdateCustomProviderDefinition|null = null

Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegration

updateDataIntegrationApiKey()

Upsert an API key for a connected account

public updateDataIntegrationApiKey(string $slug, string $userId, string $secret[, string|null $organizationId = null ][, string|null $connectedAccountId = null ][, PipesOwnership|null $connectionOwner = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Creates or updates an API-key-based installation for the specified integration, owned by the user or, when connection_owner is organization, shared by the organization. If an installation already exists, the stored API key is rotated to the new value.

Parameters
$slug : string

The identifier of the integration.

$userId : string

A User identifier.

$secret : string

The API key secret to store for this integration.

$organizationId : string|null = null

An Organization identifier. Optional parameter to scope the connection to a specific organization. Required when connection_owner is organization.

$connectedAccountId : string|null = null

A connected account identifier. Use this to rotate a specific existing connection.

$connectionOwner : PipesOwnership|null = null

Whose connection to create or rotate. user (the default) addresses the connection owned by user_id. organization addresses the connection shared by every member of organization_id; user_id then identifies the member performing the request and must be an active member of the organization.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount

updateDataIntegrationClientCredentials()

Upsert client credentials for a connected account

public updateDataIntegrationClientCredentials(string $slug, string $userId, string $clientId, string $clientSecret[, string|null $organizationId = null ][, string|null $connectedAccountId = null ][, PipesOwnership|null $connectionOwner = null ][, array<string, string>|null $config = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Creates or updates a client-credentials-based installation for the specified integration, owned by the user or, when connection_owner is organization, shared by the organization. If an installation already exists, the stored client credentials are rotated to the new values.

Parameters
$slug : string

The identifier of the integration.

$userId : string

A User identifier.

$clientId : string

The OAuth client ID to store for this integration.

$clientSecret : string

The OAuth client secret to store for this integration.

$organizationId : string|null = null

An Organization identifier. Optional parameter to scope the connection to a specific organization. Required when connection_owner is organization.

$connectedAccountId : string|null = null

A connected account identifier. Use this to rotate a specific existing connection.

$connectionOwner : PipesOwnership|null = null

Whose connection to create or rotate. user (the default) addresses the connection owned by user_id. organization addresses the connection shared by every member of organization_id; user_id then identifies the member performing the request and must be an active member of the organization.

$config : array<string, string>|null = null

Provider-specific configuration values collected for this installation, keyed by the provider's config field descriptors.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount

updateDataIntegrationOrganization()

Update an organization-owned data integration

public updateDataIntegrationOrganization(string $slug[, string|null $description = null ][, bool|null $enabled = null ][, array<string|int, string>|null $scopes = null ][, DataIntegrationCredentialsInput|null $credentials = null ][, ApiKeyInstallation|null $apiKey = null ][, UpdateCustomProviderDefinition|null $customProvider = null ][, RequestOptions|null $options = null ]) : DataIntegration

Updates the description, enabled state, or custom credentials of the organization-owned data integration for a provider. For custom providers, custom_provider updates the OAuth definition, which is shared with the user-owned root. The /organization suffix selects the environment-level organization-owned root for the provider; it does not name a particular organization.

Parameters
$slug : string

The slug identifier of the data integration.

$description : string|null = null

An optional description of the Data Integration.

$enabled : bool|null = null

Whether the Data Integration is enabled.

$scopes : array<string|int, string>|null = null

The OAuth scopes to request for the Data Integration. Pass null to reset to the provider's configured scopes.

$credentials : DataIntegrationCredentialsInput|null = null

New OAuth credentials for the Data Integration. When provided, rotates the stored client secret. Mutually exclusive with api_key.

$apiKey : ApiKeyInstallation|null = null

An API key to install or rotate for a tenant on an api_key integration. Upserts the tenant installation identified by user_id (and optional organization_id).

$customProvider : UpdateCustomProviderDefinition|null = null

Updates to a custom provider's OAuth definition. Only valid for custom-provider integrations.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
DataIntegration

updateOrganizationConnectedAccount()

Update an organization connected account

public updateOrganizationConnectedAccount(string $organizationId, string $slug[, string|null $accessToken = null ][, string|null $refreshToken = null ][, DateTimeImmutable|null $expiresAt = null ][, array<string|int, string>|null $scopes = null ][, PipeConnectedAccountState|null $state = null ][, bool|null $supportsMultipleConnections = null ][, string|null $connectedAccountId = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Updates an organization's connected account tokens, scopes, or state for a specific provider.

Parameters
$organizationId : string

An Organization identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$accessToken : string|null = null

The OAuth access token for the connected account.

$refreshToken : string|null = null

The OAuth refresh token for the connected account.

$expiresAt : DateTimeImmutable|null = null

The ISO-8601 timestamp when the access token expires. Required when access_token is provided for tokens that expire.

$scopes : array<string|int, string>|null = null

The OAuth scopes granted for this connection.

$state : PipeConnectedAccountState|null = null

Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select the connection to update.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount

updateUserConnectedAccount()

Update a connected account

public updateUserConnectedAccount(string $userId, string $slug[, string|null $accessToken = null ][, string|null $refreshToken = null ][, DateTimeImmutable|null $expiresAt = null ][, array<string|int, string>|null $scopes = null ][, PipeConnectedAccountState|null $state = null ][, string|null $organizationId = null ][, bool|null $supportsMultipleConnections = null ][, string|null $connectedAccountId = null ][, RequestOptions|null $options = null ]) : ConnectedAccount

Updates a user's connected account tokens, scopes, or state for a specific provider.

Parameters
$userId : string

A User identifier.

$slug : string

The slug identifier of the provider (e.g., github, slack, notion).

$accessToken : string|null = null

The OAuth access token for the connected account.

$refreshToken : string|null = null

The OAuth refresh token for the connected account.

$expiresAt : DateTimeImmutable|null = null

The ISO-8601 timestamp when the access token expires. Required when access_token is provided for tokens that expire.

$scopes : array<string|int, string>|null = null

The OAuth scopes granted for this connection.

$state : PipeConnectedAccountState|null = null

Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.

$organizationId : string|null = null

An Organization identifier. Optional parameter if the connection is scoped to an organization.

$supportsMultipleConnections : bool|null = null

Set to true to use the plural connection contract. When omitted or false, only the compatibility connection is considered.

$connectedAccountId : string|null = null

A connected account identifier. Use this to select the connection to update.

$options : RequestOptions|null = null
Tags
throws
WorkOSException
Return values
ConnectedAccount
On this page

Search results