• Home
  • Dynatrace API
  • Configuration
  • Credential vault
  • PUT a set of credentials

Credential vault API - PUT a set of credentials

Updates the specified set of credentials for synthetic monitors.

The request consumes and produces an application/json payload.

PUTManaged https://{your-domain}/e/{your-environment-id}/api/config/v1/credentials/{id}
SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/credentials/{id}
Environment ActiveGate https://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/credentials/{id}

Authentication

To execute this request, you need an access token with Write credential vault entries (credentialVault.write) scope. To learn how to obtain and use it, see Tokens and authentication.

Parameters

Refer to JSON models to find all JSON models that depend on the type of the model.

ParameterTypeDescriptionInRequired
idstring

The Dynatrace entity ID of the credentials set to be updated.

pathrequired
bodyCredentials

The JSON body of the request. Contains updated parameters of the credentials set.

bodyrequired

Request body objects

The Credentials object

A set of credentials for synthetic monitors.

The actual set of fields depends on the type of credentials. Find the list of actual objects in the description of the type field or see Credential vault API - JSON models.

ElementTypeDescription
namestring

The name of the credentials set.

idstring

The ID of the credentials set.

Can be null.

descriptionstring

A short description of the credentials set.

Can be null.

ownerAccessOnlyboolean

The credentials set is available to every user (false) or to owner only (true).

Can be null.

scopestring

The scope of the credentials set.

The element can hold these values
  • ALL
  • EXTENSION
  • SYNTHETIC
typestring

Defines the actual set of fields depending on the value. See one of the following objects:

  • CERTIFICATE -> CertificateCredentials
  • PUBLIC_CERTIFICATE -> PublicCertificateCredentials
  • USERNAME_PASSWORD -> UserPasswordCredentials
  • TOKEN -> TokenCredentials
The element can hold these values
  • CERTIFICATE
  • PUBLIC_CERTIFICATE
  • TOKEN
  • USERNAME_PASSWORD

Can be null.

Request body JSON model

This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.

json
{ "name": "Sample credentials", "type": "USERNAME_PASSWORD", "description": "Sample set of credentials for API documentation", "user": "john.smith", "password": "1234abcd", "ownerAccessOnly": "true", "scope": "SYNTHETIC" }

Response

Response codes

CodeTypeDescription
201CredentialsResponseElement

Success. The new credentials set has been created. The response contains the ID of the set.

204-

Success. The credentials set has been updated. Response doesn't have a body.

400ErrorEnvelope

Failed. The input is invalid

Response body objects

The CredentialsResponseElement object

Metadata of the credentials set.

ElementTypeDescription
namestring

The name of the credentials set.

idstring

The ID of the credentials set.

Can be null.

typestring

The type of the credentials set.

The element can hold these values
  • CERTIFICATE
  • PUBLIC_CERTIFICATE
  • TOKEN
  • UNKNOWN
  • USERNAME_PASSWORD
descriptionstring

A short description of the credentials set.

ownerstring

The owner of the credential (user for which used API token was created).

ownerAccessOnlyboolean

Flag indicating that this credential is visible only to the owner.

scopestring

The scope of the credentials set.

The element can hold these values
  • ALL
  • EXTENSION
  • SYNTHETIC

Can be null.

externalVaultExternalVaultConfig

Configuration for external vault synchronization for username and password credentials.

Can be null.

credentialUsageSummaryCredentialUsageHandler[]

The list contains summary data related to the use of credentials.

The ExternalVaultConfig object

Configuration for external vault synchronization for username and password credentials.

ElementTypeDescription
sourceAuthMethodstring

Defines the actual set of fields depending on the value. See one of the following objects:

  • HASHICORP_VAULT_APPROLE -> HashicorpApproleConfig
  • HASHICORP_VAULT_CERTIFICATE -> HashicorpCertificateConfig
  • AZURE_KEY_VAULT_CLIENT_SECRET -> AzureClientSecretConfig
The element can hold these values
  • AZURE_KEY_VAULT_CLIENT_SECRET
  • HASHICORP_VAULT_APPROLE
  • HASHICORP_VAULT_CERTIFICATE

Can be null.

vaultUrlstring-

Can be null.

usernameSecretNamestring-

Can be null.

passwordSecretNamestring-

Can be null.

tokenSecretNamestring-

Can be null.

credentialsUsedForExternalSynchronizationstring[]-

Can be null.

typestring-
The element can hold these values
  • AZURE_CERTIFICATE_MODEL
  • AZURE_CLIENT_SECRET_MODEL
  • HASHICORP_APPROLE_MODEL
  • HASHICORP_CERTIFICATE_MODEL

Can be null.

The CredentialUsageHandler object

Keeps information about credential's usage.

ElementTypeDescription
typestring

Type of usage.

Can be null.

countinteger

The number of uses.

Can be null.

Response body JSON model

json
{ "name": "Sample username-password credentials", "id": "CREDENTIALS_VAULT-C43F2C2E6395AD23", "type": "USERNAME_PASSWORD", "description": "Sample credentials for demo purposes.", "owner": "user@domain.com", "ownerAccessOnly": "true", "scope": "SYNTHETIC", "externalVault": { "sourceAuthMethod": "HASHICORP_VAULT_APPROLE", "vaultUrl": "https://vault-cluster.vault.fb17d2fc-be92-4230-afa2-91dbfda3cbad.aws.hashicorp.cloud:8200", "usernameSecretName": "username", "passwordSecretName": "password", "pathToCredentials": "kv/credentials", "roleId": "00e4858c-ec33-bc99-4e7e-34de6967de6c", "secretId": "CREDENTIALS_VAULT-XXXXXXXXXXXXXXXX", "vaultNamespace": "admin" }, "credentialUsageSummary": [ { "HTTP_MONITOR": 3, "BROWSER_MONITOR": 2 } ] }

Example

In this example, the request updates the set of credentials created in the POST request example.

It changes the username to mary.brown and the password to 4321dcba.

The API token is passed in the Authorization header.

You can download or copy the example request body to try it out on your own.

Curl

shell
curl -X PUT \ https://mySampleEnv.live.dynatrace.com/api/config/v1/credentials/CREDENTIALS_VAULT-1E6EA5075AF7E85D \ -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \ -H 'Content-Type: application/json' \ -d '{ "name": "RESTtest", "description": "Test credentials", "password": "4321dcba", "ownerAccessOnly": true, "type": "USERNAME_PASSWORD", "user": "mary.brown" }'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/config/v1/credentials/CREDENTIALS_VAULT-1E6EA5075AF7E85D

Request body

json
{ "name": "RESTtest", "description": "Test credentials", "password": "4321dcba", "ownerAccessOnly": true, "type": "USERNAME_PASSWORD", "user": "mary.brown" }

Response code

204

Related topics
  • Configure browser monitors

    Learn about configuring browser monitors and clickpaths.

  • Configure HTTP monitors

    Learn about configuring HTTP monitors.