We can get the usage for a secret from api in the below indirect steps.
First retrieve the secretId using the graphql query as below:
query{
secretByName(name:"anz-csr-reader",secretType:ENCRYPTED_TEXT){
... on EncryptedText{
id
name
secretManagerId
}
}
}
After we have acquired secretId , we can use it in the below api call to get the usage or where the secret is being referenced.
curl 'https://app.harness.io/gateway/api/secrets/list-setup-usage?accountId=<ACCOUNT_ID>&uuid=<SECRET_ID>' \
-H 'authorization: Bearer <TOKEN>' \
--compressed
We need to substitute the accountID for the account where secret has been created.