---
title: "Classify Users"
method: PATCH
path: "/api/v1/users/classification"
tags: ["Users"]
---

# Classify Users

`PATCH /api/v1/users/classification`

## Request

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

Bulk-applies bot / metrics-exclusion classification flags to up to 25 users at once. Each user must resolve to a live Git contributor to be classified - every requested id absent from the `skipped` map in the response was applied; no flags are echoed back. On a 502, some users may already have been classified; retrying is safe because every flag is always set to an absolute value, never toggled.

## Request body

- UsersClassificationRequestModel
  - `users` object, required: User id (a positive integer) -> flags to set. 1 to 25 entries; each entry must set at least one flag.
  - `apply_on_history` boolean: Whether to also back-fill historical metrics for the affected users.

## Response `200`

Successful Response

- UsersClassificationResponseModel
  - `skipped` object: User id -> reason it was not classified. Every requested id absent from this map was applied - flags are never echoed back.
  - `backfill_history` 'not_requested' | 'in_progress' | 'failed' | 'null', nullable: not_requested (apply_on_history was false), in_progress (a metrics back-fill was triggered), failed (publishing the back-fill failed), or null (no back-fill decision was reached).

## 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
- `502`: Bad Gateway
- `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)
