---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [clients](../index.md) / normalizeTenantId

# Function: normalizeTenantId()

> **normalizeTenantId**(`value`): `string`

Defined in: [packages/b2c-tooling-sdk/src/clients/custom-apis.ts:265](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/b099fb909260c5c00c90ca9da612a7f50c1328d4/packages/b2c-tooling-sdk/src/clients/custom-apis.ts#L265)

Normalizes any parseable tenant/organization ID form to the canonical underscore format.

Supported input forms (all resolve to `abcd_123`):
- `abcd_123` — canonical tenant ID (returned as-is)
- `abcd-123` — hyphenated tenant ID
- `f_ecom_abcd_123` — organization ID
- `f_ecom_abcd-123` — org ID with hyphenated tenant
- `abcd-123.dx.commercecloud.salesforce.com` — sandbox hostname

Only sandbox hostnames carry the tenant ID by convention. Other hostnames
(for example `staging-realm-customer.demandware.net`) are returned unchanged
rather than guessing a tenant from the first label.

## Parameters

### value

`string`

The tenant ID, organization ID, or sandbox hostname

## Returns

`string`

The normalized tenant ID in canonical underscore format (e.g., "abcd_123")

## Example

```ts
normalizeTenantId('f_ecom_zzxy_prd') // Returns 'zzxy_prd'
normalizeTenantId('zzxy-prd')        // Returns 'zzxy_prd'
normalizeTenantId('zzxy-001.dx.commercecloud.salesforce.com') // Returns 'zzxy_001'
```
