How to get the list of credentialsId of Jenkins by rest api

I’ve already read “Create Job Dynamically in Jenkins” QnA, and known how to get the information for a known credentialsId in xml format by “http://your_jenkins/credentials/store/system/domain/_/credential/503bcfce-4197-488d-be45-456623876087/api/xml” rest api.

But I want to get the total credentialsId list by rest api.

  • How to securely save git credentials?
  • Git: Failed to erase credential: Element not found tried all other solutions
  • Creating a job with credentials in jenkins only in command lines
  • How do I force git NOT to prompt for credentials
  • TortoiseGit asking password after it was changed
  • git credential fill rejects my input
  • Please let me know how to do that if you know that.

  • How to resolve stderr: fatal: Not a valid object name HEAD in jenkins?
  • How to install Jenkins on WebSphere 8.5
  • Jenkins build only one branch that has been pushed
  • git plugin for Jenkins fails to clone a repo from local machine. Error code 128
  • Jenkins Sonar Job aborted by anonymous. Weird job build behaviour
  • Jenkins set a badge as a pre-build step
  • One Solution collect form web for “How to get the list of credentialsId of Jenkins by rest api”

    I’ve finally inferred an answer from the following post: update Jenkins credentials by script

    Thank you for “Thomasleveil”.

    The procedure is as followings:

    1) Install Scriptler plugin and restart Jenkins server.

    2) Click Scriptler in side menu.

    3) Click Add a new Script.

    4) Fill the form.

    enter image description here

    The script is from “”, but run itself straightly and you can see the error messages: “groovy.lang.MissingPropertyException: No such property: Jenkins for class: Script1 … “.

    This error has solved at “Running Groovy command from Jenkins using Groovy script plugin” post.

    So your script is like:

    import jenkins.model.Jenkins
    def creds =
    for (c in creds) {
    println( + ": " + c.description)

    5) Type “http://your_jenkins/scriptler/run/getCredentialsIdList.groovy” in your browser url bar.

    You can see the list of total credentialsIds from your jenkins server.

    Enjoy that ~~~

    Git Baby is a git and github fan, let's start git clone.