These functions manage organizations in ThunderID. They are used by higher-level platform SDKs and can be called directly in custom integrations.
getAllOrganizations(config)
Retrieve all organizations accessible to the authenticated user, with optional filtering and pagination.
import { getAllOrganizations } from '@thunderid/javascript'
const result = await getAllOrganizations({
baseUrl: 'https://localhost:8090',
limit: 10,
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
result.organizations.forEach(org => console.log(org.name))
Parameters
| Parameter | Type | Required | Description |
|---|
config.baseUrl | string | ✅ | ThunderID base URL |
config.filter | string | — | SCIM-style filter expression (e.g., 'name co "acme"') |
config.limit | number | — | Maximum number of organizations to return |
config.recursive | boolean | — | Include descendant organizations recursively |
config.fetcher | function | — | Custom fetch function override |
config.headers | Record<string, string> | — | Additional request headers |
Response: AllOrganizationsApiResponse
| Property | Type | Description |
|---|
organizations | Organization[] | List of organizations |
hasMore | boolean | Whether more results are available |
nextCursor | string | Cursor for the next page |
totalCount | number | Total number of matching organizations |
getMeOrganizations(config)
Retrieve the organizations associated with the currently authenticated user.
import { getMeOrganizations } from '@thunderid/javascript'
const orgs = await getMeOrganizations({
baseUrl: 'https://localhost:8090',
limit: 20,
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
Parameters
| Parameter | Type | Required | Description |
|---|
config.baseUrl | string | ✅ | ThunderID base URL |
config.after | string | — | Cursor for forward pagination |
config.before | string | — | Cursor for backward pagination |
config.authorizedAppName | string | — | Filter by authorized application name |
config.filter | string | — | Filter expression |
config.limit | number | — | Maximum results |
config.recursive | boolean | — | Include descendant organizations |
config.fetcher | function | — | Custom fetch function override |
config.headers | Record<string, string> | — | Additional request headers |
Response: Organization[]
getOrganization(config)
Retrieve details for a specific organization by ID.
import { getOrganization } from '@thunderid/javascript'
const org = await getOrganization({
baseUrl: 'https://localhost:8090',
organizationId: '<org-id>',
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
console.log(org.name, org.orgHandle)
Parameters
| Parameter | Type | Required | Description |
|---|
config.baseUrl | string | ✅ | ThunderID base URL |
config.organizationId | string | ✅ | UUID of the organization |
config.fetcher | function | — | Custom fetch function override |
config.headers | Record<string, string> | — | Additional request headers |
Response: OrganizationDetails
| Property | Type | Description |
|---|
id | string | Organization UUID |
name | string | Organization display name |
orgHandle | string | URL-safe organization handle |
parent | object | Parent organization reference |
permissions | string[] | Permissions the requester has on this organization |
attributes | object[] | Custom organization attributes |
createOrganization(payload, config)
Create a new organization.
import { createOrganization } from '@thunderid/javascript'
const org = await createOrganization({
baseUrl: 'https://localhost:8090',
payload: {
name: 'ACME Corp',
orgHandle: 'acme-corp',
description: 'ACME Corporation',
parentId: '<parent-org-id>',
type: 'TENANT',
},
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
Parameters
| Parameter | Type | Required | Description |
|---|
config.baseUrl | string | ✅ | ThunderID base URL |
config.payload | CreateOrganizationPayload | ✅ | Organization creation payload |
config.payload.name | string | ✅ | Organization display name |
config.payload.orgHandle | string | — | URL-safe handle. Auto-derived from name if omitted |
config.payload.description | string | — | Organization description |
config.payload.parentId | string | — | Parent organization UUID |
config.payload.type | string | — | Organization type (e.g., 'TENANT') |
config.fetcher | function | — | Custom fetch function override |
Response: Organization
updateOrganization(config)
Update an organization's attributes using PATCH operations.
import { updateOrganization, createPatchOperations } from '@thunderid/javascript'
const updated = await updateOrganization({
baseUrl: 'https://localhost:8090',
organizationId: '<org-id>',
operations: createPatchOperations({ description: 'Updated description' }),
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
Parameters
| Parameter | Type | Required | Description |
|---|
config.baseUrl | string | ✅ | ThunderID base URL |
config.organizationId | string | ✅ | UUID of the organization to update |
config.operations | PatchOperation[] | ✅ | Array of PATCH operations |
config.fetcher | function | — | Custom fetch function override |
Response: OrganizationDetails
createPatchOperations(payload)
Helper that converts a plain object into a PatchOperation[] array, using 'REPLACE' for each key.
import { createPatchOperations } from '@thunderid/javascript'
const ops = createPatchOperations({
name: 'New Name',
description: 'New description',
})
Returns: PatchOperation[]
| Operation | Value |
|---|
'REPLACE' | Replace the attribute value |
'ADD' | Add a new value to the attribute |
'REMOVE' | Remove the attribute |
Types
Organization
| Property | Type | Description |
|---|
id | string | Organization UUID |
name | string | Display name |
orgHandle | string | URL-safe organization handle |
ref | string | Organization resource reference URL |
status | string | Organization status |