Skip to content

APIgator File Protect Endpoint

The /file/protect endpoint is designed for protecting bulk data provided in file format, specifically optimized for CSV output.

Overview

Unlike the standard API endpoint, the File Protect endpoint uses multipart/form-data to handle larger datasets. It is ideal for batch processing where you need to upload a dataset and receive a protected version back as a downloadable file (typically CSV).

Request Configuration

Essential Headers

Header Description Required
X-Resource-Token Your authentication token. No (depending on environment config)
X-Data-Set-Type Identify the type of payload. Defaults to LIST. Supported: JSON, XML, SQL, LIST. No
X-Body-Encoding The encoding of the rawDataSet field. Default is utf-8. No

Request Body (Multipart)

The request must be sent as multipart/form-data. It contains two main components:

  1. JSON Metadata: A part named protectFileDataset (or similar depending on your client) containing the configuration.
  2. Optional File: You can also stream data directly if configured.

Metadata Fields

Field Description
manifestName The name of the privacy manifest.
jobType Anonymise, Pseudonymise, Restrict, Encrypt, Decrypt, Reconstruct.
dataSet The string representation of the data to protect (if not sending a separate file).
countryCode Target country for data sovereignty rules.

Usage Scenarios

1. Batch CSV Generation

Use this endpoint when you have a JSON dataset but need the protected output in CSV format for ingestion into spreadsheets or legacy databases. The endpoint automatically converts the protected results into a flattened CSV structure.

2. Large Payload Handling

While the standard /api/protect endpoint is suited for real-time application integration (API to API), the /file/protect endpoint is better suited for administrative tasks or bulk data migration where the payloads might exceed standard HTTP body limits for plain JSON.

Example Request (cURL)

curl -X POST http://apigator-service/file/protect \
  -H "Content-Type: multipart/form-data" \
  -F 'protectFileDataset={
    "manifestName": "Bulk_Export_Policy",
    "jobType": "Anonymise",
    "countryCode": "GB",
    "dataSet": "[{\"id\": 1, \"sensitive\": \"secret\"}]"
  }'

Response

The response is returned with Content-Type: text/csv. This allows browsers and tools like Postman to treat the response as a file download.

Key Differences from /api/protect

  • Format: Returns text/csv instead of application/json.
  • Protocol: Uses multipart/form-data instead of simple application/json POST.
  • Purpose: Optimized for bulk exports and file-based workflows.