---
title: "Change part of the connection, or turn single sign-on on or off with `enabled`."
method: PATCH
path: "/v1/organizations/current/sso"
tags: ["organizations"]
---

# Change part of the connection, or turn single sign-on on or off with \`enabled\`.

`PATCH /v1/organizations/current/sso`

## Request

- Base URL: `https://api.50heads.com`
- URL: `https://api.50heads.com/v1/organizations/current/sso`
- Auth: HTTP bearer

Organization admins only (403 `organization_admin_required`), on a browser session with a fresh proof in the `x-50h-reauth` header (401 `reauth_required`). It needs a person: API keys, connected apps and service accounts get 403 `session_required`. Every change is written to the organization's audit. Turning it on needs a successful test sign-in since the last provider change (409 `sso_test_required`) and a verified domain. Turning it off is refused while enforcement is on. OIDC fields on a SAML connection, or SAML fields on an OIDC one, are 400 `protocol_mismatch`. SAML certificate rotation: new metadata with `keepPreviousCertificate: true` keeps the certificate in use beside the new one (at most two, 409 `too_many_certificates`), and `removeCertificate` (a fingerprint) drops one later (409 `last_certificate` for the only one); neither needs a new test or turning enforcement off.

## Request body

- OrganizationSsoUpdateRequest
  - `issuer` string
  - `clientId` string
  - `clientSecret` string
  - `tokenAuthMethod` 'client_secret_basic' | 'client_secret_post'
  - `defaultWorkspaceId` string, nullable
  - `defaultRole` 'admin' | 'member' | 'viewer'
  - `enabled` boolean
  - `metadataUrl` string
  - `metadataXml` string
  - `keepPreviousCertificate` boolean
  - `removeCertificate` string
  - `allowIdpInitiated` boolean

## Response `200`

OK

- OrganizationSsoGetResponse
  - `connection` object, nullable, required
    - `id` string, required
    - `protocol` 'oidc' | 'saml', required
    - `issuer` string, required: OIDC: the identity provider's issuer URL, exactly as its discovery document gives it. SAML: the identity provider's entity ID.
    - `clientId` string, required
    - `clientSecretSet` boolean, required
    - `clientSecretHint` string, nullable, required
    - `tokenAuthMethod` 'client_secret_basic' | 'client_secret_post', required
    - `defaultWorkspaceId` string, nullable, required
    - `defaultRole` 'admin' | 'member' | 'viewer', required
    - `state` 'draft' | 'tested' | 'enabled', required
    - `enforce` boolean, required
    - `enforceEnabledAt` string, nullable, required
    - `configChangedAt` string, required
    - `lastTest` object, nullable, required
      - `at` string, required
      - `by` object, required
        - `id` string, required
        - `name` string, nullable, required
      - `result` string, required
      - `matchedTester` boolean, required
      - `current` boolean, required
    - `lastSignInAt` string, nullable, required
    - `createdAt` string, required
    - `updatedAt` string, nullable, required
    - `saml` object, nullable, required
      - `idpEntityId` string, required
      - `ssoUrl` string, required
      - `metadataUrl` string, nullable, required
      - `certificates` object[], required
        - `fingerprint` string, required
        - `notBefore` string, required
        - `notAfter` string, required
        - `subject` string, nullable, required
        - `keyType` 'rsa' | 'ec-p256', required
      - `allowIdpInitiated` boolean, required
  - `redirectUri` string, required
  - `scopes` string[], required
  - `saml` object, required
    - `entityId` string, required
    - `acsUrl` string, required
    - `metadataUrl` string, required
    - `nameIdFormat` string, required

## Other responses

- `400`: The request is not valid; `error.details.validation` lists the fixes.
- `401`: No key or token, or it expired or was revoked.
- `403`: The key or token lacks the scope (`insufficient_scope`), or the action is not allowed.
- `429`: Too many requests; wait for Retry-After.

---

[API](https://skmtc.dev/50heads/apis/50heads-api.md) · [All operations](https://skmtc.dev/50heads/apis/50heads-api/llms.txt) · [OpenAPI document](https://skmtc.dev/50heads/apis/50heads-api/revisions/20175e8b00e3?raw)
