> ## 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 full published version history for a clickwrap slug, including timestamps, publishers, and archived content for compliance audits.

## Endpoint

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

## Authentication

This endpoint requires authentication via API key. Include your API key in the `X-API-Key` header:

```bash theme={null}
X-API-Key: ca_your_api_key_here
```

## 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/server/clickwrap/privacy-policy/history" \
  -H "X-API-Key: ca_your_api_key_here"
```

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

slug = "privacy-policy"

url = f"https://platform.chamelio.ai/server/clickwrap/{slug}/history"
headers = {
    "X-API-Key": "ca_your_api_key_here"
}

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/server/clickwrap/${slug}/history`,
  {
    method: 'GET',
    headers: {
      'X-API-Key': 'ca_your_api_key_here'
    }
  }
);

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 authentication fails. See the [authentication errors](https://docs.chamelio.ai/api-reference/api-keys.md#authentication-errors) section for details.

```json theme={null}
{
  "detail": "Invalid API key"
}
```

### 404 Not Found

Returned when no active clickwrap exists for the given slug.

```json theme={null}
{
  "detail": "Clickwrap 'privacy-policy' not found"
}
```

### 500 Internal Server Error

Returned when the request fails due to a server error.

```json theme={null}
{
  "detail": "Internal server error"
}
```

## Notes

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

> [!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 [v2 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
