Credential vault API - POST a set of credentials

Creates a new set of credentials for synthetic monitors.

The request consumes and produces an application/json payload.

Early Adopter

This request is an Early Adopter release and may be changed in non-compatible way.

POST
  • Managed https://{your-domain}/e/{your-environment-id}/api/config/v1/credentials
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/credentials

Authentication

To execute this request, you need the Write credential vault entries (credentialVault.write) permission assigned to your API token. 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.

Parameter Type Description In Required
body Credentials

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

body optional

The Credentials object

A set of credentials for synthetic monitors.

Element Type Description Required
name string

The name of the credentials set.

required
id string

The ID of the credentials set.

optional
description string

A short description of the credentials set..

required
ownerAccessOnly boolean

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

optional
type string

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

  • CERTIFICATE -> CertificateCredentials
  • USERNAME_PASSWORD -> UserPasswordCredentials
  • TOKEN -> TokenCredentials
The type element can hold these values.
optional

Possible values

Possible values for the type element in the Credentials object:

  • CERTIFICATE
  • TOKEN
  • USERNAME_PASSWORD

Response format

The CredentialsResponseElement object

Metadata of the credentials set.

Element Type Description
name string

The name of the credentials set.

id string

The ID of the credentials set.

type string

The type of the credentials set.

The type element can hold these values.
description string

A short description of the credentials set.

owner string

The owner of the credential.

ownerAccessOnly boolean

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

Possible values

Possible values for the type element in the CredentialsResponseElement object:

  • CERTIFICATE
  • TOKEN
  • UNKNOWN
  • USERNAME_PASSWORD

Example

In this example, the request creates a new set of credentials of the USERNAME_PASSWORD type. The username of the credentials set is john.smith and the password is abcd1234.

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

curl -X POST \
  https://mySampleEnv.live.dynatrace.com/api/config/v1/credentials/ \
  -H 'Authorization: Api-token abcdefjhij1234567890' \
  -H 'Content-Type: application/json' \  
  -d '{
  "name": "RESTtest",
  "description": "Test credentials",
  "password": "abcd1234",
  "ownerAccessOnly": true,
  "type": "USERNAME_PASSWORD",
  "certificate": "john.smith"
}'

Request URL

https://mySampleEnv.live.dynatrace.com/api/config/v1/credentials/

Request body

Download
{
  "name": "RESTtest",
  "description": "Test credentials",
  "password": "abcd1234",
  "ownerAccessOnly": true,
  "type": "USERNAME_PASSWORD",
  "user": "john.smith"
}

Response body

{
  "id": "CREDENTIALS_VAULT-1E6EA5075AF7E85D"
}

Response code

200