---
updatedAt: 2026-09-04T05:36:48.000Z
agentTools:
  projectIndex: https://developer.intellistack.com/llms.txt
---

# Create or update several dataset substitutions atomically

Validates the whole replacement graph — including constraints that span the mappings in the request, such as a field substitute parented by an entity this same batch remaps — and then commits every mapping or none. Each response reports an outcome per mapping, so a rejected batch tells the caller everything that is wrong in one round-trip.

A mapping whose original already has a substitute repoints it, releasing the substitute it used to hold, so a request may hand that substitute to a different original in the same batch. The graph is judged on the state the request would leave behind, not on the rows stored when it arrived.

# OpenAPI definition

```json
{
  "components": {
    "schemas": {
      "DataSetSubstitution": {
        "properties": {
          "createdAt": {
            "format": "date-time",
            "readOnly": true,
            "type": "string"
          },
          "datasetId": {
            "format": "uuid",
            "type": "string"
          },
          "objectType": {
            "$ref": "#/components/schemas/DatasetSubstitutionObjectType"
          },
          "originalId": {
            "format": "uuid",
            "type": "string"
          },
          "substituteId": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "datasetId",
          "objectType",
          "originalId",
          "substituteId"
        ],
        "type": "object"
      },
      "DataSetSubstitutionBatchRequest": {
        "properties": {
          "substitutions": {
            "description": "The mappings to apply together. Order is irrelevant: a field substitute may be parented by an entity that another mapping in the same request remaps, regardless of their positions. Each original may appear at most once. The upper bound exists because every mapping costs catalog reads; it is enforced by the service as well, so it holds for any caller.",
            "items": {
              "$ref": "#/components/schemas/DataSetSubstitutionRequest"
            },
            "maxItems": 100,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "substitutions"
        ],
        "type": "object"
      },
      "DataSetSubstitutionBatchResponse": {
        "properties": {
          "applied": {
            "description": "Whether the batch was committed. False means nothing was persisted, including the mappings reported as VALID.",
            "type": "boolean"
          },
          "message": {
            "description": "Top level summary. Populated when the batch was rejected.",
            "type": "string"
          },
          "results": {
            "description": "One entry per mapping in the request, in request order.",
            "items": {
              "$ref": "#/components/schemas/DataSetSubstitutionBatchResult"
            },
            "type": "array"
          },
          "traceId": {
            "description": "Internal traceId",
            "type": "string"
          }
        },
        "required": [
          "applied",
          "results"
        ],
        "type": "object"
      },
      "DataSetSubstitutionBatchResult": {
        "description": "The outcome of one requested mapping. `substitution` is populated only for an APPLIED mapping and `error` only for an INVALID one.",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorDetails"
          },
          "objectType": {
            "$ref": "#/components/schemas/DatasetSubstitutionObjectType"
          },
          "originalId": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/DataSetSubstitutionMappingStatus"
          },
          "substituteId": {
            "format": "uuid",
            "type": "string"
          },
          "substitution": {
            "$ref": "#/components/schemas/DataSetSubstitution"
          }
        },
        "required": [
          "objectType",
          "originalId",
          "substituteId",
          "status"
        ],
        "type": "object"
      },
      "DataSetSubstitutionMappingStatus": {
        "description": "The outcome of one mapping. APPLIED means the batch succeeded and this mapping was committed. VALID means the mapping passed validation but the batch was rejected elsewhere, so it was not committed. INVALID means this mapping is the reason (or one of the reasons) the batch failed.",
        "enum": [
          "APPLIED",
          "VALID",
          "INVALID"
        ],
        "type": "string"
      },
      "DataSetSubstitutionRequest": {
        "properties": {
          "objectType": {
            "$ref": "#/components/schemas/DatasetSubstitutionObjectType"
          },
          "originalId": {
            "format": "uuid",
            "type": "string"
          },
          "substituteId": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "objectType",
          "originalId",
          "substituteId"
        ],
        "type": "object"
      },
      "DatasetSubstitutionObjectType": {
        "enum": [
          "ENTITY",
          "FIELD",
          "RELATIONSHIP"
        ],
        "type": "string"
      },
      "ErrorDetails": {
        "description": "Details of an error",
        "properties": {
          "code": {
            "description": "Internal error code",
            "type": "string"
          },
          "detail": {
            "description": "Error details",
            "type": "string"
          },
          "sourceError": {
            "$ref": "#/components/schemas/ErrorDetails"
          },
          "title": {
            "description": "Error title",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ErrorEnvelope": {
        "description": "Contains a list of errors",
        "properties": {
          "errors": {
            "items": {
              "$ref": "#/components/schemas/ErrorDetails"
            },
            "type": "array"
          },
          "message": {
            "description": "Top level message to describe the error",
            "type": "string"
          },
          "traceId": {
            "description": "Internal traceId",
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "bearerFormat": "JWT",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "title": "Data Activation",
    "version": "0.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/activation/dataset/{dataSetId}/substitutions/batch": {
      "post": {
        "description": "Validates the whole replacement graph — including constraints that span the mappings in the request, such as a field substitute parented by an entity this same batch remaps — and then commits every mapping or none. Each response reports an outcome per mapping, so a rejected batch tells the caller everything that is wrong in one round-trip.\n\nA mapping whose original already has a substitute repoints it, releasing the substitute it used to hold, so a request may hand that substitute to a different original in the same batch. The graph is judged on the state the request would leave behind, not on the rows stored when it arrived.",
        "operationId": "createDataSetSubstitutionsBatchV2",
        "parameters": [
          {
            "description": "The ID of the dataset",
            "in": "path",
            "name": "dataSetId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataSetSubstitutionBatchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataSetSubstitutionBatchResponse"
                }
              }
            },
            "description": "Every mapping was validated and committed."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/DataSetSubstitutionBatchResponse"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorEnvelope"
                    }
                  ]
                }
              }
            },
            "description": "Nothing was persisted. When the batch was evaluated, the body is a DataSetSubstitutionBatchResponse reporting an outcome for every mapping in the request — including a payload that contradicts itself, such as two mappings claiming the same substitute, which can never succeed on retry. An entity mapping that would strand field substitutions resolving through the entity it currently maps onto is rejected here: include those field mappings in the same batch request. When the request was rejected before it could be evaluated at all (malformed body, or a substitutions array outside its size bounds) there are no per-mapping outcomes to report and the body is an ErrorEnvelope."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "No active dataset exists with this ID for the caller's organization."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataSetSubstitutionBatchResponse"
                }
              }
            },
            "description": "Every rejected mapping names a substitute already held by a substitution this request does not rewrite, so the caller can refresh and retry. A batch containing any other kind of rejection answers 400 instead, because those cannot succeed on retry. Nothing was persisted; the body reports an outcome for every mapping in the request."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Create or update several dataset substitutions atomically",
        "tags": [
          "Dataset"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "US Production Server",
      "url": "https://api-us.streamline.intellistack.ai"
    },
    {
      "description": "Canada Production Server",
      "url": "https://api-ca.streamline.intellistack.ai"
    }
  ],
  "tags": [
    {
      "description": "v2 Data set related endpoints",
      "name": "Dataset"
    }
  ]
}
```