Add approval version API endpoints
Description
API Changes (public Web API v2; the UI part shipped in AP-2052)
-
Endpoint: Get approval versions
GET /webapi/v2/approvals/{approvalId}/versions
Response should include:
-
active version
-
list of all versions with basic metadata
Example response:
{"approvalId": "123","activeVersion": 7,"versions": [{"version": 7,"createdAt": "2026-03-02T10:07:14Z","userId": "abc","changeReason": "Custom field value changed: cf_10010"},{"version": 6,"createdAt": "2026-02-28T12:01:00Z","userId": "def","changeReason": "Manual edit"}]}
-
Endpoint: Get approval version details
GET /webapi/v2/approvals/{approvalId}/versions/{version}
Returns full details for the selected approval version, in the same shape as GET /webapi/v2/approvals/{approvalId}.
Decisions
-
Both endpoints need the Approval: Read key privilege and the same access as
GET /webapi/v2/approvals/{approvalId}. An unknown or unreadable approval answers like GET approval;Approval version not foundonly after access passes. -
A new version is created only when the approvers of a running approval change (step reassignment, dynamic field update). Decisions, priority or validity changes update the current version.
-
From this release each new approval version stores who made the change, and why when the change has a description (
approval_config.changed_by,change_reason). The Web API returns them asuserIdandchangeReason;changeReasonis null for a change without a description (for example an approver removed by a field update or a group member change), as in the Activity history. Older versions returnuserIdnull, except version 1, which shows who started the approval; theirchangeReasonis rebuilt from the step history on a best-effort basis.
Manual tester notes
-
In the app's API keys page, create a key with Approval: Read.
-
In a definition, add a User approver step with Allow change of the user during the process, and start an approval.
-
Call
GET /webapi/v2/approvals/{id}/versionswithAuthorization: Bearer <key>: activeVersion 1, one version with your account id and no change reason. -
In the approval panel, change the active step's approver. Call it again: activeVersion 2, version 2 listed first with your account id and a reason like Approver updated from X to Y by Z.
-
.../versions/1shows the old approver,.../versions/2the new one;.../versions/99and an unknown approval id return 404. -
A key without Approval: Read gets 403. A key that cannot see the work item or page gets the same not-found as GET approval for
.../versions/2. -
Jira: change a work item user field that drives a dynamic approver step. A new version appears with the account id of the person who edited the field.
-
Approve a step: no new version appears in
/versions. -
Both endpoints appear in the Jira and the Confluence API documents.