v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1422123151.4 KB

Lists the versions of a secret. Secrets Manager uses staging labels to indicate the different versions of a secret. For more information, see Secrets Manager concepts: Versions.

To list the secrets in the account, use ListSecrets.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see Logging Secrets Manager events with CloudTrail.

Required permissions: secretsmanager:ListSecretVersionIds. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.

post/#X-Amz-Target=secretsmanager.ListSecretVersionIds

Query parameters

MaxResultsstring

Pagination limit

NextTokenstring

Pagination token

Headers

X-Amz-Target'secretsmanager.ListSecretVersionIds' required

Request body

SecretIdstring required
<p>The ARN or name of the secret whose versions you want to list.</p> <p>For an ARN, we recommend that you specify a complete ARN rather than a partial ARN. See <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/troubleshoot.html#ARN_secretnamehyphen">Finding a secret from a partial ARN</a>.</p>
MaxResultsinteger
<p>The number of results to include in the response.</p> <p>If there are more results available, in the response, Secrets Manager includes <code>NextToken</code>. To get the next results, call <code>ListSecretVersionIds</code> again with the value from <code>NextToken</code>. </p>
NextTokenstring

A token that indicates where the output should continue from, if a previous call did not show all results. To get the next results, call <code>ListSecretVersionIds</code> again with this value.

IncludeDeprecatedboolean

Specifies whether to include versions of secrets that don't have any staging labels attached to them. Versions without staging labels are considered deprecated and are subject to deletion by Secrets Manager. By default, versions without staging labels aren't included.

Response

Success

NextTokenstring

Secrets Manager includes this value if there's more output available than what is included in the current response. This can occur even when the response includes no values at all, such as when you ask for a filtered view of a long list. To get the next results, call <code>ListSecretVersionIds</code> again with this value.

ARNstring

The ARN of the secret.

Namestring

The name of the secret.

Example response

{
  "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
  "Name": "MyTestDatabaseSecret",
  "Versions": [
    {
      "CreatedDate": 1523477145.713,
      "VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE",
      "VersionStages": [
        "AWSPREVIOUS"
      ]
    },
    {
      "CreatedDate": 1523486221.391,
      "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
      "VersionStages": [
        "AWSCURRENT"
      ]
    },
    {
      "CreatedDate": 1511974462.36,
      "VersionId": "EXAMPLE3-90ab-cdef-fedc-ba987EXAMPLE;"
    }
  ]
}