Hi all
i am trying to use a Jira service account to perform API calls with Jira automation rules.
https://developer.atlassian.com/cloud/automation/rest/intro/#about
Using the service account, i created API token credential. i granted all Jira classic scopes to this API token but keep getting the following error.
{"code":401,"message":"Unauthorized; scope does not match"}
can anyone advise what could be the issue?
Hi @Wills Seet ,
This is a common issue and you're on the right track! The issue is likely: (1) using site REST URLs instead of the Atlassian API gateway for scoped auth, or (2) missing the exact "manage:jira-automation" scope.
1. Confirm/Regenerate Token with Precise Scope:
Note the cloud ID (from https://api.atlassian.com/ex/jira/{cloudId}/rest/automation/2.0/... -> get it via GET /rest/api/2/myself with a working token).
2. Use the Correct Endpoint & Auth:
I hope the below links are helpful for you:
Hope everything works well for you.
Best,
Peter
Hi Peter,
could you please advise where would i locate manage:jira-automation. when i select granular scopes, i couldn't find this particular scope at all.
appreciate your assistance. thanks
Also, in the documentation guide
https://developer.atlassian.com/cloud/automation/rest/api-group-rule-management/#api-rest-v1-rule-ruleuuid-get
The url format to be used indicated is as such.
https://api.atlassian.com/automation/public/{product}/{cloudid}/rest/v1/rule/{ruleUuid}
but you mentioned that the based url to be https://api.atlassian.com/ex/jira/{cloudId}/rest/automation/2.0/
In this case, what should the format of the url to get the rule by rule uuid?
Hi @Wills Seet , 1) I apologize for the mix-up—it's actually named "manage:jira-configuration" This granular scope allows CRUD on automation rules without over-privileging. (Reference: Jira scope for OAuth 2.0 / API token scope from Jira REST API).
Where to find it:
2) You're right! The docs use the site-direct format for API tokens (Basic Auth: email:token base64-encoded). My earlier /ex/jira/ suggestion is for OAuth 2.0 (3LO) apps only:
Full Endpoint: https://{your-site}.atlassian.net/rest/automation/latest/rule/{ruleUuid} (use /latest or /2.0 for stability; /v1 is legacy).
Example cURL (You should replace placeholders):
No Cloud ID needed here (that's for /ex/ paths). If you get 401 again, confirm the token's scope includes config management and the service account has Jira admin perms.
Hope the links below are helpful for you and work well for you:- Endpoints & Auth
It looks like you're new here. Sign in or register to get started.