> ## Documentation Index
> Fetch the complete documentation index at: https://docs.serval.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Torq (Beta)

> Connect Torq to Serval workflows.

The Torq integration is in beta. Connect Torq to read workflows, executions,
cases, users and logs from Serval workflows. Workflows can also create and update cases, invite or remove users,
and publish workflows when the API key's role allows it.

## Create an API key

1. Sign in to Torq and open **Workspace Settings > Security > API Keys**.
2. Select **Create**, then enter a name and an expiration date.
3. Set **Type** to **Service account** and choose a role with the permissions
   your workflows need.
4. Select **Create**, then save the **Client ID** and **Client Secret**. Torq
   shows the secret once.

A service account key is not tied to a person, so it keeps working when someone
leaves the workspace. See Torq's
[API key guide](https://kb.torq.io/en/articles/9145827-create-torq-api-keys-personal-settings-in-torq)
and its
[roles and scopes reference](https://kb.torq.io/en/articles/9145806). Give the key a
role that can change data only for workflows that need to.

## Connect in Serval

1. Open **Integrations**, find **Torq**, and choose **Connect**.
2. Enter a **Torq workspace name**. This names the connection in Serval.
3. Choose the **Region** you sign in to Torq from: US or EU. This can't be
   changed later.
4. Enter the **Client ID** and **Client Secret**, then connect.

An API key works in one Torq workspace. To connect a second Torq workspace, add
another connection with its own name and key.

## Use the connection

Use the Torq connection in workflows to look up workflows and their runs, search
and update cases, add case notes and comments, list users and roles, and read
activity and audit logs.

> [!WARNING]
>
> Inviting or deleting a user, publishing or unpublishing a workflow, and updating a case change your
> Torq workspace. Review the intended change before running a workflow that writes to Torq.

Serval can't start a Torq workflow through this connection. Available APIs
depend on the API key's role.

## Troubleshooting

* **Authentication fails:** Check the client ID, the secret, the key's
  expiration and the region. Update the Serval connection after replacing a key.
* **An API returns 403:** Check that the key's role has the permission the
  request needs.
* **Changing the region:** A connection keeps the region it was created with.
  Add a new connection to use another region.
* **Renaming the connection:** Rename it from the connection's details page,
  not while replacing its key.
* **Replacing a key:** Use a key from the same Torq workspace. A key from
  another workspace makes this connection's workflows act in that workspace.
* **Routing the connection through a self-hosted worker:** Not supported for
  Torq. Torq is reached over the public internet, so the connection does not
  need a worker.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.