---
title: "Download 835 (ERA) and 837 (Claim) files"
section: how-to
order: 6
description: "This guide covers downloading insurance remittance files (835 ERA) and claim files (837) from CollaborateMD."
---

This guide covers downloading insurance remittance files (835 ERA) and claim files (837) from CollaborateMD.
In all cases, files can only be downloaded after they have been received by CollaborateMD (for 835) or sent from CollaborateMD (for 837).

## Overview

CollaborateMD receives remittance and status files from our clearinghouse and stores them for retrieval.
You can download these files as ZIP archives based on the specific date that they were received.

Both download operations require specific permissions:

- **835 ERA downloads** require the Payment permission
- **837 downloads** require the Patient/Claim/Appointment permission

### Note: HTTP Status Codes

**These endpoints use HTTP status codes to indicate the result** rather than the GenericResponse's Status field. 

- **HTTP 200** — Files found (or a message if no files); download the content
- **HTTP 400** — Bad request (invalid date format)
- **HTTP 404** — Invalid customer number. **Not** used for "no files"
- **HTTP 401** — The Web API interface is not active for this customer
- **HTTP 500** — Server error

### How to Tell if Files are Available

If HTTP 200 OK is returned, **you must check the `Content-Disposition`** to see whether any files were returned:\

```python
if response.status_code == 200:
    if "attachment" in response.headers.get("Content-Disposition", ""):
        save_zip(response.content)          # a real archive
    else:
        no_files_today()                    # 200 with a plain-text message
```

Checking the magic bytes (`response.content[:2] == b"PK"`) works equally well and does not depend on checking the header.

You can't check on just the HTTP status (we return 200 OK when there are no files, not 404 Not Found) or the `Content-Type` header
(the header will be `application/zip` even if there is nothing to download).

This is an exception to the rule. See [Reading responses](/docs/guides/reading-responses.html) for more details.

## Download 835 ERA Files

Retrieve remittance and explanation of benefits files from insurance payers:

- **Endpoint:** [GET /v1/customer/{custno}/payment/download-835](/#GET/v1/customer/{custno}/payment/download-835)
- **Permission required:** Payment

### Request Example

```bash
USERNAME="your-username"
PASSWORD="your-password"
CUSTNO="12345678"
DATE="2024-01-15"  # ISO-8601 date: yyyy-MM-dd format
AUTH=$(echo -n "$USERNAME:$PASSWORD" | base64)

curl -X GET "https://webapi.example.com/v1/customer/$CUSTNO/payment/download-835?date=$DATE" \
  -H "Authorization: Basic $AUTH" \
  --output era_files_2024-01-15.zip
```

### Response

**HTTP 200 with ZIP content** — Files exist for the specified date. A ZIP archive is returned with a `Content-Disposition` header set for download. Save the ZIP file and extract it to access the individual 835 files.

**HTTP 200 with text message** — No files were received on that date. The response body contains a plain-text message like "No payment files found for 2024-01-15".

**HTTP 400** — Invalid date format. The `date` parameter must be in ISO-8601 date format: `yyyy-MM-dd`.

**HTTP 404** — Invalid customer number. This is the *only* cause of a 404; a date with no files returns 200, not 404.

**HTTP 401** — Your credentials are wrong.

**HTTP 500** — Server error. Retry later and contact Interface Support if the problem persists.

## Download 837 Claim Files

Retrieve claim files that were submitted to insurance:

- **Endpoint:** [GET /v1/customer/{custno}/claim/download-837](/#GET/v1/customer/{custno}/claim/download-837)
- **Permission required:** Patient/Claim/Appointment

### Request Example

```bash
USERNAME="your-username"
PASSWORD="your-password"
CUSTNO="12345678"
DATE="2024-01-15"  # yyyy-MM-dd format
AUTH=$(echo -n "$USERNAME:$PASSWORD" | base64)

curl -X GET "https://webapi.example.com/v1/customer/$CUSTNO/claim/download-837?date=$DATE" \
  -H "Authorization: Basic $AUTH" \
  --output claim_files_2024-01-15.zip
```

### Response

**HTTP 200 with ZIP content** — Files exist for the specified date. A ZIP archive is returned with a `Content-Disposition` header set for download. Save the ZIP file and extract it to access the individual 837 files.

**HTTP 200 with text message** — No files were available for that date. The response body contains a plain-text message like "No claim files found for 2024-01-15".

**HTTP 400** — Invalid date format. The `date` parameter must be in ISO-8601 date format: `yyyy-MM-dd`.

**HTTP 404** — Invalid customer number. This is the *only* cause of a 404; a date with no files returns 200, not 404.

**HTTP 401** — Your credentials are wrong.

**HTTP 500** — Server error. Retry later and contact Interface Support if the problem persists.

## Extracting and Processing Files

Once you have downloaded a ZIP file, extract it using your programming language's ZIP library:

### Python Example

```python
import zipfile
import os
from datetime import datetime

def download_and_extract(base_url, custno, date_string, auth_header, endpoint_type):
    """
    Download a ZIP file and extract its contents.
    endpoint_type: 'claim' or 'payment'
    """
    import requests
    
    url = f"{base_url}/v1/customer/{custno}/{endpoint_type}/download-835"
    if endpoint_type == 'claim':
        url = f"{base_url}/v1/customer/{custno}/claim/download-837"
    
    params = {"date": date_string}
    headers = {"Authorization": auth_header}
    
    response = requests.get(url, params=params, headers=headers)
    
    # Check HTTP status code, there's no Status field in the body
    if response.status_code == 200:
        # Distinguish a real archive from the "no files" message. Content-Type is
        # application/zip in BOTH cases, so test the Content-Disposition header.
        if "attachment" in response.headers.get("Content-Disposition", ""):
            # Extract the ZIP
            zip_filename = f"{endpoint_type}_{date_string}.zip"
            with open(zip_filename, 'wb') as f:
                f.write(response.content)
            
            extract_dir = f"{endpoint_type}_files_{date_string}"
            os.makedirs(extract_dir, exist_ok=True)
            
            with zipfile.ZipFile(zip_filename, 'r') as zip_ref:
                zip_ref.extractall(extract_dir)
            
            print(f"Extracted to {extract_dir}")
            return True
        else:
            # Text message (no files found)
            print(f"No files found: {response.text}")
            return False
    elif response.status_code == 400:
        print(f"Bad date format: {response.text}")
        return False
    elif response.status_code == 404:
        print(f"Customer not found: {response.text}")
        return False
    elif response.status_code == 401:
        print(f"Unauthorized: check your credentials and permissions")
        return False
    else:
        print(f"Server error: {response.status_code}")
        return False
```

### Bash Example

```bash
#!/bin/bash

USERNAME="your-username"
PASSWORD="your-password"
CUSTNO="12345678"
DATE="2024-01-15"

AUTH=$(echo -n "$USERNAME:$PASSWORD" | base64)

# Download 835 files
echo "Downloading 835 files for $DATE..."
curl -X GET "https://webapi.example.com/v1/customer/$CUSTNO/payment/download-835?date=$DATE" \
  -H "Authorization: Basic $AUTH" \
  --output era_$DATE.zip

# Check if it's a ZIP file
if file era_$DATE.zip | grep -q "Zip archive"; then
  echo "Extracting 835 files..."
  unzip -q era_$DATE.zip -d era_$DATE
  echo "Files extracted to era_$DATE/"
  ls era_$DATE/
else
  echo "No files found or error:"
  cat era_$DATE.zip
  rm era_$DATE.zip
fi
```

## Permissions

- **`PAYMENT` permission** — Required to download 835 ERA files
- **`PATIENT` permission** — Required to download 837 claim files

If your credential does not have the required permission, contact your account representative.

## Common Issues

**"Invalid date format"** — The `date` parameter must be exactly `yyyy-MM-dd` (e.g., `2024-01-15`, not `01/15/2024` or `2024-1-15`).

**"No files found"** — Files may not have been received on the requested date. Try a different date or check with Interface Support to confirm files were processed.

**"The interface is not turned on for this customer."** — The API has not been enabled for this customer.
See [Getting Started](/docs/guides/getting-started.html), which also covers the closely related
"Your credentials do not have access to the requested customer."

## Example: Automatic Daily Download

Here's a cron-style example that downloads and processes files daily:

```bash
#!/bin/bash

# Run daily at 2 AM to fetch yesterday's files

USERNAME="your-api-username"
PASSWORD="your-api-password"
CUSTNO="12345678"
BASE_URL="https://webapi.example.com"

AUTH=$(echo -n "$USERNAME:$PASSWORD" | base64)

# Get yesterday's date
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)

echo "Downloading files for $YESTERDAY..."

# Download and extract 835 files
curl -X GET "$BASE_URL/v1/customer/$CUSTNO/payment/download-835?date=$YESTERDAY" \
  -H "Authorization: Basic $AUTH" \
  -o era_$YESTERDAY.zip

if file era_$YESTERDAY.zip | grep -q "Zip archive"; then
  unzip -q era_$YESTERDAY.zip -d /path/to/era/archive/$YESTERDAY
  echo "835 files archived to /path/to/era/archive/$YESTERDAY"
  rm era_$YESTERDAY.zip
fi

# Download and extract 837 files
curl -X GET "$BASE_URL/v1/customer/$CUSTNO/claim/download-837?date=$YESTERDAY" \
  -H "Authorization: Basic $AUTH" \
  -o claim_$YESTERDAY.zip

if file claim_$YESTERDAY.zip | grep -q "Zip archive"; then
  unzip -q claim_$YESTERDAY.zip -d /path/to/claim/archive/$YESTERDAY
  echo "837 files archived to /path/to/claim/archive/$YESTERDAY"
  rm claim_$YESTERDAY.zip
fi
```

## Next Steps

- [Create a Claim](/docs/guides/create-a-claim.html) — Learn how to create & submit claims
- [Check Eligibility](/docs/guides/check-eligibility.html) — Verify insurance coverage
- [Reading Responses](/docs/guides/reading-responses.html) — Understand response conventions
- [Permissions](/docs/guides/permissions.html) — Learn about available roles and permissions
