# Migrating to Bulk DSR Submission (/docs/dsr-automation/api-integration/migrating-to-bulk-dsr-submission)

Admin Dashboard pages: /privacy-requests/workflows/*, /privacy-requests/identifiers, /privacy-requests/workflows

After this guide, your code sends data subject requests (DSRs) to `POST /v1/data-subject-request-bulk` instead of `POST /v1/data-subject-request`. Bulk submission runs against Workflows, takes up to 100 requests per call, and replaces the single-request endpoint, which will be retired.

For the full request and response schema, see the [bulk API reference](/docs/api-reference/data-subject-request/post-v1-data-subject-request-bulk).

## Before you start [#before-you-start]

- Your organization uses Workflows. Open [**Workflows → DSR Workflows**](https://app.transcend.io/privacy-requests/workflows). If that page is not in the sidebar, ask Transcend support to turn Workflows on. See [the Workflows quickstart](../quickstarts/workflows-quickstart.mdx).
- Each action (the request type, such as `ERASURE`) and data subject that you submit has a published workflow.
- If you host Sombra yourself, use version 7.676.0 or later. [Sombra versions](#sombra-versions) lists what earlier versions return.
- Your API key has the **Submit New Data Subject Request** scope. This is the same scope as the single-request endpoint, so your current key works.

## Keep the single-request endpoint while you migrate [#keep-the-single-request-endpoint-while-you-migrate]

You can keep calling `POST /v1/data-subject-request` while you change your code. Route those calls into a workflow:

1. In the workflow, open the **Workflow Details** step.
2. Under **Advanced Settings**, turn on **Accept legacy API submissions**.

A call whose `type` and `subjectType` match that workflow then runs against it. Only one non-draft workflow per request type and data subject can have this setting on.

If no workflow has the setting on, the call does not fail. Transcend creates the request on the legacy path, outside your workflows.

## 1. Find the workflow config ID [#1-find-the-workflow-config-id]

1. In the Admin Dashboard, go to [**Workflows → DSR Workflows**](https://app.transcend.io/privacy-requests/workflows).
2. Open the workflow for the request type and data subject you submit today.
3. Copy the ID from the page URL. The URL looks like `https://app.transcend.io/privacy-requests/workflows/<workflowConfigId>/configuration`.

In your code, map each `type` and `subjectType` pair you send today to one `workflowConfigId`. You pass that value on each bulk request.

## 2. Change the request body [#2-change-the-request-body]

Only the path and the body change. The `authorization` header stays the same. If you host Sombra yourself, you also send `x-sombra-authorization`. See [Authenticating to Sombra](../../overview/developer-tools/authentication.mdx#authenticating-to-sombra).

Before, with the single-request endpoint:

```bash
curl -X POST https://multi-tenant.sombra.transcend.io/v1/data-subject-request \
  -H 'authorization: Bearer <api key>' \
  -H 'content-type: application/json' \
  -d '{
    "type": "ERASURE",
    "subjectType": "customer",
    "subject": {
      "coreIdentifier": "id-123456789",
      "email": "user@example.com",
      "emailIsVerified": true,
      "attestedExtraIdentifiers": {
        "custom": [{ "name": "username", "value": "mbrook" }]
      }
    },
    "isSilent": true
  }'
```

After, with the bulk endpoint:

```bash
curl -X POST https://multi-tenant.sombra.transcend.io/v1/data-subject-request-bulk \
  -H 'authorization: Bearer <api key>' \
  -H 'content-type: application/json' \
  -d '{
    "input": [
      {
        "workflowConfigId": "<your workflow config ID>",
        "attestedAuthContext": {
          "coreIdentifier": "id-123456789",
          "email": "user@example.com",
          "emailIsVerified": true,
          "attestedExtraIdentifiers": {
            "username": [{ "value": "mbrook" }]
          }
        },
        "isSilent": true
      }
    ]
  }'
```

These fields change:

| Single-request field                                         | Bulk field                                                                                                                                                                                                                                         |
| ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `subject`                                                    | `attestedAuthContext`, with the same `coreIdentifier`, `email`, and `emailIsVerified`                                                                                                                                                              |
| `subject.attestedExtraIdentifiers.custom: [{ name, value }]` | `attestedExtraIdentifiers.<identifier name>: [{ value }]`. `<identifier name>` is the name in [**Workspace Configuration → Identifiers**](https://app.transcend.io/privacy-requests/identifiers). The `custom` form still works and is deprecated. |
| `type`                                                       | Omit it. The workflow sets the request type. If you send it and it does not match, that request fails with `TYPE_NOT_MATCHING_WORKFLOW`.                                                                                                           |
| `subjectType`                                                | Omit it. The workflow sets the data subject. If you send it and it does not match, that request fails with `SUBJECT_TYPE_NOT_MATCHING_WORKFLOW`.                                                                                                   |
| `workflowConfigId`                                           | Required. On the single-request endpoint it is optional.                                                                                                                                                                                           |

These fields keep the same name: `isSilent`, `isTest`, `locale`, `details`, `region`, `partitionKey`, `requestId`, `createdAt`, `dataSiloIds`, `ignoreDataSiloIds`, `replyToEmailAddresses`, `emailReceiptTemplateId`, `skipWaitingPeriod`, `skipSendingReceipt`, `skipEnrichmentChecks`, and `completedRequestStatus`.

A key the bulk endpoint does not define fails that request with `INVALID_REQUEST_INPUT`. `subject` is one of those keys.

The bulk endpoint also checks these fields against the workflow. Each check fails only that request:

- `region`, when sent, must be in the workflow's region list. Otherwise the request fails with `REGION_NOT_IN_WORKFLOW`.
- Every ID in `dataSiloIds` must be connected to the workflow. Otherwise the request fails with `DATA_SILO_NOT_IN_WORKFLOW`.
- You can send `dataSiloIds` or `ignoreDataSiloIds`, not both. Both fail the request with `CONFLICTING_DATA_SILO_FILTERS`.

## 3. Read the new response [#3-read-the-new-response]

<Callout type="warn">
  A one-for-one swap sends one input. When that person already has an open request, the call returns a 400 with `DUPLICATE_OPEN_REQUEST`. It does not return an `ALREADY_OPEN` outcome. Do not send that input again.
</Callout>

The single-request field `request.id` is now `requests[].id`. A batch that creates some requests and rejects others returns HTTP 200.

```json
{
  "requests": [
    { "id": "...", "outcome": "CREATED", "inputIndex": 0 },
    { "id": "...", "outcome": "ALREADY_OPEN", "inputIndex": 2 }
  ],
  "validationErrors": [
    {
      "code": "REGION_NOT_IN_WORKFLOW",
      "index": 1,
      "message": "..."
    }
  ]
}
```

Update your code to:

1. Match each entry in `requests` to your input with `inputIndex`. `validationErrors` uses `index` for the same position. The two names differ. Both are the position in your `input` array.
2. Read `outcome`. `CREATED` is a new request. `ALREADY_OPEN` means the person already has an open request for this workflow, and `id` is that open request. A batch of one input never returns `ALREADY_OPEN`. See the warning above.
3. Read `validationErrors`. Fix those inputs and send only them again. Do not resend the inputs that succeeded.
4. Branch on `code`, not on `message`. Messages can change.

The call returns a 400 and creates no requests when every input fails, when the batch has more than 100 inputs, or when the body is not valid. The [bulk API reference](/docs/api-reference/data-subject-request/post-v1-data-subject-request-bulk) lists every case and every error code.

## 4. Group requests into batches [#4-group-requests-into-batches]

Send up to 100 requests per call. If you submitted one request per call before, collect them and send them together. This uses fewer calls against your rate limit.

A batch is not one transaction. If a call fails with a 500 or times out, some requests in it may already exist.

Send that batch again only when it has more than one input and none of those inputs set `dataSiloIds`. Inputs that match an open request return `ALREADY_OPEN`.

A batch of one input returns 400 `DUPLICATE_OPEN_REQUEST` instead. Do not send that input again.

An input with `dataSiloIds` skips the open-request check. If the first call returned an `id` for that input, leave it out of the retry. Sending it again creates a second request.

## Sombra versions [#sombra-versions]

If Transcend hosts your Sombra, skip this section. Transcend runs the current version for you.

Self-hosted Sombra controls what the bulk endpoint returns:

| Sombra version | Behavior                                                                                                          |
| -------------- | ----------------------------------------------------------------------------------------------------------------- |
| 7.438.0        | The bulk endpoint is available                                                                                    |
| 7.553.0        | Each entry in `requests` has an `outcome`                                                                         |
| 7.586.0        | The response has `validationErrors`, and each request has `inputIndex`                                            |
| 7.676.0        | Requests that fail Sombra's own checks go to `validationErrors`. Before this version, they reject the whole batch |

Sombra's own checks run before the request reaches Transcend. An unknown field fails with `INVALID_REQUEST_INPUT`. An identifier name your organization has not defined fails with `IDENTIFIER_VALIDATION_FAILED`.

Set [`ENABLE_BULK_DSR_PARTIAL_FORWARD`](../../sombra/environment-variables.mdx) to `false` only when your client treats every 200 as a fully created batch and cannot read `validationErrors` yet. One failed row then rejects the whole batch, and no requests are created.
