> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GDPR Webhooks

> Mandatory GDPR webhook topics, payload schemas, and compliance deadlines

# GDPR Webhooks

Every app installed on a LaunchMyStore merchant **must** respond to three
mandatory GDPR webhook topics. These webhooks are dispatched by the
platform when a merchant files a GDPR request through their admin, and
48 hours after a merchant uninstalls your app, and your app is legally
required to acknowledge receipt and process the data within fixed
deadlines.

| Topic | Article | Trigger | Deadline (acknowledge / complete) |
| - | - | - | - |
| `customers/data_request` | GDPR Art. 15 (right of access) | Merchant initiates data export for a customer. | **30 days / 90 days** |
| `customers/redact` | GDPR Art. 17 (right to erasure) | Merchant initiates data deletion for a customer. | **30 days / 90 days** |
| `shop/redact` | GDPR Art. 17 (store erasure) | 48 hours after the merchant uninstalls your app — not sent if they reinstall it within that time — or when the merchant files a store-erasure request. | **30 days / 90 days** |

> [!WARNING]
>
> Failure to acknowledge within 30 days marks the request as `failed` for
> your app and notifies the merchant. Failure to complete within 90 days
> also marks the request as `failed` and is grounds for app removal from
> the marketplace.

## Where GDPR webhooks go

Configure your endpoints in either (or both) of two places — the platform
sends each request once per distinct URL:

1. **Your app manifest** — `webhooks[]` entries for the three topics, e.g.
   `{ "topic": "shop/redact", "endpoint": "${APP_URL}/webhooks/gdpr/shop-redact" }`.
   GDPR topics cannot be subscribed through `POST /api/v1/webhooks.json`.
2. **The developer portal** — your app's **Webhooks** page, *GDPR
   Compliance Webhooks* section (customer data request, customer redact,
   shop redact URLs).

Every installed app receives the request — no scope is involved. Webhooks
are HMAC-signed with the app's current `clientSecret` and have a 10s
timeout. A failed delivery of a merchant-filed request is logged but not
retried by the delivery queue; the deadline sweep re-sends it (see below).
Your app must acknowledge receipt via
`POST /apps/gdpr/acknowledge/:requestId` within the deadline, regardless of
HTTP delivery success.

> [!NOTE]
>
> **After an uninstall.** `shop/redact` reaches an uninstalled app 48 hours
> after the uninstall, at the endpoints above. That app's access token was
> revoked at uninstall, so it cannot call the acknowledge endpoint — a `2xx`
> response to the delivery is its acknowledgment. Until it answers `2xx` the
> platform retries hourly for three days. If the merchant reinstalls the app
> within the 48 hours, the request is cancelled.

## Request Headers

| Header | Value |
| - | - |
| `Content-Type` | `application/json` |
| `X-LMS-Topic` | One of `customers/data_request`, `customers/redact`, `shop/redact` |
| `X-LMS-Gdpr-Request-Id` | The `requestId` (UUID) needed for the acknowledge/complete callbacks |
| `X-LMS-Hmac-SHA256` | `base64(HMAC-SHA256(clientSecret, body))` — verify this matches before processing |
| `X-LMS-Shop-Domain` / `X-LMS-Shop-Id` | The store the request is about |
| `X-LMS-Webhook-Id` | Unique per delivery |
| `X-LMS-Api-Version`, `X-LMS-Delivery-Attempt`, `X-LMS-Triggered-At` | As on every webhook |

## Payload: `customers/data_request`

```json theme={null}
{
  "shop_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "shop_domain": "acme-supply.launchmystore.io",
  "customer": {
    "id": "ac1f2d3e-4b5c-6789-0123-456789abcdef",
    "email": "jane@example.com",
    "phone": "+15551234567"
  },
  "orders_requested": true,
  "data_request": {
    "id": "9f8e7d6c-5b4a-3210-1234-56789abcdef0"
  }
}
```

| Field | Type | Notes |
| - | - | - |
| `shop_id` | string (UUID) | Merchant's `storeId`. |
| `shop_domain` | string \| null | The merchant's primary `storeURL`. |
| `customer.id` | string \| null | Customer record ID. Null for unidentified customer lookups by email/phone only. |
| `customer.email` | string \| null | Customer email (always present unless redacted). |
| `customer.phone` | string \| null | Customer phone if provided. |
| `orders_requested` | boolean | `true` means the merchant wants order history included in the export. |
| `data_request.id` | string (UUID) | The `requestId`. Use this for acknowledge/complete callbacks. |

## Payload: `customers/redact`

```json theme={null}
{
  "shop_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "shop_domain": "acme-supply.launchmystore.io",
  "customer": {
    "id": "ac1f2d3e-4b5c-6789-0123-456789abcdef",
    "email": "jane@example.com"
  },
  "orders_to_redact": [
    "ord_1a2b3c4d5e6f7g8h",
    "ord_9i8j7k6l5m4n3o2p"
  ]
}
```

| Field | Type | Notes |
| - | - | - |
| `shop_id` | string (UUID) | Merchant's `storeId`. |
| `shop_domain` | string \| null | Primary storefront domain. |
| `customer.id` | string | Customer record ID. |
| `customer.email` | string | Customer email at the time of redaction. |
| `orders_to_redact` | string\[] | List of all order IDs belonging to this customer. Your app should redact PII from any records tied to these orders, not just the customer record. |

## Payload: `shop/redact`

```json theme={null}
{
  "shop_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "shop_domain": "acme-supply.launchmystore.io"
}
```

Fired 48 hours after the merchant uninstalls your app, or when the merchant
files a store-erasure request. Your app must delete **all** data associated
with `shop_id` within 90 days. Keep data until you actually receive it — an
uninstall alone is not a deletion request, and merchants often reinstall.

## Required Response

Webhook handlers should return HTTP `200`-`299` quickly (the platform
timeout is 10s). The HTTP response itself does **not** acknowledge the
request — you must call the merchant-facing acknowledge endpoint
explicitly:

```bash theme={null}
curl -X POST "https://api.launchmystore.io/apps/gdpr/acknowledge/{requestId}" \
  -H "Authorization: Bearer YOUR_APP_ACCESS_TOKEN"
```

Then, once you have processed the request, mark it complete:

```bash theme={null}
curl -X POST "https://api.launchmystore.io/apps/gdpr/complete/{requestId}" \
  -H "Authorization: Bearer YOUR_APP_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "dataExportUrl": "https://your-app.com/exports/abc.zip"
  }'
```

`dataExportUrl` is only relevant for `customers/data_request` — it is
displayed in the merchant admin so they can hand the export to the
customer.

## Merchant Endpoints

These are used by the LaunchMyStore admin (not your app), but are
documented here for completeness.

### `POST /apps/gdpr/data-request`

Merchant-initiated. Creates a new `customers/data_request` and dispatches
webhooks to every installed app.

```json theme={null}
{
  "customerId": "ac1f2d3e-...",
  "customerEmail": "jane@example.com",
  "customerPhone": "+15551234567"
}
```

Response data:

```json theme={null}
{
  "requestId": "9f8e7d6c-...",
  "status": "pending",
  "acknowledgeDeadline": "2026-06-15T00:00:00.000Z",
  "completionDeadline": "2026-08-14T00:00:00.000Z",
  "appsNotified": 7
}
```

### `POST /apps/gdpr/customer-redact`

```json theme={null}
{
  "customerId": "ac1f2d3e-...",
  "customerEmail": "jane@example.com"
}
```

Response includes `ordersToRedact` count.

### `POST /apps/gdpr/shop-redact`

No body. Returns the same shape as the others.

### `GET /apps/gdpr/requests`

Lists GDPR requests for the merchant's store.

| Query | Type | Notes |
| - | - | - |
| `page` | integer | Default `1` |
| `limit` | integer | Default `20` |
| `status` | enum | `pending`, `dispatched`, `acknowledged`, `completed`, `failed` |
| `requestType` | enum | `data_request`, `customer_redact`, `shop_redact` |

### `GET /apps/gdpr/requests/:requestId`

Returns the full request including per-app acknowledgment state:

```json theme={null}
{
  "requestId": "9f8e7d6c-...",
  "requestType": "data_request",
  "status": "acknowledged",
  "customerId": "ac1f2d3e-...",
  "customerEmail": "jane@example.com",
  "requestedAt": "2026-05-16T12:34:56.000Z",
  "acknowledgeDeadline": "2026-06-15T12:34:56.000Z",
  "completionDeadline": "2026-08-14T12:34:56.000Z",
  "completedAt": null,
  "appAcknowledgments": [
    {
      "appId": "lms_app_foundry_reviews",
      "appName": "Foundry Reviews",
      "status": "completed",
      "acknowledgedAt": "2026-05-16T12:35:11.000Z",
      "completedAt": "2026-05-18T09:00:00.000Z"
    },
    {
      "appId": "lms_app_loyalty_pro",
      "appName": "Loyalty Pro",
      "status": "pending",
      "errorMessage": null
    }
  ],
  "dataExportUrl": "https://foundry.example/exports/abc.zip",
  "metadata": { "ordersRequested": true }
}
```

## Deadline Enforcement

A cron runs daily at midnight (`@Cron(EVERY_DAY_AT_MIDNIGHT)`) that:

1. Finds requests past `acknowledgeDeadline` still in `pending` /
   `dispatched`, marks the lagging apps as `failed`, sets the request
   status to `failed`, and re-dispatches the webhook as a final notice.
2. Finds requests past `completionDeadline` still in `dispatched` /
   `acknowledged`, marks lagging apps as `failed`, request → `failed`.
3. Finds requests with `completionDeadline` within the next 7 days and
   re-dispatches the webhook as a reminder.

## HMAC Verification

```javascript theme={null}
import crypto from 'crypto';

function verifyGdprWebhook(req, clientSecret) {
  const hmacHeader = req.get('X-LMS-Hmac-SHA256');
  const body = req.rawBody; // raw bytes, NOT JSON.stringify(req.body)
  const expected = crypto
    .createHmac('sha256', clientSecret)
    .update(body)
    .digest('base64');

  // constant-time compare
  return (
    hmacHeader.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(hmacHeader), Buffer.from(expected))
  );
}
```

## Status Lifecycle

```
pending ─► dispatched ─► acknowledged ─► completed
                  │             │
                  └──► failed ◄─┘   (deadline missed)
```

Per-app `appAcknowledgments[].status` is one of `pending`,
`acknowledged`, `completed`, `failed`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.