---
title: "Create Role Assignment"
method: POST
path: "/v2/company/{company_id}/users/{user_id}/role_assignments"
tags: ["User Assignments"]
---

# Create Role Assignment

`POST /v2/company/{company_id}/users/{user_id}/role_assignments`

## Request

- Base URL: `https://api.7shifts.com`
- URL: `https://api.7shifts.com/v2/company/{company_id}/users/{user_id}/role_assignments`
- Auth: one of:
  - OAuth 2
    - Authorization code: `https://app.7shifts.com/oauth2/authorize`
    - Client credentials
    - Password
    - Token URL: `https://app.7shifts.com/oauth2/token`
  - API key in cookie `7session`

## Path parameters

- `company_id` integer, required
- `user_id` integer, required

## Headers

- `x-api-version` string: An API version
- `x-company-guid` string, uuid

## Request body

- object
  - `role_id` integer, required: Role ID for user assignment
  - `primary` boolean: Sets the role as primary for this user. Only one role per department can be primary.

## Response `201`

Created

- object
  - `object` 'role_assignments', required
  - `data` object, required
    - `role_id` integer, required: Role ID
    - `location_id` integer: Location ID
    - `department_id` integer: Department ID
    - `name` string, required: Role name
    - `is_primary` boolean, required: If true this will be the primary role for the user
    - `skill_level` integer, required
    - `sort` integer, required

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not found
- `500`: Server Error

---

[API](https://skmtc.dev/7shifts/apis/7shifts-api.md) - [All operations](https://skmtc.dev/7shifts/apis/7shifts-api/llms.txt) - [OpenAPI document](https://skmtc.dev/7shifts/apis/7shifts-api/revisions/40e0ef40dfcd?raw)
