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

# Switch Active Profile

> Switch the active customer profile for the current session to a different profile owned by the same user account.

# Switch Active Profile

Changes the active customer profile for the current session. A single user account can have multiple customer profiles (individual, company, or profiles at different locations). This endpoint sets the specified profile as the default, so subsequent authenticated requests operate in that profile's context.

## Authentication

Requires a valid customer bearer token.

## Query Parameters

<ParamField query="coworkerId" type="number" required>
  The numeric identifier of the profile to switch to. Obtain valid profile IDs from `GET /api/public/coworkers/profiles` — use a `Profiles[].Id` value
  where `Profiles[].Active` is `true`.
</ParamField>

## Response

The portal typically discards the response body and re-fetches `GET /api/public/coworkers/profiles` after a successful switch to update the session state.

Returns an `ActionConfirmation` envelope.

<ResponseField name="WasSuccessful" type="boolean">
  `true` when the profile was switched successfully.
</ResponseField>

<ResponseField name="Value" type="string | null">
  Usually `null` on success.
</ResponseField>

<ResponseField name="Status" type="number">
  HTTP-style status code mirrored in the body. `200` on success.
</ResponseField>

<ResponseField name="Message" type="string | null">
  Human-readable message. Usually `null` on success.
</ResponseField>

<ResponseField name="Errors" type="any">
  Validation errors. `null` on success.
</ResponseField>

## Example Response

```json theme={null}
{
  "WasSuccessful": true,
  "Value": null,
  "Status": 200,
  "Message": null,
  "Errors": null
}
```

## TypeScript Integration

```typescript theme={null}
import endpoints from '@/api/endpoints'

await httpClient.put(endpoints.coworkers.setCurrentProfile(coworkerId))

// Re-fetch profiles to update UI
await refetchProfiles()
```

## Usage in Portal

| Context                                     | Source file                                                                  |
| ------------------------------------------- | ---------------------------------------------------------------------------- |
| Account switcher in the navigation dropdown | `src/components/NavBar/AccountDropdown.tsx`                                  |
| Virtual Office profile mismatch alert       | `src/views/virtual-offices/components/VirtualOfficeProfileMismatchAlert.tsx` |

## Error Responses

<ResponseField name="401 Unauthorized" type="error">
  The bearer token is missing, expired, or invalid.
</ResponseField>

<ResponseField name="404 Not Found" type="error">
  No profile with the given `coworkerId` exists or it does not belong to this user account.
</ResponseField>

## Related Endpoints

| Method | Endpoint                                          | Description                                        |
| ------ | ------------------------------------------------- | -------------------------------------------------- |
| `GET`  | `/api/public/coworkers/profiles`                  | List all profiles available to the current session |
| `GET`  | `/api/public/coworkers/profiles/current/benefits` | Get benefits for the currently active profile      |
