API Access

Hello Team,

How can I configure read-only API access for Bearer to retrieve a list of all instances, including information such as instance OS details and the instance owner’s email ID? The API key should have read-only access only. Please assist.

Create a service account with the role permssions needed, impersonate the user and grab their access token. The API honours the role permissions as shown below.

curl -k --request GET \ 
     --url https://morpheuslab/api/networks \
     --header 'accept: application/json' \
     --header 'authorization: Bearer 461d14a5-78xxxxxxxxxx5d218c44fb5'  
{"success":false,"msg":"You do not have permissions to access this api endpoint"}

Thanks I got it but now confusion is which access permissions i need to select in the role for my requirement and there are many. If you can guide me on that would be really helpful. I am on Morpheus version 6.0.5. Thanks in advance.

You could set everything to Read only to remove write access over API. Or, if you want to do it granularly set all access to None and start with Features > Provisioning > Instance - List with Read permission. I haven’t tested but that would be a good first step given the data you want.