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

# Assign Users to Position

> Assigns multiple users to their respective positions in COR

Assigns multiple users to their respective positions in your COR instance. This endpoint allows batch assignment of users to positions.

## Request Body Requirements

<ParamField body="metadata" type="object" required>
  <Expandable title="properties">
    <ParamField body="source" type="string" required>
      Integration source identifier
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="users" type="array" required>
  Array of user-position assignments

  <Expandable title="items">
    <ParamField body="id" type="string" required>
      External user ID
    </ParamField>

    <ParamField body="position_id" type="string" required>
      External position ID
    </ParamField>
  </Expandable>
</ParamField>

## Known Errors

* `ValidationError` — Missing required fields or empty users array
* `UserNotFoundError` — One or more users not found with the specified external IDs
* `PositionNotFoundError` — One or more positions not found with the specified external IDs

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request PUT 'https://integrations.projectcor.com/v2/user/user-position' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "metadata": {
      "source": "OKTA"
    },
    "users": [
      {
        "id": "OKTA-USER-12345",
        "position_id": "POS-DEV-001"
      },
      {
        "id": "OKTA-USER-67890",
        "position_id": "POS-PM-001"
      }
    ]
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://integrations.projectcor.com/v2/user/user-position"

  payload = {
      "metadata": {
          "source": "OKTA"
      },
      "users": [
          {
              "id": "OKTA-USER-12345",
              "position_id": "POS-DEV-001"
          },
          {
              "id": "OKTA-USER-67890",
              "position_id": "POS-PM-001"
          }
      ]
  }

  headers = {
      "Authorization": "Bearer YOUR_ACCESS_TOKEN",
      "Content-Type": "application/json"
  }

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

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://integrations.projectcor.com/v2/user/user-position',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        metadata: {
          source: 'OKTA'
        },
        users: [
          {
            id: 'OKTA-USER-12345',
            position_id: 'POS-DEV-001'
          },
          {
            id: 'OKTA-USER-67890',
            position_id: 'POS-PM-001'
          }
        ]
      })
    }
  );

  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Users assigned to positions successfully",
    "assignments": [
      {
        "user_id": 8546,
        "position_id": 101,
        "status": "assigned"
      },
      {
        "user_id": 8547,
        "position_id": 102,
        "status": "assigned"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": "UserNotFoundError",
    "message": "User with external ID 'OKTA-USER-99999' not found",
    "code": "ZC004"
  }
  ```
</ResponseExample>
