# Create Dataset From Project

[block:callout]
{
  "type": "info",
  "title": "[Click for Python SDK](https://docs.nucleus.scale.com/en/latest/api/nucleus/index.html#nucleus.NucleusClient.create_dataset_from_project)",
  "body": "```\nNucleusClient.create_dataset_from_project(\n    project_id: str,\n    last_n_tasks: int,\n    name: str\n) -> Dataset\n```"
}
[/block]

If you already have `Annotation`, `SegmentAnnotation`, `VideoAnnotation`, `Categorization`, `PolygonAnnotation`, `ImaageAnnotation`, `DocumentTranscription`, `LidarLinking`, or `LidarAnnotation` projects with Scale, use this endpoint to import your project directly into Nucleus.

You'll need to specify your Scale `project_id` and the number of tasks that you want to ingest.

By default, the name of your `Dataset` will be the same as your project's name, and will ingest all tasks (both pending and completed) into the resulting dataset. You can override these defaults by using the specified request parameters.

This endpoint is asynchronous because it is possible to have a delay when the number of tasks is larger than 1000. As a result, the endpoint returns the `job_id` of an `AsyncJob`, which you can use to check the job's status (and any errors) via the [Check Async Job](https://nucleus.scale.com/reference/check-async-job) endpoint.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Nucleus API",
    "version": "1.1"
  },
  "servers": [
    {
      "url": "https://api.scale.com/v1/nucleus"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/dataset/create_from_project": {
      "post": {
        "summary": "Create Dataset From Project",
        "description": "",
        "operationId": "create-dataset-from-project",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "project_id"
                ],
                "properties": {
                  "project_id": {
                    "type": "string",
                    "description": "The id of the Scale project."
                  },
                  "last_n_tasks": {
                    "type": "integer",
                    "description": "An optional field specifying the number of tasks to ingest from the project. If this value is not set, all tasks will be imported.",
                    "format": "int32"
                  },
                  "name": {
                    "type": "string",
                    "description": "An optional field of the name for your dataset. By default it will be the same as the project name."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"dataset_id\": \"ds_bwkezj6g5c4g05gqp1eg\",\n  \"job_id\": \"job_c19xcf9mkws46gah00yg\",\n  \"job_last_known_status\": \"Running\",\n  \"job_type\": \"ingestTasks\",\n  \"job_creation_time\": \"2021-09-21T20:07:13.055Z\",\n  \"message\": \"Importing tasks in the background.  You can use the job_id field to asynchronously check the status of this job.\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "dataset_id": {
                      "type": "string",
                      "example": "ds_bwkezj6g5c4g05gqp1eg"
                    },
                    "job_id": {
                      "type": "string",
                      "example": "job_c19xcf9mkws46gah00yg"
                    },
                    "job_last_known_status": {
                      "type": "string",
                      "example": "Running"
                    },
                    "job_type": {
                      "type": "string",
                      "example": "ingestTasks"
                    },
                    "job_creation_time": {
                      "type": "string",
                      "example": "2021-09-21T20:07:13.055Z"
                    },
                    "message": {
                      "type": "string",
                      "example": "Importing tasks in the background.  You can use the job_id field to asynchronously check the status of this job."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "60a66ff6bfbc7000736519dd:61a6972a8fd5e500106e695e"
}
```