---
title: "Create or Update Repository User Roles"
method: POST
path: "/v1/repositories/{repositoryId}/users/add"
tags: ["Repositories"]
---

# Create or Update Repository User Roles

`POST /v1/repositories/{repositoryId}/users/add`

## Request

- Base URL: `https://api.lucid.co`
- URL: `https://api.lucid.co/v1/repositories/{repositoryId}/users/add`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://lucid.app/oauth2/authorize`
    - Token URL: `https://api.lucid.co/oauth2/token` scopes: `repository`
- TypeScript: <https://skmtc.dev/lucid/apis/lucid-rest-api/docs/v1/repositories/:repositoryId/users/add/post.ts> (a function with typed inputs; its response is checked against the schema)

Manages user roles on a repository, allowing for updating of existing repository users or adding roles for new users on the repository.

## Path parameters

- `repositoryId` string, required: Unique identifier for a repository folder, prefixed with `repo_`

## Request body

- AddRepositoryUsersRequest
  - `users` AddRepositoryUserRequest[], required: Array of users and their roles to add or update on the repository
    - `userId` integer, required: Unique identifier of the user to add or update
    - `role` 'REPOSITORY_OWNER' | 'REPOSITORY_MEMBER', required: Role of a user on a repository

## Response `204`

No Content. User and group roles have been successfully added or updated.

## Other responses

- `400`: Bad Request. Occurs when duplicate or invalid user IDs are provided, or REPOSITORY_MEMBERs are added to an UNRESTRICTED repository.
- `403`: Forbidden. Occurs when the user does not have permission to modify the repository.

---

[API](https://skmtc.dev/lucid/apis/lucid-rest-api.md) - [All operations](https://skmtc.dev/lucid/apis/lucid-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lucid/apis/lucid-rest-api/revisions/9c2c917ec59c?raw)
