> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/api-reference/query-analytics-and-operations/monitoring-and-reporting/resource-history.md).

# Resource History

Operations for searching the history of indexed platform resources.

## GET /resource\_history/resource\_type={resource\_type}/resource\_id={resource\_id}

> Get the raw history (ie. events are not sorted) of a resource (for the current month)

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Resource History","description":"Operations for searching the history of indexed platform resources."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/resource_history/resource_type={resource_type}/resource_id={resource_id}":{"get":{"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/ResourceHistoryResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Get the raw history (ie. events are not sorted) of a resource (for the current month)","tags":["Resource History"],"operationId":"getIndexedResourceHistory","parameters":[{"description":"The type of the resource (DISPLAY_AD, EMAIL_TEMPLATE and VIDEO_AD are not yet supported)","style":"simple","explode":false,"required":true,"in":"path","schema":{"type":"string"},"name":"resource_type"},{"name":"resource_id","schema":{"type":"string"},"required":true,"in":"path","style":"simple","description":"The ID of the resource for which the history is to be fetched (can't be set without resource_type)","explode":false},{"in":"query","explode":true,"schema":{"type":"integer","format":"int64"},"style":"form","name":"organisation_id","description":"The organisation in which the search is performed","required":true}]}}},"components":{"schemas":{"ResourceHistoryResource":{"type":"object","properties":{"resource_type":{"type":"string","readOnly":false},"resource_id":{"type":"string","readOnly":false},"events":{"type":"array","items":{"$ref":"#/components/schemas/HistoryEventResource"},"readOnly":false}},"required":["events","resource_id","resource_type"]},"HistoryEventResource":{"discriminator":{"propertyName":"type","mapping":{"ALERT_EVENT":"#/components/schemas/HistoryAlertEventResource","UPDATE_EVENT":"#/components/schemas/HistoryUpdateEventResource","DELETE_EVENT":"#/components/schemas/HistoryDeleteEventResource","CREATE_EVENT":"#/components/schemas/HistoryCreateEventResource","DELETE_LINK_EVENT":"#/components/schemas/HistoryDeleteLinkEventResource","CREATE_LINK_EVENT":"#/components/schemas/HistoryCreateLinkEventResource"}},"oneOf":[{"$ref":"#/components/schemas/HistoryAlertEventResource"},{"$ref":"#/components/schemas/HistoryUpdateEventResource"},{"$ref":"#/components/schemas/HistoryCreateLinkEventResource"},{"$ref":"#/components/schemas/HistoryCreateEventResource"},{"$ref":"#/components/schemas/HistoryDeleteLinkEventResource"},{"$ref":"#/components/schemas/HistoryDeleteEventResource"}],"properties":{"type":{"type":"string","enum":["ALERT_EVENT","UPDATE_EVENT","CREATE_LINK_EVENT","CREATE_EVENT","DELETE_LINK_EVENT","DELETE_EVENT"]}},"required":["type"]},"HistoryAlertEventResource":{"type":"object","properties":{"timestamp":{"$ref":"#/components/schemas/DateTime"},"user_identification":{"$ref":"#/components/schemas/UserIdentification"},"event_id":{"type":"string","format":"uuid","readOnly":false},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"alert_code":{"type":"string","readOnly":false}},"required":["alert_code","event_id","event_type","timestamp","user_identification"]},"DateTime":{"type":"string","format":"date-time","description":"iso8601 date time"},"UserIdentification":{"type":"object","properties":{"user_id":{"type":"string","readOnly":false},"user_agent":{"type":"string","readOnly":false},"user_ipaddress":{"type":"string","readOnly":false},"user_name":{"type":"string","readOnly":false}}},"HistoryEventType":{"type":"string","enum":["ACTION","ALERT"],"readOnly":false},"HistoryUpdateEventResource":{"type":"object","properties":{"old_value":{"type":"string","readOnly":false},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"user_identification":{"$ref":"#/components/schemas/UserIdentification"},"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_id":{"type":"string","format":"uuid","readOnly":false},"field_changed":{"type":"string","readOnly":false},"new_value":{"type":"string","readOnly":false}},"required":["event_id","event_type","field_changed","timestamp","user_identification"]},"HistoryCreateLinkEventResource":{"allOf":[{"$ref":"#/components/schemas/HistoryLinkEventResource"},{"type":"object","properties":{"resource_id":{"type":"string","readOnly":false},"field_name":{"type":"string","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"reversed_field_name":{"type":"string","readOnly":false},"resource_type":{"type":"string","readOnly":false},"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_id":{"type":"string","format":"uuid","readOnly":false}},"required":["event_id","event_type","field_name","resource_id","resource_type","reversed_field_name","timestamp","user_identification"]}]},"HistoryLinkEventResource":{"type":"object"},"HistoryCreateEventResource":{"type":"object","properties":{"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"event_id":{"type":"string","format":"uuid","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"}},"required":["event_id","event_type","timestamp","user_identification"]},"HistoryDeleteLinkEventResource":{"allOf":[{"$ref":"#/components/schemas/HistoryLinkEventResource"},{"type":"object","properties":{"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"reversed_field_name":{"type":"string","readOnly":false},"resource_type":{"type":"string","readOnly":false},"field_name":{"type":"string","readOnly":false},"event_id":{"type":"string","format":"uuid","readOnly":false},"timestamp":{"$ref":"#/components/schemas/DateTime"},"resource_id":{"type":"string","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"}},"required":["event_id","event_type","field_name","resource_id","resource_type","reversed_field_name","timestamp","user_identification"]}]},"HistoryDeleteEventResource":{"type":"object","properties":{"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"event_id":{"type":"string","format":"uuid","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"}},"required":["event_id","event_type","timestamp","user_identification"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /resource\_history

> Search the history of a resource

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Resource History","description":"Operations for searching the history of indexed platform resources."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/resource_history":{"get":{"tags":["Resource History"],"summary":"Search the history of a resource","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ResourceHistoryResource"}},"count":{"type":"integer"},"max_results":{"type":"integer"},"first_result":{"type":"integer"},"total":{"type":"integer"},"status":{"type":"string","enum":["ok"]}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"findIndexedResourceHistory","parameters":[{"description":"The organisation in which the search is performed","style":"form","name":"organisation_id","in":"query","required":true,"explode":true,"schema":{"type":"integer","format":"int64"}},{"required":false,"explode":true,"description":"The type of the resource (DISPLAY_AD, EMAIL_TEMPLATE and VIDEO_AD are not yet supported)","style":"form","schema":{"type":"string"},"in":"query","name":"resource_type"},{"required":false,"style":"form","description":"The ID of the resource for which the history is to be fetched (can't be set without resource_type)","in":"query","schema":{"type":"string"},"name":"resource_id","explode":true},{"name":"event_type","schema":{"$ref":"#/components/schemas/HistoryEventType"},"required":false,"explode":true,"description":"Action ( = edit done by a human user) or Alert ( = alert generated by the platform on a resource)","style":"form","in":"query"},{"in":"query","schema":{"type":"string"},"description":"The ID of the user for which the history is to be fetched","name":"user_id","required":false,"explode":true,"style":"form"},{"in":"query","description":"Get only events that occurred after this date (Unix timestamp)","schema":{"type":"string"},"name":"from","style":"form","required":false,"explode":true},{"in":"query","description":"Get only events that occurred before this date (Unix timestamp)","style":"form","name":"to","explode":true,"schema":{"type":"string"},"required":false},{"name":"max_results","required":false,"explode":true,"in":"query","schema":{"type":"integer","format":"int32"},"description":"Number of maximum items that shall be returned by this search","style":"form"}],"description":""}}},"components":{"schemas":{"ResourceHistoryResource":{"type":"object","properties":{"resource_type":{"type":"string","readOnly":false},"resource_id":{"type":"string","readOnly":false},"events":{"type":"array","items":{"$ref":"#/components/schemas/HistoryEventResource"},"readOnly":false}},"required":["events","resource_id","resource_type"]},"HistoryEventResource":{"discriminator":{"propertyName":"type","mapping":{"ALERT_EVENT":"#/components/schemas/HistoryAlertEventResource","UPDATE_EVENT":"#/components/schemas/HistoryUpdateEventResource","DELETE_EVENT":"#/components/schemas/HistoryDeleteEventResource","CREATE_EVENT":"#/components/schemas/HistoryCreateEventResource","DELETE_LINK_EVENT":"#/components/schemas/HistoryDeleteLinkEventResource","CREATE_LINK_EVENT":"#/components/schemas/HistoryCreateLinkEventResource"}},"oneOf":[{"$ref":"#/components/schemas/HistoryAlertEventResource"},{"$ref":"#/components/schemas/HistoryUpdateEventResource"},{"$ref":"#/components/schemas/HistoryCreateLinkEventResource"},{"$ref":"#/components/schemas/HistoryCreateEventResource"},{"$ref":"#/components/schemas/HistoryDeleteLinkEventResource"},{"$ref":"#/components/schemas/HistoryDeleteEventResource"}],"properties":{"type":{"type":"string","enum":["ALERT_EVENT","UPDATE_EVENT","CREATE_LINK_EVENT","CREATE_EVENT","DELETE_LINK_EVENT","DELETE_EVENT"]}},"required":["type"]},"HistoryAlertEventResource":{"type":"object","properties":{"timestamp":{"$ref":"#/components/schemas/DateTime"},"user_identification":{"$ref":"#/components/schemas/UserIdentification"},"event_id":{"type":"string","format":"uuid","readOnly":false},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"alert_code":{"type":"string","readOnly":false}},"required":["alert_code","event_id","event_type","timestamp","user_identification"]},"DateTime":{"type":"string","format":"date-time","description":"iso8601 date time"},"UserIdentification":{"type":"object","properties":{"user_id":{"type":"string","readOnly":false},"user_agent":{"type":"string","readOnly":false},"user_ipaddress":{"type":"string","readOnly":false},"user_name":{"type":"string","readOnly":false}}},"HistoryEventType":{"type":"string","enum":["ACTION","ALERT"],"readOnly":false},"HistoryUpdateEventResource":{"type":"object","properties":{"old_value":{"type":"string","readOnly":false},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"user_identification":{"$ref":"#/components/schemas/UserIdentification"},"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_id":{"type":"string","format":"uuid","readOnly":false},"field_changed":{"type":"string","readOnly":false},"new_value":{"type":"string","readOnly":false}},"required":["event_id","event_type","field_changed","timestamp","user_identification"]},"HistoryCreateLinkEventResource":{"allOf":[{"$ref":"#/components/schemas/HistoryLinkEventResource"},{"type":"object","properties":{"resource_id":{"type":"string","readOnly":false},"field_name":{"type":"string","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"reversed_field_name":{"type":"string","readOnly":false},"resource_type":{"type":"string","readOnly":false},"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_id":{"type":"string","format":"uuid","readOnly":false}},"required":["event_id","event_type","field_name","resource_id","resource_type","reversed_field_name","timestamp","user_identification"]}]},"HistoryLinkEventResource":{"type":"object"},"HistoryCreateEventResource":{"type":"object","properties":{"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"event_id":{"type":"string","format":"uuid","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"}},"required":["event_id","event_type","timestamp","user_identification"]},"HistoryDeleteLinkEventResource":{"allOf":[{"$ref":"#/components/schemas/HistoryLinkEventResource"},{"type":"object","properties":{"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"reversed_field_name":{"type":"string","readOnly":false},"resource_type":{"type":"string","readOnly":false},"field_name":{"type":"string","readOnly":false},"event_id":{"type":"string","format":"uuid","readOnly":false},"timestamp":{"$ref":"#/components/schemas/DateTime"},"resource_id":{"type":"string","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"}},"required":["event_id","event_type","field_name","resource_id","resource_type","reversed_field_name","timestamp","user_identification"]}]},"HistoryDeleteEventResource":{"type":"object","properties":{"timestamp":{"$ref":"#/components/schemas/DateTime"},"event_type":{"$ref":"#/components/schemas/HistoryEventType"},"event_id":{"type":"string","format":"uuid","readOnly":false},"user_identification":{"$ref":"#/components/schemas/UserIdentification"}},"required":["event_id","event_type","timestamp","user_identification"]},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mediarithmics.io/api-reference/query-analytics-and-operations/monitoring-and-reporting/resource-history.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
