---
title: "Create a Nexset"
method: POST
path: "/data_sets"
tags: ["Nexsets (Data Sets)"]
---

# Create a Nexset

`POST /data_sets`

## Request

- Base URL: `https://dataops.nexla.io/nexla-api`
- URL: `https://dataops.nexla.io/nexla-api/data_sets`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/nexla/apis/nexla-rest-api/docs/data_sets/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a Nexset from another Nexset.

The endpoint accepts a parent Nexset ID along with all transform and validation rules that should be applied to the parent Nexset. 

The two payload variants reflect the following two ways of specifying transform rules: 
1. Attach the transform code that should be applied: Set `has_custom_transform: false`, and attach a `transform` code snippet. 
2. Use the ID of a reusable record transform: Set `has_custom_transform: false`, and attach the `transform_id` of the record transform to be applied.

## Request body

- union
  - object
    - `has_custom_transform` false, required: Set this to `false` to indicate that the payload contains the `transform` code that should be used for creating the output schema.
    - `transform` object: Transform code that should be applied on the parent Nexset.
    - `name` string, required
    - `description` string
    - `parent_data_set_id` integer, required: Nexset ID of the parent Nexset on which all the rules should be applied for creating this Nexset.
    - `output_schema_annotations` object: You can document details about important Nexset attributes by annotating them with short descriptions. Set descriptions for all such attributes by adding them to this object. Attributes should be added in standard JSON schema path format. You can refer to Nexset's output schema structure for guidance.
      - `properties` unknown
    - `output_schema_validation_enabled` boolean: Set this to true and attach the relevant `output_validation_schema` if you want all records to be validated against some JSON schema validation rules. Records that fail validation will be routed to the Nexset error queue instead of the Nexset output.
    - `output_validation_schema` object: You can set JSON Schema validation rules that should be applied on every record of this Nexset. See https://json-schema.org/learn/getting-started-step-by-step.html for guidance on writing JSON schema validation rules.
    - `data_sinks` union[]: You can choose to attach one or more data sinks to this Nexset. Each data sink will receive the output of this Nexset when the Nexset generates output records.
      - union
        - integer: The ID of the data sink.
        - object: The payload for creating a Nexla data sink with this request. The platform will automatically create a data sink and attach its ID as a reference.
    - `custom_config` object: `Reserved for Nexla UI`: This field is used by Nexla UI for display instructions when displaying this Nexset on the UI. This entry has no impact on how the Nexla data plane processes data for this Nexset.
    - `tags` string[]
  - object
    - `has_custom_transform` true, required: Set this to `true` to indicate that the payload contains the `transform_id` of a transform that should be applied for creating the output schema.
    - `transform_id` integer: Id of a reusable record transform that should be applied on the parent Nexset.
    - `name` string, required
    - `description` string
    - `parent_data_set_id` integer, required: Nexset ID of the parent Nexset on which all the rules should be applied for creating this Nexset.
    - `output_schema_annotations` object: You can document details about important Nexset attributes by annotating them with short descriptions. Set descriptions for all such attributes by adding them to this object. Attributes should be added in standard JSON schema path format. You can refer to Nexset's output schema structure for guidance.
      - `properties` unknown
    - `output_schema_validation_enabled` boolean: Set this to true and attach the relevant `output_validation_schema` if you want all records to be validated against some JSON schema validation rules. Records that fail validation will be routed to the Nexset error queue instead of the Nexset output.
    - `output_validation_schema` object: You can set JSON Schema validation rules that should be applied on every record of this Nexset. See https://json-schema.org/learn/getting-started-step-by-step.html for guidance on writing JSON schema validation rules.
    - `data_sinks` union[]: You can choose to attach one or more data sinks to this Nexset. Each data sink will receive the output of this Nexset when the Nexset generates output records.
      - union
        - integer: The ID of the data sink.
        - object: The payload for creating a Nexla data sink with this request. The platform will automatically create a data sink and attach its ID as a reference.
    - `custom_config` object: `Reserved for Nexla UI`: This field is used by Nexla UI for display instructions when displaying this Nexset on the UI. This entry has no impact on how the Nexla data plane processes data for this Nexset.
    - `tags` string[]

## Response `200`

Success

- DataSet
  - `id` integer
  - `owner` UserSimplified
    - `id` integer
    - `full_name` string
    - `email` string
    - `email_verified_at` string, date-time
  - `org` OrgSimplified
    - `id` integer
    - `name` string
    - `email_domain` string
    - `email` string
    - `client_identifier` string
    - `org_webhook_host` string
  - `name` string
  - `description` string
  - `status` string
  - `data_source_id` integer, nullable: Id of the data source this Nexset was detected from. This is only relevant for detected Nexsets.
  - `data_source` DataSource
    - `id` integer
    - `owner_id` integer
    - `org_id` integer
    - `name` string
    - `description` string, nullable
    - `status` string
    - `source_type` string
    - `connector` object
      - `id` integer
      - `type` string
      - `connection_type` string
      - `name` string
      - `description` string
      - `nexset_api_compatible` boolean
    - `vendor_id` string, nullable
  - `parent_data_sets` DataSetBrief[]: Details about the Nexset this Nexset is derived from. This element is empty in case of detected Nexsets and has 1 item in case of derived Nexsets.
    - `id` integer
    - `owner_id` integer
    - `org_id` integer
    - `name` string
    - `description` string
    - `created_at` string, date-time
    - `updated_at` string, date-time
  - `data_sinks` DataSinkSimplified[]: Details about every data sink this Nexset is directly connected to.
    - `id` integer
    - `owner_id` integer
    - `org_id` integer
    - `name` string
    - `status` string
    - `sink_type` string
  - `access_roles` string[]: This property reflects all the permissions the user/team/organization has to this resource. 1. `collaborator`: The user/team/organization can view the resource but not make any modifications to it. 2. `operator`: The user/team/organization can view the resource and can activate/pause it, but not make any other modifications to it. 3. `administrator`: The user/team/organization has complete administrative rights to this resource. 4. `owner`: This user created the resource and so has complete administrative rights to it.
  - `transform_id` integer, nullable: The ID of the Transform entity that has been used to create the output of this Nexset from the parent Nexset. This element is null for detected Nexsets.
  - `output_schema` object: JSON schema of this Nexset's output.
  - `copied_from_id` integer: Reference ID of the Nexset that this Nexset was created as a copy of. This is only valid if the Nexset was created by issuing a request to the `copy` endpoint of another Nexset.
  - `created_at` string, date-time
  - `updated_at` string, date-time
  - `tags` string[]
  - `flow_type` string: The flow type of the origin node.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden

---

[API](https://skmtc.dev/nexla/apis/nexla-rest-api.md) - [All operations](https://skmtc.dev/nexla/apis/nexla-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nexla/apis/nexla-rest-api/revisions/ef02be92fe7b?raw)
