# List sync job template versions

> Source: https://truto.one/docs/api-reference/admin/sync-job-templates/list-versions/

`GET /sync-job-template/{id}/versions`

Resource: **Sync job templates**

Every saved version of the sync job template, newest first, without their content.

Each save through `PATCH /sync-job-template/{id}` that changes a tracked field records a new version, with who made it and the optional `change_message` sent in its body. The first recorded save also stores the state before it as a `baseline`. A version stored before version history existed has the source `legacy` and no author; its `recorded_at` is when it was replaced, not when it was made. When the sync job template was changed without recording a version, its live state is listed as the next version, `untracked`, and is current.

Only a caller who can edit the sync job template can read its history.

## Path parameters

- **`id`** _(string, required)_
  The object's ID.

## Response body

- **`result`** _(array<object>)_
  - **`version`** _(integer)_
  - **`source`** _(string)_
    `save` and `restore` were written by a save. `baseline` is the state found before the first recorded save. `untracked` is a state found before a save that no recorded version matched: the object was changed without recording a version. `legacy` was stored before version history existed. The last three have no author.
    Allowed: `save`, `restore`, `baseline`, `untracked`, `legacy`
  - **`recorded_at`** _(string)_
  - **`actor`** _(object)_
    - **`type`** _(string)_
      How the author authenticated, for example `session` or `api_token`.
    - **`id`** _(string)_
      The user's ID, or for `api_token` the token's ID.
    - **`name`** _(string)_
    - **`impersonated_by_staff`** _(boolean)_
  - **`message`** _(string)_
    The change note. In a listing, a note too long to store with the version's metadata is a shortened preview ending in `…`, and `message_truncated` is true; getting that one version returns it whole.
  - **`message_truncated`** _(boolean)_
    True when `message` is a shortened preview of a longer note.
  - **`restored_from_version`** _(integer)_
  - **`is_current`** _(boolean)_
- **`current_version`** _(integer)_
  The version the object is at now.
- **`tracked_fields`** _(array<string>)_
  The fields a version holds, compares and restores.

## Errors

| Status | Description |
| :----- | :---------- |
| `404` | No such sync job template, or the caller cannot edit it. |

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/sync-job-template/{id}/versions' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.truto.one/sync-job-template/{id}/versions', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/sync-job-template/{id}/versions"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```
