# Update a user

**PATCH** `/users/{user_id}`

## Parameters

### `user_id` (_path_, required)

User id

- **Type:** `string`
- **Example:** `"42"`
- **Constraints:** pattern `^[1-9]\d*$`

## Request body

**application/json**

_Schema ref:_ `#/components/schemas/PatchUserBody` (PatchUserBody)

```json
{
  "type": "object",
  "properties": {
    "email": {
      "type": "string",
      "format": "email",
      "description": "New work email. Omit for no change; cannot be set to null. Same validation as create; must not belong to another active user when changed.",
      "example": "ada@example.com"
    },
    "secondary_email": {
      "type": "string",
      "nullable": true,
      "format": "email",
      "description": "Personal email, kept to reach the user outside work, such as after they leave. Unique among the company's active users; never used to sign in. Omit for no change; null clears it.",
      "example": "ada.lovelace@gmail.com"
    },
    "first_name": {
      "type": "string",
      "minLength": 1,
      "description": "Given name. Omit for no change; cannot be cleared via null.",
      "example": "Ada"
    },
    "last_name": {
      "type": "string",
      "minLength": 1,
      "description": "Family name. Omit for no change; cannot be cleared via null.",
      "example": "Lovelace"
    },
    "phone": {
      "type": "string",
      "minLength": 1,
      "description": "Contact phone. Omit for no change; cannot be cleared via null.",
      "example": "+33123456789"
    },
    "phone_country": {
      "type": "string",
      "description": "ISO 3166-1 alpha-2. Omit for no change; cannot be cleared via null.",
      "example": "FR"
    },
    "language": {
      "type": "string",
      "nullable": true,
      "minLength": 1,
      "description": "Preferred UI language. Omit for no change; null clears when supported.",
      "example": "fr"
    },
    "position": {
      "type": "string",
      "nullable": true,
      "minLength": 1,
      "description": "Job title. Omit for no change; null clears when supported.",
      "example": "Software engineer"
    },
    "arrival_date": {
      "type": "string",
      "nullable": true,
      "minLength": 1,
      "description": "Employment start. Omit for no change; null clears when supported.",
      "example": "2024-01-15"
    },
    "departure_date": {
      "type": "string",
      "nullable": true,
      "minLength": 1,
      "description": "Employment end. Omit for no change; null clears when supported.",
      "example": "2026-12-31"
    },
    "date_of_birth": {
      "type": "string",
      "nullable": true,
      "minLength": 1,
      "description": "Date of birth. Omit for no change; null clears when supported.",
      "example": "1990-05-21"
    },
    "city_of_birth": {
      "type": "string",
      "nullable": true,
      "minLength": 1,
      "description": "City of birth. Omit for no change; null clears when supported.",
      "example": "Paris"
    },
    "country_of_birth": {
      "type": "string",
      "nullable": true,
      "minLength": 1,
      "description": "Country of birth. Omit for no change; null clears when supported.",
      "example": "FR"
    },
    "role": {
      "type": "string",
      "enum": [
        "EMPLOYEE",
        "ADMIN"
      ],
      "description": "EMPLOYEE: standard company user. ADMIN: can manage company configuration and users. On create, defaults to EMPLOYEE when omitted.",
      "example": "EMPLOYEE"
    },
    "is_signatory": {
      "type": "boolean",
      "description": "Whether the user can sign leasing contracts for the company, in addition to their role. Requires a phone number, given in the same request or already on the user.",
      "example": true
    },
    "team_ids": {
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 0,
        "exclusiveMinimum": true
      },
      "description": "Ids of company teams to assign. Teams must already exist. On patch, replaces all current team memberships when provided.",
      "example": [
        12,
        34
      ]
    }
  }
}
```

## Responses

### 200

Updated user

**application/json**

_Schema ref:_ `#/components/schemas/GetUserResponse` (GetUserResponse)

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "email": {
          "type": "string",
          "nullable": true
        },
        "secondary_email": {
          "type": "string",
          "nullable": true
        },
        "first_name": {
          "type": "string",
          "nullable": true
        },
        "last_name": {
          "type": "string",
          "nullable": true
        },
        "phone": {
          "type": "string",
          "nullable": true
        },
        "phone_country": {
          "type": "string",
          "nullable": true
        },
        "language": {
          "type": "string",
          "nullable": true
        },
        "position": {
          "type": "string",
          "nullable": true
        },
        "role": {
          "type": "string",
          "enum": [
            "EMPLOYEE",
            "ADMIN"
          ],
          "description": "EMPLOYEE: standard company user. ADMIN: can manage company configuration and users. On create, defaults to EMPLOYEE when omitted.",
          "example": "EMPLOYEE"
        },
        "is_signatory": {
          "type": "boolean",
          "description": "Whether the user can sign leasing contracts for the company"
        },
        "arrival_date": {
          "type": "string",
          "nullable": true
        },
        "departure_date": {
          "type": "string",
          "nullable": true
        },
        "date_of_birth": {
          "type": "string",
          "nullable": true
        },
        "city_of_birth": {
          "type": "string",
          "nullable": true
        },
        "country_of_birth": {
          "type": "string",
          "nullable": true
        },
        "teams": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "label": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "label"
            ]
          },
          "description": "Teams the user belongs to, sorted by label."
        },
        "created_at": {
          "type": "string",
          "nullable": true
        },
        "updated_at": {
          "type": "string",
          "nullable": true
        }
      },
      "required": [
        "id",
        "email",
        "secondary_email",
        "first_name",
        "last_name",
        "phone",
        "phone_country",
        "language",
        "position",
        "role",
        "is_signatory",
        "arrival_date",
        "departure_date",
        "date_of_birth",
        "city_of_birth",
        "country_of_birth",
        "teams",
        "created_at",
        "updated_at"
      ]
    }
  },
  "required": [
    "data"
  ]
}
```

### 400

Validation or business rule error

**application/json**

_Schema ref:_ `#/components/schemas/UserWriteBadRequestResponse` (UserWriteBadRequestResponse)

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "message": {
          "type": "string",
          "description": "Every validation failure, comma-separated",
          "example": "Required, must be an ISO 3166-1 alpha-2 country code"
        },
        "type": {
          "type": "string",
          "enum": [
            "validation_error"
          ]
        },
        "error": {
          "type": "string",
          "enum": [
            "validation_error"
          ]
        }
      },
      "required": [
        "message",
        "type",
        "error"
      ]
    },
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string",
          "enum": [
            "USER_EMAIL_NOT_ALLOWED",
            "SIGNATORY_PHONE_REQUIRED",
            "USER_ROLE_UPDATE_FORBIDDEN"
          ]
        }
      },
      "required": [
        "error"
      ]
    }
  ]
}
```

### 401

Missing, invalid, or revoked API key

**text/plain**

```json
{
  "type": "string",
  "example": "Unauthorized"
}
```

### 403

The API key has READ scope; this operation needs WRITE

**application/json**

_Schema ref:_ `#/components/schemas/InsufficientScopeErrorResponse` (InsufficientScopeErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "INSUFFICIENT_SCOPE"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 404

User or team not found

**application/json**

_Schema ref:_ `#/components/schemas/PatchUserNotFoundErrorResponse` (PatchUserNotFoundErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "USER_NOT_FOUND",
        "USER_TEAM_NOT_FOUND"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 409

The email, or the personal email, belongs to another user

**application/json**

_Schema ref:_ `#/components/schemas/UserEmailConflictErrorResponse` (UserEmailConflictErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "USER_EMAIL_CONFLICT"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 429

Rate limit exceeded. The RateLimit-* headers give the limit and the reset time.

**text/plain**

```json
{
  "type": "string",
  "example": "Too many requests, please try again later."
}
```

### 500

Unexpected server error

**application/json**

_Schema ref:_ `#/components/schemas/InternalErrorResponse` (InternalErrorResponse)

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "enum": [
        "INTERNAL_ERROR"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 503

Rate limiting is temporarily unavailable; retry with backoff

**application/json**

_Schema ref:_ `#/components/schemas/RateLimiterUnavailableResponse` (RateLimiterUnavailableResponse)

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    }
  },
  "required": [
    "message"
  ]
}
```

## Security

```json
[
  {
    "bearerAuth": []
  }
]
```

**bearerAuth:** Bearer token using a Fleet platform API key (flt_sk_…).

---

_Generated from the OpenAPI specification for raw Markdown / tooling use._
