---
title: "PATCH /personal/users/{userId}/favorites"
method: PATCH
path: "/personal/users/{userId}/favorites"
tags: ["user-data"]
---

# PATCH /personal/users/{userId}/favorites

`PATCH /personal/users/{userId}/favorites`

## Request

- Base URL: `http://localhost:3000/api`
- URL: `http://localhost:3000/api/personal/users/{userId}/favorites`
- Auth: HTTP bearer

Adds or removes a private favorite for an accessible resource

## Path parameters

- `userId` string, required

## Request body

- FavoriteMutationInput
  - `resourceType` 'bookmark' | 'note', required
  - `resourceId` string, required: MongoDB ID of the bookmark or note
  - `favorite` boolean, required: Whether the resource should be favorited

## Response `200`

Updated favorite state

- FavoriteMutationResponse
  - `resourceType` 'bookmark' | 'note', required
  - `resourceId` string, required
  - `favorite` boolean, required

## Other responses

- `400`: Bad request, validation errors
- `401`: unauthorized (you need to have a valid token) and userId must match the subject in token
- `403`: Access token is missing or invalid
- `404`: Resource not found
- `500`: Internal server error, when unknown server error is catched
- `503`: Database service unavailable

## Changes

- **2026-10-16** `14f691da4656`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/codeverdotdev/apis/codever-api/changes/personal/users/:userId/favorites/patch.md)

---

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