---
title: "PATCH /api/v1/credentials/{pk}/"
method: PATCH
path: "/api/v1/credentials/{pk}/"
tags: ["credentials"]
---

# PATCH /api/v1/credentials/{pk}/

`PATCH /api/v1/credentials/{pk}/`

## Request

- Base URL: `https://uptime.com` (the document declares no server; this is the origin it was published from)
- URL: `https://uptime.com/api/v1/credentials/{pk}/`
- Auth: none declared
- TypeScript: <https://skmtc.dev/uptime/apis/uptime-com-openapi-schema/docs/api/v1/credentials/:pk/patch.ts> (a function with typed inputs; its response is checked against the schema)

Update a credential

    When updating a credential the secret is completely replaced with the new secret provided in the request body.
    It is not possible to update individual fields of the secret. All previous fields will be lost.

        ** Request Body Requirements **

        There are multiple types of credentials and each has an expected shape for the secret and potentially other required or optional fields.

        The following is a list of the credential types and their expected shapes:

        #Username and Password - this is the only credential type that will allow you to specify a username
        {
            "credential_type": "BASIC",
            "username": "my_username",
            "secret": {
                "password": "my_password"
            }
        }

        # Certificate
        {
            "credential_type": "CERTIFICATE",
            "secret": {
                "certificate": "my_certificate",
                "key": "my_key", # optional
                "passphrase": "my_passphrase" # optional
            }
        }

        # Token - this is the option you want to store any kind of secret that doesn't fit into the other categories
        {
            "credential_type": "TOKEN",
            "secret": {
                "secret": "my_secret"
            }
        }

## Path parameters

- `pk` string, required

## Request body

- CredentialUpdate
  - `display_name` string
  - `description` string
  - `secret` object, nullable
    - `secret` string
    - `password` string
    - `certificate` string
    - `key` string
    - `passphrase` string
    - `period` integer
    - `num_digits` integer
  - `username` string

## Response `200`

- CredentialModel
  - `id` integer
  - `credential_type` 'BASIC' | 'CERTIFICATE' | 'TOKEN' | 'TOTP', required
  - `display_name` string, required
  - `description` string
  - `hint` string
  - `username` string
  - `version` string
  - `used_secret_properties` string[]
  - `created_by` string, nullable

---

[API](https://skmtc.dev/uptime/apis/uptime-com-openapi-schema.md) - [All operations](https://skmtc.dev/uptime/apis/uptime-com-openapi-schema/llms.txt) - [OpenAPI document](https://skmtc.dev/uptime/apis/uptime-com-openapi-schema/revisions/e1e4a57a60d8?raw)
