Create a secret

To create a new API secret, you must send a POST request to the secret management API.

New API secrets must meet the following rules:

  • Minimum 8 characters
  • Maximum 25 characters
  • Minimum 1 lower case character
  • Minimum 1 upper case character
  • Minimum 1 digit
KeyDescription
VONAGE_API_KEY

Your Vonage API key (see it on your dashboard).

VONAGE_API_SECRET

Your Vonage API secret (also available on your dashboard).

NEW_SECRET

The new API secret for the API key.

Write the code

Add the following to create-secret.sh:

curl -X POST "https://api.nexmo.com/accounts/$ACCOUNT_ID/secrets" \
     -H 'Content-Type: application/json' \
     -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
     -d '{"secret":"'$ACCOUNT_SECRET_VALUE'"}'

View full source

Run your code

Save this file to your machine and run it:

bash create-secret.sh