---
search:
  tags:
    - Single sign-on
    - PUT
seo:
  description: >-
    Requires organization:update. Kapten fetches the issuer's discovery…
    Reference for the PUT /organizations/{organizationId}/sso endpoint in the
    Auth API.
sidebar:
  label: Create or replace the organization's identity provider
  badge: PUT
title: Create or replace the organization's identity provider
type: openapi-operation
---
Requires organization:update. Kapten fetches the issuer's discovery document first, and refuses (400) one it cannot fetch or whose issuer differs. New domains start unverified; domains kept keep their verification. Changing the issuer ends the sessions the former provider started. The provisioning Role must exist and must not grant organization:delete.

`PUT /organizations/{organizationId}/sso`

**Request body** (`application/json`, required)

- `issuer` (string, required) — An https URL (plain http only when auth itself runs on http, in development).
- `client_id` (string, required)
- `client_secret` (string) — Required to create a connection; omit it to keep the current secret. Stored encrypted and never returned.
- `domains` (string[], required)
- `enforced` (boolean, required)
- `provisioning_role` (string) — Name of a Role to give on first SSO login; omit or leave empty to turn just-in-time provisioning off.

Request body example:

```json
{
  "issuer": "string",
  "client_id": "string",
  "client_secret": "string",
  "domains": [
    "string"
  ],
  "enforced": true,
  "provisioning_role": "string"
}
```

**Responses**

- `200` — The saved connection.
- `default` — The request failed.

Response example, 200:

```json
{
  "issuer": "string",
  "client_id": "string",
  "redirect_uri": "string",
  "domains": [
    {
      "domain": "string",
      "record_name": "string",
      "record_value": "string",
      "verified_at": "2019-08-24T14:15:22Z"
    }
  ],
  "enforced": true,
  "provisioning_role": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
```
