# Get Issue History

Get a history of changes applied to a specific issue using the YouTrack REST API.

## Summary

To read the change history for a specific issue, send a `GET` request to the issue activities endpoint:

```
/api/issues/{issueID}/activities
```

## Request Parameters

The collection of historical changes is accessible using a single request. To return the activity items you need, pay attention to the parameters you add to the request:

* `categories` — this mandatory parameter filters for specific types of historical changes. Specify at least one category for each request. For a list of supported categories, see [ActivityCategory](api-entity-ActivityCategory.html).

* `fields` — this parameter lists the attributes that you want the server to return in response. For issue history items, we recommend that you ask for the following attributes: * `author` to see who applied the change. * `added` to see what values were added to the issue. * `removed` to see what values were removed from the issue. The list of supported attributes differs based on the type of activity that you request with the `categories` parameter. For a list of supported activity items and their attributes, see [ActivityItem](api-entity-ActivityItem.html).

* `{issue ID}` represents the unique ID of the target issue. You can identify the issue by its entity ID, for example `2-32`, or human-readable ID, for example `SP-32`.

As the entire issue history is accessible using a single request, this use case doesn't require step-by-step instructions.

## Additional Information

This endpoint returns activity for one issue. To get activity items authored by a specific user across multiple issues, use [GET Activity Items](resource-api-activities.html#get_all-ActivityItem-method) with the `author` parameter and, optionally, `issueQuery` to limit the matching issues. For example:

```
/api/activities?categories=CustomFieldCategory,CommentsCategory&author=jane.doe&issueQuery=project:%20SP&fields=id,author(name,login),timestamp,target(id),added(name),removed(name)
```

If you want to monitor this information in YouTrack without using the REST API, use an [Issue Activity Feed widget](https://www.jetbrains.com.cn/en-us/help/youtrack/server/issue-activity-feed-widget.html) and set the Change author filter.

## Sample Request

In this sample request, we instruct the server to read the change history for the issue 'SP-32' and return a list of changes that match the following categories:

* `CustomFieldCategory` — the collection of changes applied to custom fields in the target issue.

* `CommentsCategory` — changes applied to comments in this issue.

As for the attributes, let's request those that we recommended above: `author`, `added`, and `removed`. In addition, let's request the `timestamp` attribute so we know when these changes were applied. To get more data for the comment activity items, let's also specify the `target(id,text)` attribute. It will get you the comment IDs and text.

In the end, our `fields` parameter looks as follows:

```PLAINTEXT
fields=author(name,login),timestamp,target(id,text),added(name),removed(name)
```

Here's the complete request:

```CURL
curl -L -X GET 'https://example.youtrack.cloud/api/issues/SP-32/activities?categories=CustomFieldCategory,CommentsCategory&fields=author(name,login),timestamp,target(id,text),added(name),removed(name)' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YouTrack_token>'
```

In response, the server would return the following data:

```JSON
[
    {
        "added": [
            {
                "name": "Sprint 1",
                "$type": "VersionBundleElement"
            }
        ],
        "removed": [],
        "author": {
            "login": "jane.doe",
            "name": "Jane Doe",
            "$type": "User"
        },
        "timestamp": 1644916724088,
        "$type": "CustomFieldActivityItem"
    },
    {
        "author": {
            "login": "jane.doe",
            "name": "Jane Doe",
            "$type": "User"
        },
        "added": [
            {
                "$type": "IssueComment"
            }
        ],
        "removed": [],
        "timestamp": 1647869116494,
        "target": {
            "text": "made new tweaks according to the latest requirements -- @john.smith please verify",
            "id": "136-261",
            "$type": "IssueComment"
        },
        "$type": "CommentActivityItem"
    },
    {
        "added": [
            {
                "name": "Fixed",
                "$type": "StateBundleElement"
            }
        ],
        "removed": [
            {
                "name": "Open",
                "$type": "StateBundleElement"
            }
        ],
        "author": {
            "login": "jane.doe",
            "name": "Jane Doe",
            "$type": "User"
        },
        "timestamp": 1648110830229,
        "$type": "CustomFieldActivityItem"
    }
]
```

