> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/hardware/~/revisions/aurjDoOhAcnQLHeoR1ks/card-readers/mms-dyna-devices/emv-common-kernel/dynaflex-ii-go/documents/developers-manuals/programmers-manual-commands/commands/file-operations/start-get-file-from-device.md).

# Start Get File from Device

## Command 0xD821 - Start Get File from Device

The host uses this command to request a file stored on the device. File types include standard files (images and certificates), MagTek custom files (configuration, firmware), and in some cases even large data blob output (such as signature capture data). In many cases, the files retrieved by this command have been sent by a host previously using **Command 0xD811 - Start Send File to Device (Secured)** or **Command 0xD812 - Start Send File to Device (Unsecured)**. In other cases, such as retrieving signature capture data, the data may originate with the device and the host uses this command to retrieve it. Such data is not persistent, in the sense that the device does not retain it through power cycles.

The sequence of events is as follows:

{% stepper %}
{% step %}

### Host composes and sends request

The host composes a command request in the format below, and sends it to the device.
{% endstep %}

{% step %}

### Device acknowledges readiness

The device sends a response in the format below so the host knows it can begin listening for a file message.
{% endstep %}

{% step %}

### Device sends Data File Message

The device sends a **Data File Message** to the host. If the host does not receive file data within a reasonable period of time, it should time out and stop listening for the data file.
{% endstep %}

{% step %}

### Host validates received file

Upon receiving the end of the **Data File Message**, the host should check to make sure the **File ID**, length, and hash of the **File Payload** in the **Data File Message** match the values the device specified in its response to ensure the file has not been tampered with.
{% endstep %}
{% endstepper %}

## Table - Request Data for Command 0xD821 - Start Get File from Device

<table><thead><tr><th>Tag</th><th width="74.66668701171875">Len</th><th width="250">Value / Description</th><th width="75.66668701171875">Typ</th><th width="75.3333740234375">Req</th><th width="98">Default</th></tr></thead><tbody><tr><td>Beginning of any wrappers, at minimum including <strong>Request Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>D821 = <strong>Command 0xD821 - Start Get File from Device</strong></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>81</td><td>04</td><td>File ID from Table 206</td><td>B</td><td>R</td><td></td></tr><tr><td>87</td><td>01</td><td><p>Progress indicator behavior (Reserved for future use / Subject to change)</p><ul><li>0x00 = None</li><li>0x01 = LED</li></ul></td><td>B</td><td>O</td><td>Null</td></tr><tr><td>End of any wrappers, at minimum including <strong>Request Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

## Table - Response Data for Command 0xD821 - Start Get File from Device

<table><thead><tr><th>Tag</th><th width="72.3333740234375">Len</th><th>Value / Description</th><th width="75.33331298828125">Typ</th><th width="74.6666259765625">Req</th><th width="96.666748046875">Default</th></tr></thead><tbody><tr><td>Beginning of any wrappers, at minimum including <strong>Response Message</strong> </td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>D821 = <strong>Command 0xD821 - Start Get File from Device</strong></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>81</td><td>04</td><td>File ID from Table 206</td><td>B</td><td>R</td><td></td></tr><tr><td>A2</td><td>var</td><td>File transfer properties</td><td>T</td><td>R</td><td></td></tr><tr><td>/81</td><td>var</td><td>Length of File Payload — This is the length of the <strong>File Payload</strong> parameter in the <strong>Data File Message</strong> the device sends to the host.</td><td>B</td><td>R</td><td></td></tr><tr><td>/82</td><td>01</td><td><p>Hash Checksum Type</p><ul><li>0x04 = SHA-256</li></ul></td><td>B</td><td>R</td><td></td></tr><tr><td>/83</td><td>20</td><td><p>Hash Checksum</p><p></p><p>Anticipated checksum calculated against the <strong>File Payload</strong>, according to the standard specified in <strong>Hash Checksum Type</strong>.</p></td><td>B</td><td>R</td><td></td></tr><tr><td>A3</td><td>var</td><td><p>File Description</p><p>The values the host populated for convenience when it sent the file to help identify the file. Not all values are required.</p></td><td>T</td><td>R</td><td></td></tr><tr><td>/81</td><td>var</td><td><p>File Description</p><p>The values the host populated for convenience when it sent the file to help identify the file. Not all values are required.</p></td><td>B</td><td>O</td><td>Null</td></tr><tr><td>/82</td><td>var</td><td><p>File Label</p><p>Maximum length 16 bytes Reserved for future use.</p></td><td>B</td><td>O</td><td>Null</td></tr><tr><td>/83</td><td>var</td><td><p>File Version</p><p>Maximum length 7 bytes Reserved for future use.</p></td><td>B</td><td>O</td><td>Null</td></tr><tr><td>/84</td><td>var</td><td><p>File Date</p><p>Maximum length 20 bytes Reserved for future use.</p></td><td>B</td><td>O</td><td>Null</td></tr><tr><td>End of any wrappers, at minimum including Response Message </td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

If the request started successfully, the Request Status in the message wrapper is **OK, Done.**

## Table - Request Example

Example (Hex):

```
AA 00 81 04 01 08 D8 21 84 0B D8 21 81 04 00 00 00 01 87 01 01
```

***

## Table - Response Example

Example (Hex):

```
AA 00 81 04 82 08 D8 21 82 04 00 00 00 00 84 54 D8 21 81 04 00 00 00 01 A2 2B 
81 04 00 00 00 40 82 01 04 83 20 FD EA B9 AC F3 71 03 62 BD 26 58 CD C9 A2 9E 
8F 9C 75 7F CF 98 11 60 3A 8C 44 7C D1 D9 15 11 08 A3 1D 81 0B 54 45 53 54 5F 
31 4B 2E 62 69 6E 82 05 4C 61 62 65 6C 83 07 31 2E 30 2E 30 2E 31
```


---

# 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 dynamically by asking a question.

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

```
GET https://developer.magtek.com/hardware/~/revisions/aurjDoOhAcnQLHeoR1ks/card-readers/mms-dyna-devices/emv-common-kernel/dynaflex-ii-go/documents/developers-manuals/programmers-manual-commands/commands/file-operations/start-get-file-from-device.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
