---
title: "Bulk create, upsert, or delete relationships"
method: POST
path: "/sources/{sourceKey}/v1/relationships/bulk"
tags: ["Bulk"]
---

# Bulk create, upsert, or delete relationships

`POST /sources/{sourceKey}/v1/relationships/bulk`

Bulk create, upsert, or delete relationships. The request body should contain a list of operations.
All operations will be processed even if some of them fail.

## Path parameters

- `sourceKey` string, required

## Request body

- object
  - `operations` V1RelationshipOperation[], required
    - union
      - object
        - `action` 'CREATE' | 'UPSERT' | 'DELETE' | 'UPDATE', required — The action to perform.
        - `create` V1RelationshipOperationCreateContent, required — The relationship to create.
          - `type` string, required
          - `from` V1RelationshipRef, required
            - `id` string, required
            - `type` string, required
          - `to` V1RelationshipRef, required
            - `id` string, required
            - `type` string, required
          - `meta` V1Meta
            - `createdAt` string, date-time — Instant of creation of the resource.
            - `identifier` V1Identifier[] — Identifiers of the resource. Note: Combination of `source`, `value` and `use` must be unique.
              - …
            - `source` string — The source of the resource.
            - `updatedAt` string, date-time — Last update of the resource.
          - `data` object
      - object
        - `action` 'CREATE' | 'UPSERT' | 'DELETE' | 'UPDATE', required — The action to perform.
        - `upsert` V1RelationshipOperationUpsertContent, required — The relationship to upsert.
          - `type` string, required
          - `from` V1RelationshipRef, required
            - `id` string, required
            - `type` string, required
          - `to` V1RelationshipRef, required
            - `id` string, required
            - `type` string, required
          - `data` object
          - `meta` V1Meta
            - `createdAt` string, date-time — Instant of creation of the resource.
            - `identifier` V1Identifier[] — Identifiers of the resource. Note: Combination of `source`, `value` and `use` must be unique.
              - …
            - `source` string — The source of the resource.
            - `updatedAt` string, date-time — Last update of the resource.
      - object
        - `action` 'CREATE' | 'UPSERT' | 'DELETE' | 'UPDATE', required — The action to perform.
        - `delete` V1RelationshipOperationDeleteContent, required
          - `from` V1RelationshipRef, required
            - `id` string, required
            - `type` string, required
          - `to` V1RelationshipRef, required
            - `id` string, required
            - `type` string, required
          - `type` string, required — The type of relationship to delete.

## Response `202`

The bulk operation is valid and accepted with a status 'ACCEPTED'.

- V1BulkRelationshipResponse — Response when a task has been accepted for asynchronous processing. The task will be executed in the background.
  - `taskId` string, required — The task identifier. Used to track an async task in the system. Use the task ID to poll for completion status. The taskId holds different prefix to represent different tasks. - oneOf task: `s_<id>`. - bulk task: `bk_<id>` (deprecated: `<id>` only). - bundle task: `bd_<id>` (deprecated: `<id>` only). - purge task: `pg_<id>` (deprecated: `purge:<id>`).
  - `status` 'ACCEPTED' | 'PERSISTED', required — Status of the task submission. * `ACCEPTED`: The task has been accepted for asynchronous processing. The task will be executed in the background. * `PERSISTED`: The task has been executed synchronously and the results are immediately persisted.
  - `bulkId` string, required — The task identifier. This is deprecated, please use the taskId field instead.

## Other responses

- `400` — Returned when the request is malformed or invalid.
- `413` — The request body exceeds the 5 GB limit.

---

[API](https://skmtc.dev/clinia/apis/registry-api.md) · [All operations](https://skmtc.dev/clinia/apis/registry-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/clinia/registry-api/revisions/3a9197b11351/schema)
