> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/clerk.md).

# Clerk

Manage Clerk users, sessions, and organizations.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication |
| --------- | -------------- |
| Clerk     | Secret Key     |

#### Clerk

Connect to Clerk user, session, and organization management with a Secret Key.

**Set up in Clerk**

1. Prepare the Clerk account or service that the workflow will access. Grant access to the required resources and operations.
2. **Secret Key:** Create a Secret Key in the Clerk Dashboard API Keys page.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Clerk**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field | Required | What to enter                                                                                                                             |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Secret Key    | Yes      | Create a Secret Key in the Clerk Dashboard API Keys page. [Provider instructions](https://dashboard.clerk.com/last-active?path=api-keys). |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Clerk** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Create User

Create a Clerk user with the identity details required by the connected instance.

**Inputs**

| Field         | Type   | Required | Description                                                   |
| ------------- | ------ | -------- | ------------------------------------------------------------- |
| Email address | string | No       | The user's primary email address.                             |
| Phone number  | string | No       | The user's primary phone number.                              |
| Username      | string | No       | A unique username when the Clerk instance supports usernames. |
| First name    | string | No       | The user's given name.                                        |
| Last name     | string | No       | The user's family name.                                       |
| External ID   | string | No       | A unique identifier from another system.                      |

**Outputs**

| Field | Type   | Description                      |
| ----- | ------ | -------------------------------- |
| User  | object | The Clerk user that was created. |

#### List Users

Search and list users in the connected Clerk instance.

**Inputs**

| Field           | Type            | Required | Description                                                                                              |
| --------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| Search          | string          | No       | Partial text to match against user profile fields.                                                       |
| Email contains  | string          | No       | Partial text to match only against email addresses.                                                      |
| Organization ID | select (string) | No       | Choose the Clerk organization whose users should be returned. Options load from the selected connection. |
| Maximum results | integer         | No       | The maximum number of users to return. Minimum: 1. Maximum: 500. Default: 100.                           |
| Resume cursor   | string          | No       | The user cursor returned by an earlier List Users result.                                                |

**Outputs**

| Field       | Type          | Description                                                     |
| ----------- | ------------- | --------------------------------------------------------------- |
| Users       | object\_array | The matching Clerk users.                                       |
| User count  | integer       | The number of users returned.                                   |
| Next cursor | string        | The user cursor to use for the next batch, when more may exist. |

#### Update user metadata

Merge public, private, or frontend-writable metadata into a Clerk user.

**Inputs**

| Field                      | Type            | Required | Description                                                                             |
| -------------------------- | --------------- | -------- | --------------------------------------------------------------------------------------- |
| User                       | select (string) | Yes      | The Clerk user whose metadata should change. Options load from the selected connection. |
| Public metadata            | textarea        | No       | Metadata visible through Clerk's frontend and backend APIs.                             |
| Private metadata           | textarea        | No       | Metadata visible only through Clerk's backend API.                                      |
| Frontend-writable metadata | textarea        | No       | Metadata that the application's frontend can also modify.                               |

**Outputs**

| Field        | Type   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| Updated user | object | The Clerk user after the metadata merge. |

#### Create organization

Create a Clerk organization and optionally assign its first administrator.

**Inputs**

| Field                 | Type            | Required | Description                                                                                                   |
| --------------------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| Organization name     | string          | Yes      | The organization name shown in Clerk.                                                                         |
| Initial administrator | select (string) | No       | An existing Clerk user to add as the organization's administrator. Options load from the selected connection. |
| Organization slug     | string          | No       | A URL-friendly organization identifier when slugs are enabled.                                                |
| Public metadata       | textarea        | No       | Organization metadata visible through frontend and backend APIs.                                              |
| Private metadata      | textarea        | No       | Organization metadata visible only through the backend API.                                                   |
| Maximum memberships   | integer         | No       | An optional membership limit for this organization.                                                           |

**Outputs**

| Field        | Type   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| Organization | object | The Clerk organization that was created. |

#### Revoke session

Sign one Clerk session out by changing it to revoked.

**Inputs**

| Field   | Type            | Required | Description                                                                                  |
| ------- | --------------- | -------- | -------------------------------------------------------------------------------------------- |
| User    | select (string) | Yes      | The user whose active session should be selected. Options load from the selected connection. |
| Session | select (string) | Yes      | The active Clerk session to revoke. Options load from the selected connection.               |

**Outputs**

| Field           | Type   | Description                         |
| --------------- | ------ | ----------------------------------- |
| Revoked session | object | The Clerk session after revocation. |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/clerk.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
