---
title: "Set Primary User"
method: POST
path: "/api/v1/users/{user_id}/primary-user"
tags: ["Users"]
---

# Set Primary User

`POST /api/v1/users/{user_id}/primary-user`

## Request

- Base URL: `https://public-api.linearb.io`
- URL: `https://public-api.linearb.io/api/v1/users/{user_id}/primary-user`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/linearb/apis/linearb-api/docs/api/v1/users/:user_id/primary-user/post.ts> (a function with typed inputs; its response is checked against the schema)

Users API endpoint changes which user is the primary of a unified user's merge group. The requested user must already be merged under the unified user.

## Path parameters

- `user_id` integer, required: Unified user object ID

## Request body

- SetPrimaryUserRequestModel
  - `primary_user` integer, required: ID of the already-merged user to promote to primary

## Response `200`

Successful Response

- SetPrimaryUserResponseModel
  - `user_id` integer, required
  - `primary_user` integer, required
  - `merged_users` integer[], required

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `405`: Method Not Allowed
- `409`: Conflict
- `422`: Validation Error
- `500`: Internal Server Error
- `504`: Gateway Timeout

---

[API](https://skmtc.dev/linearb/apis/linearb-api.md) - [All operations](https://skmtc.dev/linearb/apis/linearb-api/llms.txt) - [OpenAPI document](https://skmtc.dev/linearb/apis/linearb-api/revisions/3aea06710db6?raw)
