Resources API Change logs
Change logs
Overview
Change logs provide audit history for resource modifications. Each change log entry captures the differences between the previous and updated state of a resource, enabling compliance tracking, debugging, and understanding the evolution of resource configurations over time.
Change log entries track:
- What fields were changed
- Previous and new values for each changed field
- When the change occurred
- Which admin user made the change
Availability
Change log retrieval is currently available for the Campaign resource. This functionality will be enabled for other resources in future releases.
Endpoint
GET /resources/{resource name}/{id}/change_log
Retrieve change log entries for a specific resource instance.
Authentication and Required Headers
Change log retrieval requires admin authentication with READ access to the chain that owns the resource. All standard Required Headers must be included in the request.
The endpoint will return a resource_not_found error if:
- The resource does not exist
- The resource belongs to a different chain than specified in the
X-Spaaza-Chain-IDheader - The authenticated admin user does not have READ access to the chain
Pagination and Sorting
This endpoint supports limit, offset, sort_by, and sort_order parameters with the same semantics as the Retrieving Multiple Resources section. The default sort order is by created_date in descending order (most recent first).
Sortable fields:
created_date- When the change log entry was created (default)last_modified_date- When the change log entry was last modified
Response Structure
The response contains the following fields:
| Field | Description | Type |
|---|---|---|
result_type | Always model-change-logs for change log responses | string |
offset | Starting position of results returned | integer |
limit | Maximum number of results returned | integer |
total_count | Total number of change log entries available | integer |
resources | Array of change log entry objects | array |
Change Log Entry Properties
Each change log entry in the resources array contains:
| Property | Description | Type |
|---|---|---|
id | Unique identifier for the change log entry | integer |
model_class | Model class name (e.g., Campaign for campaign change logs; other resources will show their respective class) | string |
model_id | ID of the resource that was modified | integer |
changed_by | Admin user ID who made the change | integer |
change_endpoint | Canonical API path (if any) that triggered the change (e.g., internal/alter-campaign) | string |
diff | Object containing the differences between old and new values | object |
created_date | Timestamp when the change log entry was created | datetime |
last_modified_date | Timestamp when the change log entry was last modified | datetime |
Diff Object Structure
The diff object contains the changes made to the resource. Each changed field appears as a property in the diff object with the following structure:
{
"field_name": {
"from": "previous value",
"to": "new value"
}
}
The from and to values reflect the field's native type (string, number, boolean, object, or null). Either value can be null, for example when a field is newly set or cleared:
{
"field_name": {
"from": null,
"to": "new value"
}
}
For example, if a resource's title was changed from "Summer Sale" to "Summer Sale 2025", the diff would contain:
{
"title": {
"from": "Summer Sale",
"to": "Summer Sale 2025"
}
}
Example Request
curl -X GET "https://api0.spaaza.com/resources/{resource name}/{id}/change_log?limit=10&offset=0&sort_by=created_date&sort_order=desc" \
-H "X-Spaaza-Chain-ID: {chain_id}" \
-H "X-Spaaza-API-version: 1.6.1" \
-H "X-Spaaza-Session-User-ID: {your user ID}" \
-H "X-Spaaza-Session-Key: {your key}" \
-H "X-Spaaza-Response-Recursion-Level: 3"
Example Response
{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"limit": 50,
"offset": 0,
"resources": [
{
"changed_by": 2,
"change_endpoint": "internal/alter-campaign",
"created_date": "2025-10-31 19:41:39",
"diff": {
"last_updated_date": {
"from": null,
"to": "2025-10-31T19:41:39+00:00"
},
"title": {
"from": "Vanilla Loyalty Campaign",
"to": "Vanilla Loyalty Campaign updated"
}
},
"id": 1,
"last_modified_date": "2025-10-31 19:41:39",
"model_class": "Campaign",
"model_id": 2
}
],
"result_type": "model-change-logs",
"total_count": 1
}
}
This example shows a change log entry for a campaign where the title was updated and the last_updated_date field was set for the first time (note the null value in from). The response includes the standard result wrapper with status information, and timestamps in the change log entries use the format YYYY-MM-DD HH:MM:SS. Values within the diff object preserve the field's native format (e.g., ISO 8601 with timezone for date fields).