---
title: "Set CLI secret for a user."
method: PUT
path: "/users/{user_id}/cli_secret"
tags: ["user"]
---

# Set CLI secret for a user.

`PUT /users/{user_id}/cli_secret`

This endpoint let user generate a new CLI secret for himself.  This API only works when auth mode is set to 'OIDC'. Once this API returns with successful status, the old secret will be invalid, as there will be only one CLI secret for a user.

## Path parameters

- `user_id` integer, required

## Headers

- `X-Request-Id` string

## Request body

- OIDCCliSecretReq
  - `secret` string — The new secret

## Response `200`

The secret is successfully updated

## Other responses

- `400` — Invalid user ID. Or user is not onboarded via OIDC authentication. Or the secret does not meet the standard.
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not found
- `412` — The auth mode of the system is not "oidc_auth", or the user is not onboarded via OIDC AuthN.
- `500` — Internal server error

---

[API](https://skmtc.dev/goharbor/apis/harbor-api.md) · [All operations](https://skmtc.dev/goharbor/apis/harbor-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/goharbor/harbor-api/revisions/62d78801f8df/schema)
