# Filing History

This endpoint links to Companies House, allowing you to view and retrieve documents in PDF format.

### Retrieving Documents

In order to retrieve a document as a PDF from the filing history results, you should query the document link (relationships > document > links > related) but you must change the MIME Type in the header to **application/pdf**.

### Example URL:

```
https://api2.redflagalert.net/v4/companies/01777777/filing-history/
```

### JSON Structure:

```javascript
{
	"data": [{
		"relationships": {
			"document": {
				"links": {
					"related": "https://api2.redflagalert.net/v4/documents/wW054GFYFWfdZYMIyIfTDank2njJSKJb35KaxwY9AeA/"
				}
			}
		},
		"attributes": {
			"category": "mortgage",
			"description": "mortgage-create-with-deed-with-charge-number",
			"links": {
				"self": "/company/01777777/filing-history/MzA5MTY0OTM4M2FkaXF6a2N4"
			},
			"barcode": "A2NMAXXV",
			"text_description": "Registration of a charge",
			"paper_filed": true,
			"description_values": {
				"charge_number": "017777770771"
			},
			"date": "2013-12-20",
			"type": "MR01",
			"pages": 6,
			"document_id": "wW054GFYFWfdZYMIyIfTDank2njJSKJb35KaxwY9AeA",
			"subcategory": "create"
		},
		"type": "filing_history",
		"id": "MzA5MTY0OTM4M2FkaXF6a2N4-A2NMAXXV",
		"links": {
			"self": "https://api2.redflagalert.net/v4/companies/01777777/filing-history/MzA5MTY0OTM4M2FkaXF6a2N4"
		}
	}],
	"links": {
		"self": "https://api2.redflagalert.net/v4/companies/01777777/filing-history/",
		"next": "https://api2.redflagalert.net/v4/companies/01777777/filing-history/?page%5Boffset%5D=2",
		"last": "https://api2.redflagalert.net/v4/companies/01777777/filing-history/?page%5Boffset%5D=32",
		"first": "https://api2.redflagalert.net/v4/companies/01777777/filing-history/?page%5Boffset%5D=1"
	}
}
```

### Attributes

| Field Key            | Description                                                        | Notes                                                                                                                                                                                                                                                                                                                                                                   |
| -------------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `category`           | The category of the document filed.                                | <p>Possible values are:</p><p><code>accounts</code></p><p><code>address</code></p><p><code>annual-return</code></p><p><code>capital</code></p><p><code>change-of-name</code></p><p><code>incorporation</code></p><p><code>liquidation</code></p><p><code>miscellaneous</code></p><p><code>mortgage</code></p><p><code>officers</code></p><p><code>resolution</code></p> |
| `description`        | A description of the filing.                                       | For enumeration descriptions see `description` section in the [enumeration mappings.](https://github.com/companieshouse/api-enumerations/blob/master/filing_history_descriptions.yml)                                                                                                                                                                                   |
| `links`              | Links to other resources associated with this filing history item. |                                                                                                                                                                                                                                                                                                                                                                         |
| `barcode`            | The barcode of the document.                                       |                                                                                                                                                                                                                                                                                                                                                                         |
| `text_description`   | A text description of the filing.                                  | For enumeration descriptions see `description` section in the [enumeration mappings.](https://github.com/companieshouse/api-enumerations/blob/master/filing_history_descriptions.yml)                                                                                                                                                                                   |
| `paper_filed`        | If `true`, indicates this is a paper filing.                       |                                                                                                                                                                                                                                                                                                                                                                         |
| `description_values` | The main description code                                          |                                                                                                                                                                                                                                                                                                                                                                         |
| `date`               | The date the associated filing was processed.                      |                                                                                                                                                                                                                                                                                                                                                                         |
| `type`               | The type of the associated filing.                                 |                                                                                                                                                                                                                                                                                                                                                                         |
| `pages`              | Number of pages within the PDF document (links.document\_metadata) |                                                                                                                                                                                                                                                                                                                                                                         |
| `document_id`        | The document id of the resolution.                                 |                                                                                                                                                                                                                                                                                                                                                                         |
| `subcategory`        | The sub-category of the document filed.                            | <p>Possible values are:</p><p><code>resolution</code></p>                                                                                                                                                                                                                                                                                                               |


---

# 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://developer.redflagalert.net/company-resources/filing-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.
