# History

This endpoint is used to see terraform states changes over time for a Terrakube workspace.

{% hint style="warning" %}
To use this endpoint you should have "manageWorkspace" access at team level and a Terrakube workspace
{% endhint %}

### Entity fields:

| Path                   | Type   | Description          |
| ---------------------- | ------ | -------------------- |
| data.type              | string | Should be "history"  |
| data.attributes.output | string | Unique variable name |

### Example:

```
{
  "data": {
    "type": "history",
    "attributes": {
      "output": "Terraform JSON State URL"
    }
  }
}
```

### Supported Operations

## GET /workspace/{workspaceId}/history

> Returns the relationship history

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"history"}],"servers":[{"url":"/api/v1"}],"paths":{"/workspace/{workspaceId}/history":{"get":{"tags":["history"],"description":"Returns the relationship history","parameters":[{"name":"sort","in":"query","description":"Sorts the collection on the selected attributes.  A prefix of '-' sorts descending","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["createdBy","-createdBy","jobReference","-jobReference","lineage","-lineage","md5","-md5","output","-output","serial","-serial","updatedBy","-updatedBy","id","-id"]}}},{"name":"fields[history]","in":"query","description":"Selects the set of history fields that should be returned in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["createdBy","createdDate","jobReference","lineage","md5","output","serial","updatedBy","updatedDate","workspace"]}}},{"name":"include","in":"query","description":"Selects the set of relationships that should be expanded as a compound document in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["workspace"]}}},{"name":"filter[history]","in":"query","description":"Filters the collection of history using a 'disjoint' RSQL expression","schema":{"type":"string"}},{"name":"page[number]","in":"query","description":"Number of pages to return.  Can be used with page[size]","schema":{"type":"integer","format":"int32"}},{"name":"page[size]","in":"query","description":"Number of elements per page.  Can be used with page[number]","schema":{"type":"integer","format":"int32"}},{"name":"page[offset]","in":"query","description":"Offset from 0 to start paginating.  Can be used with page[limit]","schema":{"type":"integer","format":"int32"}},{"name":"page[limit]","in":"query","description":"Maximum number of items to return.  Can be used with page[offset]","schema":{"type":"integer","format":"int32"}},{"name":"page[totals]","in":"query","description":"For requesting total pages/records be included in the response page meta data","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/history"}},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}}}}}},"components":{"schemas":{"history":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (user is a super service)\nDelete Permissions : (user is a super service)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"createdBy":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false},"createdDate":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false},"jobReference":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false},"lineage":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false},"md5":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false},"output":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false},"serial":{"type":"integer","description":"Update Permissions : (user is a super service)","format":"int32","readOnly":false,"writeOnly":false},"updatedBy":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false},"updatedDate":{"type":"string","description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"workspace":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["workspace"]},"id":{"type":"string"}},"description":"Update Permissions : (user is a super service)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

{% hint style="info" %}
For a complete list of organization operation please visit the [OpenAPI specification](https://github.com/AzBuilder/terrakube-server/tree/main/openapi-spec)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.terrakube.io/api/methods/history.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
