Programmatically create new workspaces and get them operational by adding SSO settings, inviting users, creating integrations, workflows, step runners, and more. This allows quick and secure onboarding, control over workspace resources, and easy division of organizational setup and team automation.
Enable automatic workspace creation
Automatic workspace creation allows organizations, especially MSPs, to provision new environments programmatically. This ensures consistent configuration and controlled access from the start.
Contact support: Reach out to Torq support to enable automatic workspace creation (available for MSPs).
Assign permissions: Once enabled, users with the Owner role can create new workspaces.
How to use
Create a new workspace in Torq
Creating a workspace programmatically allows you to immediately configure users, SSO, integrations, and workflows. The generated access token is used to authenticate all subsequent setup steps.
Add step: Use the Create a workspace step.
(Optional) Set name: Pass
workspace_namevia the on-demand trigger and reference it with{{ $.event.workspace_name }}.(Optional) Copy SSO: Set Copy SSO config to
trueto duplicate IdP settings.Store credentials: Capture the generated client ID and client secret from the step output. The initiator is automatically added as an Owner.
Configure SSO settings
SSO configuration ensures secure and consistent authentication across workspaces. You can replicate existing identity provider settings to streamline onboarding.
Enable SSO copy: Set Copy SSO config to
truein the Create a workspace step.Replicate claim mappings:
Use List claim mappings in the current workspace.
Loop through the results.
Recreate or customize mappings in the new workspace.
Invite users
Inviting users programmatically accelerates onboarding and ensures correct role assignment from the beginning. This is especially useful when provisioning multiple users at once.
Pass user list: Add a JSON parameter in the trigger with users and assigned roles.
Loop through users: Iterate over the list.
Send invitations: Use Invite a new user to send role-based invitations.
Create integrations
Integrations connect the new workspace to external systems and services. Automating integration setup ensures consistent configuration and secure credential handling.
Create integration: Use the Create an integration step and define required vendor parameters.
Access existing credentials: Reference credentials with
$.integrations.<integration_name>.<parameter>.Secure secrets: Store credentials as workspace secrets or retrieve them from an external vault.
Protect sensitive data: Set Discard data to Yes in Execution Options.
Authenticate setup:
Select Set values separately from the Torq integration menu.
Provide the new workspace access token.
Configure integration-specific settings (for example, webhook URLs).
Implement step runners
Step runners enable execution of workflows that require self-hosted environments. Automating their creation ensures imported workflows function correctly in the new workspace.
Pass runner list: Add a JSON parameter with predefined step runners and platforms.
Loop through runners: Use Create Step Runner to generate runners.
Deploy runners: Share the generated install commands with users for installation.
Import workflows
Importing workflows ensures operational readiness in the new workspace. You can replicate automation logic, maintain consistency, and optionally publish workflows immediately.
Pass workflow list: Provide a JSON parameter identifying workflows to import.
Retrieve workflows:
Use List workflows with the workflow name filter.
Use Retrieve a workflow to get the workflow ID.
Use Retrieve a revision to extract the YAML content.
Import workflow: Use Import a workflow in the new workspace.
(Optional) Publish workflow:
Use Publish a workflow in the new workspace.
Confirm publication by comparing
current_revision_idandpublished_revision_id.
(Optional) Add tags: Use Add a tag with the new workspace credentials.







