- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.
03-09-2026 07:26 AM
I'm trying to retrieve a list of all application groups in a set from the EPM API using Python. Unfortunately, the API is repeatedly throwing a 404 error and I can't tell if its because of an error in the URL I'm using, or if there is some sort of authentication issue going on in the back end.
I'm using CyberArk Identity for authentication. Code is as follows:
data = {
'grant_type': 'client_credentials'
}
token = requests.post(
url='https://<ID>.id.cyberark.cloud/oauth2/token/<webapp>',
data=data,
auth=(f"{<username>}@cyberark.cloud.<otherID>", <password>)
)
auth_header = 'Bearer ' + token["access_token"]
self.headers = {
'authorization': auth_header,
'content_type': 'application/json'
}
Note that I'm using authorization "Bearer" instead of "Basic" as defined at the bottom of this page: https://docs.cyberark.com/epm/26.3.0/en/content/webservices/authenticate-with-identity-administration.htm
From there, I'm successfully able to pull a list of sets using this code:
requests.get(
url=f'{self.url}/epm/api/sets',
headers=self.headers,
)Following this documentation: https://docs.cyberark.com/epm/26.3.0/en/content/webservices/getsetslist.htm
This seems to indicate that authentication is working as expected. Using this, I'm able to retrieve set IDs, which I use in the following code:
requests.post(
url=f'{self.url}/EPM/API/Sets/{set_id}/Policies/ApplicationGroups/Search',
json={},
headers=self.headers
)Following this documentation: https://docs.cyberark.com/epm/26.3.0/en/content/webservices/getappgroups.htm
And this is what returns a 404.
I'm confused as to why this is happening.
I can't find any issue with the URL, and authentication seems to be working earlier in the script. Any advice?
03-09-2026 12:12 PM
I was able to find a solution. It was a permissions issue.
Despite defining a custom permissions group that seemed to have the exact same permissions as Full Control Set Admin, it apparently did not have the same permissions. By swapping the role permissions assignment to Full Control Set Admin, I was able to retrieve the information I was looking for. I don't know if that's an intentional design choice, or if I just made a mistake somewhere along the line. Either way, it's working now.
Thanks for the help, Robert!
03-09-2026 08:54 AM
Is that literally in your URL
Should it be
serviceuser@<your-tenant-domain> ([email protected].<otherID>).
03-09-2026 09:26 AM
"cyberark.cloud.#####" is literally in the URL, with the number being a specific string.
Could you give an example of what the tenant domain would be expected to look like? Is it the 7-digit ID shown displayed the top right corner of Identity? EG: ADF5987 in the "Setting up API Auth" document page? Is it the EPM server name, IE "na101"? Or would it be something else?
03-09-2026 09:57 AM
Are you using this exact script
url='https://<ID>.id.cyberark.cloud/oauth2/token/
or
https://<ID-subdomain>.id.cyberark.cloud/oauth2/token/<webapp-alias> where ID-subdomain is used
03-09-2026 10:04 AM
I am using:
"https://<ID>.id.cyberark.cloud/oauth2/token/<webapp-alias>"
where <ID> is the Cyberark Identity id that can be retrieved from the "about" menu in Step 5. of the Identity API documentation
and <webapp-alias> is the alias given to the web app during creation in Identity.
03-09-2026 10:44 AM
I did verify the tenant domain. In identity, it was set with a different domain name (cloud.cyberark.####) which is why it was properly authenticating with the configuration above. I've swapped it to a normal domain name, but that hasn't had any effect on the 404 errors I've been seeing.
03-09-2026 12:12 PM
I was able to find a solution. It was a permissions issue.
Despite defining a custom permissions group that seemed to have the exact same permissions as Full Control Set Admin, it apparently did not have the same permissions. By swapping the role permissions assignment to Full Control Set Admin, I was able to retrieve the information I was looking for. I don't know if that's an intentional design choice, or if I just made a mistake somewhere along the line. Either way, it's working now.
Thanks for the help, Robert!
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

