# Response key and document retrieval in ELR

Source: https://developer.avalara.com/products/e-invoicing/integration-guides/elr/pse9014344707594/

Guide: E-Invoicing and Live Reporting

# Response key and document retrieval in ELR

Understand how to retrieve document status, store response data, and manage document outputs in ELR.

This section describes how your integration should retrieve, store, and use document status information and document outputs.

To implement this functionality, use the following endpoints:

-   **Get document status** to retrieve document status and event details.
-   **Download document** to retrieve available document formats.

## Outbound documents (flow = out)

For documents with status **Complete**, your integration must:

-   Store all `events[].responseKey` and `responseValue` values (from [GetDocumentStatus](https://developer.avalara.com/api-reference/e-invoicing/v1.5/methods/Documents/GetDocumentStatus/)).
-   Download all available media types, except UBL (unless required).
-   Save the downloaded files at the document level in the ERP or business system.

For documents with status **Error**, your integration must:

-   Store all `events[].message` values against the document (from [GetDocumentStatus](https://developer.avalara.com/api-reference/e-invoicing/v1.6/methods/Documents/GetDocumentStatus/)).
-   Download all available media types, except UBL (unless required).
-   Save the downloaded files at the document level in the ERP or business system.

## Inbound documents (flow = in)

For documents with status **Complete**, your integration must:

-   Download all available media types.
-   Save the downloaded files at the document level in the ERP or business system.
-   Use the UBL media type to create an AP document in the ERP or business application (in draft status).

Note

Inbound documents may not be available for some mandates.

## Status retrieval and automation

Your integration must allow users to:

-   Manually check the status of submitted documents.
-   Automatically update document status using a polling mechanism.

You can also support webhook integration to receive real-time updates and reduce the need for polling.

Your application must show all event messages returned by the [GetDocumentStatus](https://developer.avalara.com/api-reference/e-invoicing/v1.6/methods/Documents/GetDocumentStatus/) endpoint. This includes technical and compliance-related information such as:

-   UUIDs
-   Government response messages
-   Tracking numbers
-   Timestamps

Display this information even when the document status is **Complete** to support troubleshooting, auditing, and downstream processing.

## Document download behavior

Your application must allow users to:

-   Access and download all available media types returned by ELR for a document.
-   Retrieve formats such as XML, JSON, PDF, or ZIP, depending on the mandate.

Don’t restrict users to a single file format. Always expose all formats returned by ELR.

Users must be able to:

-   Download files on demand
-   Store them for compliance and audit purposes
-   Use them in downstream systems

For example, users may:

-   Attach XML or PDF files to emails
-   Include PNG files in PDF templates
-   Store ZIP files for internal record keeping