---
updatedAt: 2026-05-11T10:36:16.000Z
agentTools:
  projectIndex: https://developer.oneflow.com/llms.txt
---

# Users

> 📘 Note:
>
> * Please, check out our [SCIM API Reference](https://developer.oneflow.com/reference/get-user) pages for details on all SCIM API endpoints.
> * Before sending API requests, ensure you have completed the steps in [Get started with SCIM](https://developer.oneflow.com/docs/get-started-with-scim).

## Step 1. Obtain the necessary information

<HTMLBlock>{`
<table data-identifyelement="502">
	<tbody data-identifyelement="503">
		<tr data-identifyelement="504">
			<td colspan="2" data-identifyelement="505"><strong data-identifyelement="506">Headers</strong></td>
		</tr>
		<tr data-identifyelement="507">
			<td data-identifyelement="508" style="width: 15.3204%;"><code data-identifyelement="509">accept</code></td>
			<td data-identifyelement="510" dir="ltr" style="width: 84.5403%;">Indicates the types of content the client can accept. I.e. application/scim+json</td>
		</tr>
		<tr data-identifyelement="511">
			<td data-identifyelement="512" style="width: 15.3204%;"><code data-identifyelement="513" dir="ltr">authorization</code></td>
			<td data-identifyelement="514" dir="ltr" style="width: 84.5403%;">You will only be able to use Oneflow&#39;s SCIM API with a valid
				<a href="oneflow-platform-glossary#api-token" dir="ltr" data-identifyelement="515"></a>SCIM API token. You can create a SCIM API token in the Oneflow web application. See <a data-identifyelement="516" dir="ltr" href="authentication-and-authorization">Authentication</a> to learn more.</td>
		</tr>
		<tr data-identifyelement="517">
			<td data-identifyelement="518" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="519">content-type</code></td>
			<td data-identifyelement="520" dir="ltr" style="width: 84.5403%;">Indicates the type of data that the client sends to the server. I.e. application/json</td>
		</tr>
		<tr data-identifyelement="521">
			<td colspan="2" data-identifyelement="522"><strong data-identifyelement="523">Path parameters</strong></td>
		</tr>
		<tr data-identifyelement="530">
			<td data-identifyelement="531" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="532">USER_ID</code></td>
			<td data-identifyelement="533" dir="ltr" style="width: 84.5403%;">The unique ID of the user inside Oneflow. You can find the user ID using the <a data-identifyelement="534" href="https://developer.oneflow.com/reference/get-user">users</a> endpoint.</td>
		</tr>
		<tr data-identifyelement="535">
			<td colspan="2" data-identifyelement="536" style="width: 99.8607%;"><strong data-identifyelement="537" dir="ltr">Query parameters</strong>
				<br data-identifyelement="538">
			</td>
		</tr>
		<tr data-identifyelement="539">
			<td data-identifyelement="540" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="541">sortBy</code>
				<br data-identifyelement="542">
			</td>
			<td data-identifyelement="543" dir="ltr" style="width: 84.5403%;">Indicates which field the list of users will be sorted by. I.e. displayName</td>
		</tr>
		<tr data-identifyelement="544">
			<td data-identifyelement="545" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="546">sortOrder</code>
				<br data-identifyelement="547">
			</td>
			<td data-identifyelement="548" dir="ltr" style="width: 84.5403%;">Determines the order in which the list of users will be sorted. I.e. ascending, descending
				<br data-identifyelement="549">
			</td>
		</tr>
		<tr data-identifyelement="550">
			<td data-identifyelement="551" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="552">startIndex</code>
				<br data-identifyelement="553">
			</td>
			<td data-identifyelement="554" dir="ltr" style="width: 84.5403%;">Indicates the starting position in the list as a number. I.e. 1</td>
		</tr>
		<tr data-identifyelement="555">
			<td data-identifyelement="556" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="557">count</code>
				<br data-identifyelement="558">
			</td>
			<td data-identifyelement="559" dir="ltr" style="width: 84.5403%;">Indicates the total number of records returned in the response. I.e. 100</td>
		</tr>
		<tr data-identifyelement="560">
			<td colspan="2" data-identifyelement="561"><strong data-identifyelement="562">Body</strong></td>
		</tr>
		<tr>
			<td dir="ltr"><code>active</code></td>
			<td dir="ltr" style="width: 84.5403%;">The status of the user account within Oneflow.</td>
		</tr>
		<tr data-identifyelement="563">
			<td data-identifyelement="564" style="width: 15.3204%;"><code data-identifyelement="565" dir="ltr">displayName</code>(required)</td>
			<td data-identifyelement="566" dir="ltr" style="width: 84.5403%;">The name of the user.</td>
		</tr>
		<tr data-identifyelement="567">
			<td data-identifyelement="568" style="width: 15.3204%;"><code data-identifyelement="569" dir="ltr">externalID</code></td>
			<td data-identifyelement="570" dir="ltr" style="width: 84.5403%;">The unique ID of the group in your identity provider or application.</td>
		</tr>
		<tr data-identifyelement="571">
			<td data-identifyelement="572" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="573">id</code></td>
			<td data-identifyelement="574" style="width: 84.5403%;">The unique ID of the group inside Oneflow.
				<br data-identifyelement="575">
			</td>
		</tr>
		<tr>
			<td style="width: 15.3204%;"><code>title</code>
				<br>
			</td>
			<td dir="ltr" style="width: 84.5403%;">Contains the user&#39;s job title.</td>
		</tr>
		<tr>
			<td><code>username</code>(required)
				<br>
			</td>
			<td dir="ltr" style="width: 84.5403%;">The unique username of the user. I.e. janedoe@oneflow.com</td>
		</tr>
		<tr>
			<td><code>locale</code>
				<br>
			</td>
			<td dir="ltr" style="width: 84.5403%;">The selected language for the account indicated as a locale identifier. I.e. &quot;en&quot; for English, &quot;sv&quot; for Swedish</td>
		</tr>
		<tr>
			<td dir="ltr"><code>schema</code></td>
			<td dir="ltr" style="width: 84.5403%;">A schema represents the user configuration. The schema used varies depending on the request type.
				<br>For PATCH requests:

				<p dir="ltr"><code>&quot;schemas&quot;: [&quot;urn:ietf:params:scim:api:messages:2.0:PatchOp&quot;]</code>
					<br>For POST requests:
					<br><code>&quot;schemas&quot;: [&quot;urn:ietf:params:scim:schemas:core:2.0:User&quot;]</code>
					<br>or
					<br><code>&quot;schemas&quot;[&quot;urn:ietf:params:scim:schemas:extension:enterprise:2.0:User&quot;]</code></p>
			</td>
		</tr>
		<tr>
			<td colspan="2" dir="ltr">phoneNumbers</td>
		</tr>
		<tr>
			<td dir="ltr"><code>primary</code>
				<br>
			</td>
			<td dir="ltr" style="width: 84.5403%;">Indicates whether the phone number is set as primary or not. I.e. true or false</td>
		</tr>
		<tr>
			<td dir="ltr"><code>type</code>
				<br>
			</td>
			<td dir="ltr" style="width: 84.5403%;">Indicates the type of phone number. I.e. work, home</td>
		</tr>
		<tr>
			<td dir="ltr"><code>value</code></td>
			<td dir="ltr" style="width: 84.5403%;">Contains the user&#39;s phone number.
				<br>
			</td>
		</tr>
		<tr>
			<td colspan="2" dir="ltr">groups</td>
		</tr>
		<tr>
			<td dir="ltr"><code>$ref</code></td>
			<td dir="ltr" style="width: 84.5403%;">Reference to the URI of the group the user belongs to.
				<br>
			</td>
		</tr>
		<tr>
			<td dir="ltr"><code>type</code></td>
			<td dir="ltr" style="width: 84.5403%;">Indicates the type of resource. I.e. a group</td>
		</tr>
		<tr>
			<td dir="ltr"><code>value</code></td>
			<td dir="ltr" style="width: 84.5403%;">Contains the Oneflow group ID.</td>
		</tr>
		<tr data-identifyelement="576">
			<td colspan="2" data-identifyelement="577" dir="ltr">meta</td>
		</tr>
		<tr data-identifyelement="578">
			<td data-identifyelement="579" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="580" dir="ltr">created</code></td>
			<td data-identifyelement="581" dir="ltr" style="width: 84.5403%;">Indicates when the user was created in the system.</td>
		</tr>
		<tr data-identifyelement="583">
			<td data-identifyelement="584" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="585">lastModified</code></td>
			<td data-identifyelement="586" dir="ltr" style="width: 84.5403%;">Indicates when the user&#39;s information was last changed.</td>
		</tr>
		<tr data-identifyelement="588">
			<td data-identifyelement="589" dir="ltr" style="width: 15.3204%;"><code data-identifyelement="590">location</code></td>
			<td data-identifyelement="591" dir="ltr" style="width: 84.5403%;">Indicates the location of the user as a URI.</td>
		</tr>
		<tr>
			<td><code>resourceType</code>
				<br>
			</td>
			<td dir="ltr" style="width: 84.5403%;">Indicates the resource type. I.e. a user</td>
		</tr>
	</tbody>
</table>
`}</HTMLBlock>

## Step 2. Run the code

### Create user

* To create a user, send a POST request to the [Users](https://developer.oneflow.com/reference/create-user) endpoint with the SCIM API token in the request’s header.
* Pass the user's attributes (i.e. username) to the relevant SCIM attribute of the request.

> 🚧 Note:
>
> * The `displayName`, and `userName` attributes are mandatory.

```curl
curl --request POST \
     --url https://api.oneflow.com/scim/v1/Users \
     --header 'accept: application/scim+json' \
     --header 'authorization: Bearer [TOKEN]' \
     --header 'content-type: application/json' \
     --data '
{
  "active": true,
  "meta": {
    "resourceType": "User"
  },
  "displayName": "Jane Doe",
  "userName": "janedoe@somewhere.com",
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User"
  ]
}
'
```
```python Python
import requests

url = "https://api.oneflow.com/scim/v1/Users"

payload = {
    "active": True,
    "meta": { "resourceType": "User" },
    "displayName": "Jane Doe",
    "userName": "janedoe@somewhere.com",
    "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"]
}
headers = {
    "accept": "application/scim+json",
    "content-type": "application/json",
    "authorization": "Bearer [TOKEN]"
}

response = requests.post(url, json=payload, headers=headers)
print(response.text)
```

* Refer to the [Data model](https://developer.oneflow.com/docs/data-model) for the complete list of SCIM attributes in Oneflow.

### Get user

* To get the attributes of a specific user, send a GET request to the [Users](https://developer.oneflow.com/reference/get-user) endpoint along with their ID as a path parameter.
  * I.e. In the following example, replace `[User_ID]` with the Oneflow user's ID.

```shell cuRL
curl --request GET \
     --url https://api.oneflow.com/scim/v1/Users/[USER_ID] \
     --header 'accept: application/scim+json' \
     --header 'authorization: Bearer [TOKEN]'
```
```python Python
import requests

url = 'https://api.oneflow.com/scim/v1/Users/[USER_ID]'
headers = {
    'accept': 'application/scim+json',
    'authorization': 'Bearer [token]'
}
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.text)
```

### Patch user (deactivate)

* Note that users cannot be permanently or physically deleted from the database.
* A soft delete operation is achieved by sending a PATCH request to the [Users](https://developer.oneflow.com/reference/patch-user) endpoint to set the `active` attribute to `false`.
* This effectively deactivates the user on Oneflow, however will not delete their data.

```curl
curl --request PATCH \
 --url 'https://api.oneflow.com/scim/v1/Users/[USER_ID]' \
--header 'accept: application/scim+json' \
--header 'authorization: Bearer [TOKEN]' \
--header 'content-type: application/json' \
--data '{
  "Operations": [
    {
      "op": "replace",
      "path": "active",
      "value": "false"
    }
  ],
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ]
}'
```
```python Python
import requests

url = "https://api.oneflow.com/scim/v1/Users/[USER_ID]"

payload = {
    "Operations": [
        {
            "op": "replace",
            "path": "active",
            "value": "false"
        }
    ],
    "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
}
headers = {
    "accept": "application/scim+json",
    "content-type": "application/json",
    "authorization": "Bearer [TOKEN]"
}

response = requests.patch(url, json=payload, headers=headers)
print(response.text)
```

### Update user

> ❗️ Note
>
> Sending a PUT request will overwrite the entire record. if some fields are omitted from the request, then these will be saved as null.
>
> To avoid data loss, send a GET request first and use this response as the base for the PUT request, or send a **PATCH** request to partially modify a user record.

* You can update an existing user by sending a PUT request to the [Users](https://developer.oneflow.com/reference/update-user) endpoint.
* To modify one or more attributes (partially update) of a user, send a PATCH request to the [Users](https://developer.oneflow.com/reference/patch-user) endpoint.
* Include the operation in the `op` parameter (`add`, `remove`, or `replace`), the attribute you wish to modify in the `path` parameter, along with its new `value`.

```curl
curl --request PATCH \
     --url https://api.oneflow.com/scim/v1/Users/[USER_ID] \
     --header 'accept: application/scim+json' \
     --header 'authorization: Bearer [TOKEN] ' \
     --header 'content-type: application/json' \
     --data '{
  "Operations": [
    {
      "op": "replace",
      "path": "displayName",
      "value": "J Doe"
    }
  ],
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ]
}'
```
```python Python
import requests

url = 'https://api.oneflow.com/scim/v1/Users/[USER_ID]'
headers = {
    'accept': 'application/scim+json',
    'authorization': 'Bearer [TOKEN]'
}

data = {
    'Operations': [
        {
            'op': 'replace',
            'path': 'displayName',
            'value': 'J Doe'
        }
    ]
   ],
    "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"]
}

response = requests.patch(url, headers=headers, data=data)

print(response.status_code)
print(response.text)
```

### Example response

```json
{
    "active": true,
    "displayName": "Jane Doe",
    "externalId": null,
    "groups": [
        {
            "$ref": "https://api.oneflow.com/scim/v1/Groups/227732",
            "type": "Group",
            "value": "227732"
        }
    ],
    "id": "998749",
    "locale": "en",
    "meta": {
        "created": "2023-07-14T05:10:41+00:00",
        "lastModified": "2023-08-25T07:29:54+00:00",
        "location": "https://api.oneflow.com/scim/v1/Users/998749",
        "resourceType": "User"
    },
    "phoneNumbers": [
        {
            "primary": true,
            "type": "work",
            "value": null
        }
    ],
    "roles": [],
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:User"
    ],
    "title": null,
    "userName": "janedoe@oneflow.com"
}
```

### List users

* You can retrieve the list of users in your Oneflow account along with their attributes.
* To sort or filter the list of users, use the query parameters specified in the [API reference](https://developer.oneflow.com/reference/list-users).
* For instance, to [list](https://developer.oneflow.com/reference/list-users) all users, send a GET request to the [Users](https://developer.oneflow.com/reference/list-users) endpoint with the SCIM API token in the request’s header.

```curl
curl --request GET \
     --url 'https://api.oneflow.com/scim/v1/Users?sortBy=displayName&sortOrder=ascending&startIndex=1&count=100' \
     --header 'accept: application/scim+json' \
     --header 'authorization: Bearer [TOKEN]'
```
```python Python
import requests

url = 'https://api.oneflow.com/scim/v1/Users?sortBy=displayName&sortOrder=ascending&startIndex=1&count=100'
headers = {
    'accept': 'application/scim+json',
    'authorization': 'Bearer [TOKEN]'
}
response = requests.get(url, headers=headers)

print(response.status_code)
print(response.text)
```

### Example response

```json
{
    "Resources": [
        {
            "active": true,
            "displayName": "Jane Doe",
            "externalId": null,
            "groups": [],
            "id": "975828",
            "locale": "en",
            "meta": {
                "created": "2022-12-02T07:52:16+00:00",
                "lastModified": "2022-12-02T07:52:16+00:00",
                "location": "https://api.oneflow.com/scim/v1/Users/975828",
                "resourceType": "User"
            },
            "phoneNumbers": [
                {
                    "primary": true,
                    "type": "work",
                    "value": null
                }
            ],
            "roles": [],
            "schemas": [
                "urn:ietf:params:scim:schemas:core:2.0:User"
            ],
            "title": "Sales Manager",
            "userName": "janedoe@oneflow.com"
        },
        {
            "active": true,
            "displayName": "John Doe",
            "externalId": null,
            "groups": [],
            "id": "972592",
            "locale": "en",
            "meta": {
                "created": "2022-10-28T06:21:54+00:00",
                "lastModified": "2022-10-28T06:21:54+00:00",
                "location": "https://api.oneflow.com/scim/v1/Users/972592",
                "resourceType": "User"
            },
            "phoneNumbers": [
                {
                    "primary": true,
                    "type": "work",
                    "value": null
                }
            ],
            "roles": [],
            "schemas": [
                "urn:ietf:params:scim:schemas:core:2.0:User"
            ],
            "title": "Marketing Manager",
            "userName": "janedoe@oneflow.com"
        },
        {
            "active": true,
            "displayName": "Oliver Queen",
            "externalId": null,
            "groups": [],
            "id": "972597",
            "locale": "en",
            "meta": {
                "created": "2022-10-28T06:21:54+00:00",
                "lastModified": "2022-10-28T06:21:55+00:00",
                "location": "https://api.oneflow.com/scim/v1/Users/972597",
                "resourceType": "User"
            },
            "phoneNumbers": [
                {
                    "primary": true,
                    "type": "work",
                    "value": null
                }
            ],
            "roles": [],
            "schemas": [
                "urn:ietf:params:scim:schemas:core:2.0:User"
            ],
            "title": "Software Engineer",
            "userName": "oliverqueen@oneflow.com"
        }
    ],
    "itemsPerPage": 3,
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:ListResponse"
    ],
    "startIndex": 1,
    "totalResults": 100
}
```

## Response codes

| Status | Meaning      | Description                                                                                                       |
| ------ | ------------ | ----------------------------------------------------------------------------------------------------------------- |
| 200    | OK           | Operation completed successfully.                                                                                 |
| 201    | Created      | Returns the created/updated user, optionally filtered by values in attributes or `excludedAttributes` parameters. |
| 204    | No content   | The group was deleted successfully.                                                                               |
| 400    | Bad Request  | Invalid format or content of the request.                                                                         |
| 401    | Unauthorized | The SCIM token is invalid.                                                                                        |
| 404    | Not found    | The requested entity is missing.                                                                                  |
| 409    | Conflict     | A conflict occurred with the current state of the target resource.                                                |

See [Handling errors with error codes](https://developer.oneflow.com/docs/handling-errors-with-error-codes) for reasons and resolutions.