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

# SCIM user request examples

<View title="Developer" />

<View title="Federal docs" />

<View title="EU docs" />

This topic provides example requests and responses for working with users through the LaunchDarkly System for Cross-domain Identity Management (SCIM) API.

## Create user (POST)

**Endpoint:** `POST /scim/v2/Users`

**Minimal request:**

```json lines wrap theme={null}
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "emails": [
    {
      "value": "alice@example.com",
      "primary": true
    }
  ],
  "name": {
    "givenName": "Alice",
    "familyName": "Smith"
  }
}
```

**Request with custom roles (root level):**

```json lines wrap theme={null}
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "emails": [{"value": "bob@example.com"}],
  "role": "reader",
  "customRolesArray": ["approver", "beta-tester"]
}
```

**Response:** `201 Created` with the created user object including the LaunchDarkly `id` field.

## Update user (PUT)

**Endpoint:** `PUT /scim/v2/Users/{id}`

PUT requires the **complete** user object. All fields should be included.

```json expandable lines wrap theme={null}
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "id": "507f1f77bcf86cd799439011",
  "externalId": "external-123",
  "userName": "jane",
  "name": {
    "givenName": "Jane",
    "familyName": "Smith"
  },
  "emails": [
    {
      "value": "jane.smith@example.com",
      "primary": true,
      "type": "work"
    }
  ],
  "active": true,
  "role": "admin",
  "customRole": "custom-role-1"
}
```

**Response:** `200 OK`

## Update user (PATCH)

**Endpoint:** `PATCH /scim/v2/Users/{id}`

LaunchDarkly supports both SCIM PATCH format and JSON Patch (RFC 6902) for partial updates.

**SCIM patch format:**

```json lines wrap theme={null}
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
  "Operations": [
    {
      "op": "replace",
      "path": "/active",
      "value": false
    }
  ]
}
```

**Update custom roles:**

```json lines wrap theme={null}
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
  "Operations": [
    {
      "op": "replace",
      "path": "/customRolesArray",
      "value": ["new-role-key"]
    }
  ]
}
```

**JSON patch format (alternative):**

```json lines wrap theme={null}
[
  {
    "op": "replace",
    "path": "/role",
    "value": "writer"
  },
  {
    "op": "replace",
    "path": "/emails/0/value",
    "value": "newemail@example.com"
  }
]
```

**Supported operations:** `add`, `remove`, `replace`

## Get user (GET)

**Endpoint:** `GET /scim/v2/Users/{id}`

**Response:** `200 OK` with complete user object.

**Complete response example:**

```json expandable lines wrap theme={null}
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "id": "507f1f77bcf86cd799439011",
  "externalId": "external-123",
  "userName": "user@example.com",
  "name": {
    "givenName": "John",
    "familyName": "Doe"
  },
  "emails": [
    {
      "value": "user@example.com",
      "primary": true,
      "type": "work"
    }
  ],
  "active": true,
  "role": "reader",
  "customRole": "custom-role-1,custom-role-2",
  "customRolesArray": ["custom-role-1", "custom-role-2"],
  "urn:ietf:params:scim:schemas:extension:launchdarkly:2.0:User": {
    "role": "reader",
    "customRole": "custom-role-1,custom-role-2"
  },
  "meta": {
    "resourceType": "User",
    "created": 1234567890000,
    "lastModified": 1234567890000,
    "location": "/scim/v2/Users/507f1f77bcf86cd799439011",
    "version": "1"
  }
}
```

## Query users (GET)

**Endpoint:** `GET /scim/v2/Users`

**Query parameters:**

* `filter`: SCIM filter expression (for example, `userName eq "user@example.com"`)
* `startIndex`: 1-based starting index for pagination
* `count`: Number of results per page

**Examples:**

```lines wrap theme={null}
GET /scim/v2/Users?filter=userName eq "user@example.com"
GET /scim/v2/Users?startIndex=1&count=100
```

**Response:**

```json expandable lines wrap theme={null}
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
  "totalResults": 1,
  "itemsPerPage": 100,
  "startIndex": 1,
  "Resources": [
    {
      "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
      "id": "507f1f77bcf86cd799439011",
      "userName": "user@example.com",
      "emails": [{"value": "user@example.com", "primary": true}],
      "active": true,
      "role": "reader"
    }
  ]
}
```

## Search users (POST)

**Endpoint:** `POST /scim/v2/Users/.search`

This is an alternative to `GET /scim/v2/Users` that accepts filter parameters in the request body.

**Request:**

```json lines wrap theme={null}
{
  "filter": "userName eq \"user@example.com\"",
  "startIndex": 1,
  "count": 10
}
```

**Response:** Same format as `GET /scim/v2/Users` (ListResponse)

## Delete user (DELETE)

**Endpoint:** `DELETE /scim/v2/Users/{id}`

**Response:** `204 No Content` (or `200 OK` with empty body)

**Note**: Deleting a user deactivates them and removes them from the account and all teams. Cannot delete an owner.
