> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chamelio.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Clickwrap History

> Retrieve the published version history for a clickwrap slug using an OAuth access token, including timestamps and archived content for compliance audits.

> [!TIP]
>
> Adding Clickwrap to your website or app? [Embed a clickwrap in your website or app](https://docs.chamelio.ai/guides/integrations/embed-clickwrap.md) walks through it step by step with the browser SDK. Use this endpoint from your server.

## Endpoint

```
GET /v2/server/clickwrap/{slug}/history
```

## Authentication

This endpoint requires an OAuth access token. Send it as a bearer token:

```bash theme={null}
Authorization: Bearer your_access_token
```

**Required scope:** `clickwrap:read`

> [!NOTE]
>
> Clickwrap is the one `/v2` surface with no acting user. The subject of a clickwrap event is
> `user_identifier`, an opaque string you supply for your own end user, which is never resolved
> against Chamelio's users. These endpoints are authorized by organization and scope alone, so
> `client_credentials` tokens work here without restriction.

## Path Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `slug` | string | Yes | Unique identifier for the clickwrap |

## Request Example

```bash cURL theme={null}
curl -X GET "https://platform.chamelio.ai/v2/server/clickwrap/privacy-policy/history" \
  -H "Authorization: Bearer your_access_token"
```

```python Python theme={null}
import requests

slug = "privacy-policy"

url = f"https://platform.chamelio.ai/v2/server/clickwrap/{slug}/history"
headers = {
    "Authorization": "Bearer your_access_token"
}

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

```javascript JavaScript theme={null}
const slug = "privacy-policy";

const response = await fetch(
  `https://platform.chamelio.ai/v2/server/clickwrap/${slug}/history`,
  {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer your_access_token'
    }
  }
);

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

## Response

### Success Response

**Status Code:** `200 OK`

```json theme={null}
{
  "slug": "privacy-policy",
  "versions": [
    {
      "clickwrap_version_id": 42,
      "clickwrap_id": 7,
      "version": 3,
      "content": "By clicking Accept, you agree to our updated Privacy Policy...",
      "content_html": "<p>By clicking Accept, you agree to our updated Privacy Policy...</p>",
      "is_draft": false,
      "archived_at": null,
      "created_at": "2026-05-01T09:00:00Z",
      "updated_at": "2026-05-01T09:00:00Z"
    },
    {
      "clickwrap_version_id": 31,
      "clickwrap_id": 7,
      "version": 2,
      "content": "By clicking Accept, you agree to our Privacy Policy...",
      "content_html": "<p>By clicking Accept, you agree to our Privacy Policy...</p>",
      "is_draft": false,
      "archived_at": "2026-05-01T09:00:00Z",
      "created_at": "2026-01-15T08:00:00Z",
      "updated_at": "2026-05-01T09:00:00Z"
    }
  ]
}
```

### Response Fields

| Field | Type | Description |
| - | - | - |
| `slug` | string | Unique clickwrap identifier |
| `versions` | array | All published (non-draft) versions, newest first |

### Version Object Fields

| Field | Type | Description |
| - | - | - |
| `clickwrap_version_id` | integer | Internal identifier for this version |
| `clickwrap_id` | integer | Internal identifier for the parent clickwrap |
| `version` | integer | Sequential version number |
| `content` | string | Stored content of this version, with template placeholders unchanged |
| `content_html` | string or null | Stored sanitized HTML of this version, with template placeholders unchanged |
| `is_draft` | boolean | Always `false` - this endpoint only returns published versions |
| `archived_at` | string or null | ISO 8601 timestamp when this version was superseded, or null if it is the current active version |
| `created_at` | string | ISO 8601 timestamp when this version was created |
| `updated_at` | string | ISO 8601 timestamp of the last update to this version |

## Error Responses

### 401 Unauthorized

Returned when the access token is missing, unknown, revoked, or expired, or when an `X-API-Key` was
sent instead of a bearer token. See [OAuth error responses](https://docs.chamelio.ai/api-reference/oauth-apps.md#error-responses).

```json theme={null}
{
  "detail": "Invalid access token"
}
```

### 403 Forbidden

Returned when the token does not carry the required scope.

```json theme={null}
{
  "detail": "Insufficient scope; this endpoint requires: clickwrap:read"
}
```

### 404 Not Found

Returned when no clickwrap exists for the given slug.

```json theme={null}
{
  "detail": "Not found"
}
```

### 429 Too Many Requests

Returned when your organization exceeds its per-minute request limit.

```json theme={null}
{
  "detail": "Rate limit exceeded"
}
```

### 500 Internal Server Error

Returned when the request fails due to a server error.

```json theme={null}
{
  "detail": "Failed to fetch clickwrap history"
}
```

## Notes

> [!NOTE]
>
> Draft versions are never included in this response. Only versions that have been published (activated) are returned.

> [!NOTE]
>
> The result is organization-global. Every token issued for the same organization gets the same
> answer - the token's user is used only to authenticate and scope-check the request.

> [!TIP]
>
> Use `archived_at` to distinguish the currently active version (where `archived_at` is null) from older superseded versions.

## Use Cases

This endpoint is useful for:

* **Compliance auditing** - Retrieve the published template for a given `clickwrap_version_id`. For personalized agreements, use [Search Clickwrap Events](https://docs.chamelio.ai/api-reference/endpoint/v2/clickwrap/search-events.md) to retrieve the captured variables and acceptance PDF reference
* **Re-consent detection** - Compare the user's last accepted `version_number` against the full history to determine if they need to re-accept
* **Change logging** - Display a changelog of terms updates to end users
