ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β π shadcn/directory/clerk/clerk-docs/_partials/organization-sync-options β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
The organizationSyncOptions property on the clerkMiddleware() options
object has the type OrganizationSyncOptions, which has the following properties:
Specifies URL patterns that are organization-specific, containing an organization ID or slug as a path parameter. If a request matches this path, the organization identifier will be used to set that org as active.
If the route also matches the personalAccountPatterns prop, this prop takes precedence.
Patterns must have a path parameter named either :id (to match a Clerk organization ID) or :slug (to match a Clerk organization slug).
[!WARNING] If the organization can't be activatedβeither because it doesn't exist or the user lacks accessβthe previously active organization will remain unchanged. Components must detect this case and provide an appropriate error and/or resolution pathway, such as calling
notFound()or displaying an<OrganizationSwitcher />.
Common examples:
["/orgs/:slug", "/orgs/:slug/(.*)"]["/orgs/:id", "/orgs/:id/(.*)"]["/app/:any/orgs/:slug", "/app/:any/orgs/:slug/(.*)"]personalAccountPatternsURL patterns for resources that exist within the context of a user's personal account.
If the route also matches the organizationPattern prop, the organizationPattern prop takes precedence.
Common examples:
["/me", "/me/(.*)"]["/user/:any", "/user/:any/(.*)"]
</Properties>
A Pattern is a string that represents the structure of a URL path. In addition to any valid URL, it may include:
:id, :slug, :any).(.*), which matches the remainder of the path./orgs/:slug| URL | Matches | :slug value |
| - | - | - |
| /orgs/acmecorp | β
| acmecorp |
| /orgs | β | n/a |
| /orgs/acmecorp/settings | β | n/a |
/app/:any/orgs/:id| URL | Matches | :id value |
| - | - | - |
| /app/petstore/orgs/org_123 | β
| org_123 |
| /app/dogstore/v2/orgs/org_123 | β | n/a |
/personal-account/(.*)| URL | Matches |
| - | - |
| /personal-account/settings | β
|
| /personal-account | β |
β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ