---
title: "add/replace credential"
method: POST
path: "/accounts/{accountname}/users/{username}/credentials"
tags: ["User Management"]
---

# add/replace credential

`POST /accounts/{accountname}/users/{username}/credentials`

## Path parameters

- `accountname` string, required
- `username` string, required

## Request body

- AccessCredential — A login credential mapped to a user identity. For password credentials, the username to present for Basic auth is the user's username from the user record
  - `type` 'password', required — The type of credential
  - `value` string, required — The credential value (e.g. the password)
  - `created_at` string — The timestamp of creation of the credential

## Response `200`

Add a credential, overwritting if already exists

- User — A username for authenticating with one or more types of credentials. User type defines the expected credentials allowed for the user. Native users have passwords, External users have no credential internally. Internal users are service/system users for inter-service communication.
  - `username` string, required — The username to authenticate with
  - `type` 'native' | 'internal' | 'external' — The user's type
  - `source` string — If the user is external, this is the source that the user was initialized from. All other user types have this set to null
  - `created_at` string, date-time — The timestampt the user record was created
  - `last_updated` string, date-time — The timestamp of the last update to this record

## Other responses

- `500` — Internal error

---

[API](https://skmtc.net/anchore/apis/anchore-engine-api-server.md) · [All operations](https://skmtc.net/anchore/apis/anchore-engine-api-server/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/anchore/anchore-engine-api-server/versions/afb4f60ab44a/schema)
