---
updatedAt: 2026-06-22T13:11:51.000Z
agentTools:
  projectIndex: https://integrations.luscii.com/llms.txt
---

# Generate CSV export

Generate a CSV export to be received via email

The Export API allows you to programmatically queue an export job. By requesting a CSV export you receive a download uri in the response body where eventually the file will be available for download. All CSV report types supported in the Web Application are supported as Export API jobs.

> 🚧 Exports are generated asynchronously. There is no guarantee that on receiving the response the export file is immediately ready for download. Depending on size of the export the generation process can take from a couple of seconds to a couple of minutes.

Accessible by `HC_ADMIN` and `HC_SUPPORTER`.

## Structure of the export

The downloaded csv file will have the following structure depending on the type of export which was requested.

<HTMLBlock>{`
<details>
    <summary>patients</summary>
    <ul>
        <li>Patient_UUID</li>
        <li>First_Name</li>
        <li>Middle_Name</li>
        <li>Last_Name</li>
        <li>Sex</li>
        <li>Patient_Number</li>
        <li>BSN</li>
        <li>Email</li>
        <li>Phone</li>
        <li>Date_Of_Birth</li>
        <li>Status</li>
        <li>Group_Name</li>
        <li>Program_Name</li>
        <li>Created_Date</li>
        <li>Activated_Date</li>
        <li>Stopped_Date</li>
        <li>Stopped_Reason</li>
        <li>Grey_Alerts</li>
        <li>Orange_Alerts</li>
        <li>Red_Alerts</li>
        <li>Measurements_Alerts</li>
        <li>Combination_Alerts</li>
        <li>Remark_Alerts</li>
        <li>Overdues_Alerts</li>
        <li>Average_Alerts</li>
        <li>Total_Alerts</li>
    </ul>
</details>
<details>
    <summary>measurements</summary>
    <ul>
        <li>Patient_UUID</li>
        <li>First_Name</li>
        <li>Middle_Name</li>
        <li>Last_Name</li>
        <li>Patient_Number</li>
        <li>Group</li>
        <li>Program</li>
        <li>Measurement_Date</li>
        <li>Measurement_Name</li>
        <li>Measurement_Value</li>
        <li>Alert_Flag</li>
        <li>Alert_Type</li>
        <li>Alert_Created_Date</li>
        <li>Alert_Processed_Type</li>
        <li>Alert_Processed_Action</li>
        <li>Alert_Processed_At</li>
        <li>Alert_Processed_By_UUID</li>
    </ul>
</details>
<details>
  <summary>alerts</summary>
  <ul>
    <li>Patient_UUID</li>
    <li>Group</li>
    <li>Program</li>
    <li>Alert_Flag</li>
    <li>Alert_Type</li>
    <li>Measurement_Name</li>
    <li>Alert_Created_Date</li>
    <li>Alert_Processed_Type</li>
    <li>Alert_Processed_Action</li>
    <li>Alert_Processed_At</li>
		<li>Alert_Processed_By_UUID</li>
  </ul>
</details>
<details>
    <summary>hcps</summary>
    <ul>
        <li>UUID</li> 
        <li>First_Name</li> 
        <li>Middle_Name</li> 
        <li>Last_Name</li> 
        <li>Email</li> 
        <li>User_Name</li> 
        <li>Language</li> 
        <li>Role</li> 
        <li>Status</li> 
        <li>Last_Login_At</li> 
        <li>Last_Logout_At</li> 
        <li>Groups (comma separated list)</li> 
        <li>Processed_Alerts (the amount of alerts the HCP has processed)</li>
    </ul>
</details>
<details>
    <summary>patientsMutations</summary>
    <ul>
        <li>Patient_UUID</li>
        <li>First_Name</li>
        <li>Middle_Name</li>
        <li>Last_Name</li>
        <li>Patient_Number</li>
        <li>Type (Group or Program)</li>
        <li>Mutation_Date</li>
    </ul>
</details>
<details>
    <summary>starRatings</summary>
    <ul>
        <li>Group</li>
        <li>Date</li>
        <li>Patient_UUID</li>
        <li>Score</li>
        <li>Remarks</li>
    </ul>
</details>
`}</HTMLBlock>

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Public API reference",
    "description": "Full list of available endpoints.",
    "version": "1.0"
  },
  "paths": {
    "/v1/csvexport/{reportType}": {
      "post": {
        "tags": [
          "Exports"
        ],
        "summary": "Generate CSV export",
        "description": "Generate a CSV export to be received via email",
        "operationId": "028e69ac2c17d1bcff345251e1ad8ed2",
        "parameters": [
          {
            "name": "reportType",
            "in": "path",
            "description": "Report type",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "patients",
                "hcps",
                "patientsMutations",
                "measurements",
                "measurementsWithQuestionnaires",
                "alerts",
                "starRatings"
              ]
            },
            "example": "alerts"
          },
          {
            "name": "startDate",
            "in": "query",
            "description": "First day of the selected data. Must be given if the reportType is 'alerts' or 'measurements'. Optional if reportType is 'measurementsWithQuestionnaires'. Forbidden for other values of reportType.",
            "schema": {
              "$ref": "#/components/schemas/dateSchema"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "description": "Last day of the selected data. Must be given if the reportType is 'alerts' or 'measurements'. Optional if reportType is 'measurementsWithQuestionnaires'. Forbidden for other values of reportType.",
            "schema": {
              "$ref": "#/components/schemas/dateSchema"
            }
          },
          {
            "name": "sendEmail",
            "in": "query",
            "description": "Whether to send a link to the exported file to the email of the user. Can be true or false, defaults to false.",
            "schema": {
              "type": "string",
              "default": "false",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Success response if everything works",
            "content": {
              "application/json": {
                "schema": {
                  "required": [
                    "meta"
                  ],
                  "properties": {
                    "meta": {
                      "required": [
                        "message",
                        "uri"
                      ],
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Export request queued"
                        },
                        "uri": {
                          "type": "string",
                          "example": "Export file uri"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "dateSchema": {
        "type": "string",
        "format": "date",
        "example": "2023-05-23"
      }
    },
    "responses": {
      "Unprocessable": {
        "description": "Unprocessable entity, i.e. Validation error",
        "x-statusCode": "422"
      },
      "ServiceUnavailable": {
        "description": "Service unavailable, e.g. when the functionality is disabled",
        "x-statusCode": "503"
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "description": "Bearer token. Just enter the token itself without 'Bearer' keyword",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Exports",
      "description": "Exports related endpoints",
      "externalDocs": {
        "description": "Exports Api guide",
        "url": "https://integrations.luscii.com/docs/export-api"
      }
    }
  ],
  "externalDocs": {
    "description": "General Public API Documentation",
    "url": "https://integrations.luscii.com/docs/public-api"
  },
  "servers": [
    {
      "url": "https://vitalsapi.luscii.com/"
    }
  ],
  "x-readme": {}
}
```