Skip to content

Running Reports

WebAPI reports run asynchronously. Starting a report does not return the report data. Instead, the start request returns an Identifier; use that value as the requestSeq when calling the matching results endpoint. The results endpoint is also the status endpoint: poll it while its response has Status: REPORT RUNNING.

The complete workflow is:

  1. Start the report.
  2. Confirm that the response has Status: SUCCESS, then save its Identifier.
  3. Call the matching results endpoint with that identifier after at least 10 seconds.
  4. While the results response has Status: REPORT RUNNING, wait for 30 seconds to one minute and call the same endpoint again.
  5. When the response has Status: SUCCESS, base64-decode Data and open the resulting ZIP archive to retrieve the CSV report. A successful report with no matching records has no Data value.

Before you begin

Reports and filters are created in the CollaborateMD application, not through WebAPI. The reportSeq and filterSeq path parameters are the report and filter IDs shown in CollaborateMD. See Web Reporting for instructions on creating reports and filters.

Only custom reports can be run through these endpoints. Use filters that keep the report focused and quick to run. A report that runs for more than 30 minutes times out.

Your credentials need one of these permissions:

  • Reporting for a report belonging to one customer.
  • Batch Reporting for a report spanning multiple customers. This permission is available only for certain integrations and won’t be allowed for all partners.

⚠️ Each interface partner may run only one report at a time. Please tune your filters to ensure fast response time. In general, a filter based on a defined date range, such as Charge From Date, Claim Entered Date, or Credit Deposit Date, or a filter based on a specific Claim Status, will complete quickly.

Choose the correct endpoint pair

The endpoint used to retrieve results must match the endpoint used to start the report.

Scope Start the report Poll status and retrieve results
One customer POST /v1/customer/{custno}/reports/{reportSeq}/filter/{filterSeq}/run POST /v1/customer/{custno}/reports/results/{requestSeq}
Multiple customers POST /v1/reports/{reportSeq}/filter/{filterSeq}/run POST /v1/reports/results/{requestSeq}

All four operations use POST, including the two results operations. They support XML and JSON responses based on your Accept HTTP header. The examples below request XML so the response fields are easy to identify.

Run a report for one customer

Call the customer-scoped start endpoint with the eight-digit customer number and the IDs of the custom report and filter:

Terminal window
: "${CMD_API_USER:?set CMD_API_USER}"
: "${CMD_API_SECRET:?set CMD_API_SECRET}"
BASE_URL="https://webapi.example.com"
CUSTNO="12345678"
REPORT_SEQ="10001234"
FILTER_SEQ="10004321"
curl --fail --silent --show-error \
--request POST \
--user "${CMD_API_USER}:${CMD_API_SECRET}" \
--header "Accept: application/xml" \
"${BASE_URL}/v1/customer/${CUSTNO}/reports/${REPORT_SEQ}/filter/${FILTER_SEQ}/run"

A successfully accepted request returns a response like this:

<GenericResponseXML xmlns="http://www.collaboratemd.com/api/v1/">
<Status>SUCCESS</Status>
<StatusMessage>Report successfully started.</StatusMessage>
<Identifier>10009999</Identifier>
</GenericResponseXML>

Do not continue based on HTTP 200 alone. Confirm Status is SUCCESS, then persist Identifier. In this example, the requestSeq for all subsequent calls is 10009999.

Run a report for multiple customers

The batch endpoint takes each customer number as a repeated customer query parameter:

Terminal window
curl --fail --silent --show-error \
--request POST \
--user "${CMD_API_USER}:${CMD_API_SECRET}" \
--header "Accept: application/xml" \
"${BASE_URL}/v1/reports/${REPORT_SEQ}/filter/${FILTER_SEQ}/run?customer=12345678&customer=12345679"

Repeat the customer query parameter once for each customer in the batch.

All customers in one batch must:

  • belong to the same CollaborateMD account;
  • belong to the account where the custom report was created;
  • be accessible to the calling credentials; and
  • have the WebAPI interface set up and active.

The successful response has the same Status and Identifier fields as the single-customer start request. Save that identifier as the batch report’s requestSeq.

Poll for status and retrieve the result

There is no separate report-status operation. Call the appropriate results endpoint and inspect the body’s Status field.

For a single-customer report:

Terminal window
REQUEST_SEQ="10009999"
curl --fail --silent --show-error \
--request POST \
--user "${CMD_API_USER}:${CMD_API_SECRET}" \
--header "Accept: application/xml" \
"${BASE_URL}/v1/customer/${CUSTNO}/reports/results/${REQUEST_SEQ}"

For a batch report:

Terminal window
curl --fail --silent --show-error \
--request POST \
--user "${CMD_API_USER}:${CMD_API_SECRET}" \
--header "Accept: application/xml" \
"${BASE_URL}/v1/reports/results/${REQUEST_SEQ}"

While the report is executing, the response is:

<ReportResponse xmlns="http://www.collaboratemd.com/api/v1/">
<Status>REPORT RUNNING</Status>
<StatusMessage>This report is still running. Please try again later.</StatusMessage>
</ReportResponse>

Wait before polling again. Use a bounded polling loop with a delay and stop when the status changes; do not continuously call the endpoint without a delay. The server enforces a 30-minute report timeout, so the client should also impose a finite polling deadline.

Process a completed report

When matching records are found, the results response has Status: SUCCESS and a Data field:

<ReportResponse xmlns="http://www.collaboratemd.com/api/v1/">
<Status>SUCCESS</Status>
<StatusMessage>Results successfully retrieved.</StatusMessage>
<Data>UEsDBBQAAAAI...</Data>
</ReportResponse>

Data is a base64-encoded ZIP archive containing the report as CSV. It is not the CSV text itself. Decode the field first, then process the ZIP with your platform’s normal archive library. For example, after extracting the Data value into report-data.base64:

Terminal window
base64 --decode report-data.base64 > report-results.zip
unzip report-results.zip -d report-results.csv

A report that completed successfully but found no matching records also returns Status: SUCCESS. Its StatusMessage says that no records were found and the response has no report data. Treat that as an empty result set, not as an error.

Handle report statuses

Most valid requests return HTTP 200 even when the operation did not succeed. Always parse the body and branch on Status; see Reading responses for the general response convention.

Status Meaning What to do
SUCCESS from the start endpoint The report was accepted and started Save Identifier and begin polling the matching results endpoint
SUCCESS from the results endpoint The report completed Decode Data when present; otherwise treat the result set as empty
REPORT RUNNING The report is still executing, or another report for this partner is already running For a results request, wait and poll again. For a start request, wait for the existing report to finish or time out before starting another
REPORT TIMED OUT Execution exceeded the 30-minute timeout Create a narrower report filter and start a new run
NOT FOUND A required customer value is invalid or missing Correct the customer number or batch customer list; do not retry unchanged
INVALID CRITERIA A report, filter, request ID, account, or interface validation failed Read StatusMessage, correct the request or account configuration, and start again if needed
ERROR An unexpected processing failure occurred Record StatusMessage; retry with backoff, and contact Interface Support if it persists

Each interface partner may run only one report at a time. This limit applies whether the run is for one customer or a batch. If a start request returns REPORT RUNNING, do not submit additional start requests in a tight loop.

Common validation problems

  • Standard report used instead of a custom report: only custom reports are supported.
  • Report and filter do not belong together: use a filter configured for the selected report and account.
  • Wrong results endpoint: use the customer-scoped results endpoint for a customer-scoped run and the batch results endpoint for a batch run.
  • Lost Identifier: the report run’s Identifier, not reportSeq or filterSeq, becomes the results endpoint’s requestSeq.
  • Batch customers span accounts: divide them into separate report runs so every customer in a batch belongs to the report’s account.
  • Inactive account or interface: closed, on-hold, or suspended accounts and customers without an enabled interface cannot run reports.
  • Long-running report: narrow the CollaborateMD filter so the report completes within 30 minutes.