# Create Project

💡 Every time you use the OAuth credentials, every project will be created on behalf of the registered user’s credentials. This will be beneficial if you want to create multiple projects, and the project owner will always be the same.

## The API

{% hint style="info" %}
We are introducing a new endpoint for creating a project. For full documentation on this new mutation, please visit [here](https://docs.datasaur.ai/api/create-new-project/new-mutation-createproject).\
\
\- We will be maintaining support (bug report and fixes) for the current mutation <mark style="color:$warning;">`launchTextProjectAsync`</mark> up to March 31st, 2024. <mark style="color:red;">**As of v6.58, Datasaur won't be adding new features or enhancement to the launchTextProjectAsync mutation.**</mark>\
\- Afterwards, <mark style="color:$warning;">`launchTextProjectAsync`</mark> will remain functional until June 30th, 2024, to give users additional time for migration.\
\- After June 30th, we will be removing the mutation and the related input from our GraphQL schema definitions.
{% endhint %}

We also have a [Python script example](https://docs.datasaur.ai/api/create-new-project/python-script-example) for this. To make the API request, you can follow this [step-by-step guide](https://docs.datasaur.ai/apis-docs#how-to-call-the-api-in-a-nutshell), specifically the one with **multipart request**. It's highly recommended to use the new mutation instead of the deprecated mutation.

* New mutation: [createProject](https://api-docs.datasaur.ai/#mutation-createProject)
* Deprecated mutation: [launchTextProjectAsync](https://api-docs.datasaur.ai/#mutation-launchTextProjectAsync)

### Asynchronous Process

Since it's an asynchronous process, the response is only information about the job, not the created project. You would have to [check the job](https://docs.datasaur.ai/api/get-data/check-job) periodically to make sure whether the project is successfully created.

### How to Configure the Payload Request

Since the project creation is quite complex, it is **recommended** to configure the payload of the API request by following these steps.

1. Use the [Project Creation Wizard](https://docs.datasaur.ai/data-studio-projects/creating-a-project) (PCW) first. You can try all the way until a project is created and make sure the result is as expected. Then, open the PCW and configure the exact same way as before until the last step.
2. Once you are sure with the configuration, click the `View Script` in the top right corner of the page.
3. Then, you can just copy and paste the whole JSON object as the payload when requesting the GraphQL API.

### How to Configure the File/Document

As you can see on the input API docs, there is `documents` attribute which accept array of [CreateTextDocumentInput](https://api-docs.datasaur.ai/#definition-CreateTextDocumentInput). Map the uploaded file to the `file` attribute on this object for each document that will be used in the project.

```json
{
  "operations": {...},
  "map": {
    "firstFile": ["variables.input.documents.0.file"],
    "secondFile": ["variables.input.documents.1.file"]
  },
  "firstFile": "...",
  "secondFile": "..."
}
```

### How to Configure the Label Set and/or Question Set

By default, the label set or question set (depending on the project type that will be created) should already have been configured via PCW. The full explanation can be seen [here](https://docs.datasaur.ai/data-studio-projects/lets-get-labeling/label-sets).

* Specific for token labeling, the attribute will be `labelSets`. The detailed of the API payload can be seen [here](https://api-docs.datasaur.ai/#definition-LabelSetTextProjectInput).
* Specific for bounding box, the attribute will be `bboxLabelSets`. The detailed of the API payload can be seen [here](https://api-docs.datasaur.ai/#definition-LabelSetTextProjectInput).
* Specific for row and doc labeling, the attribute will be `documents.settings.questions` that will represent the question sets. The detailed of the object can be seen [here](https://api-docs.datasaur.ai/#definition-QuestionInput).

## Other Related APIs

### Labeling Guideline

Click [here](https://docs.datasaur.ai/advanced/shortcuts) for the detailed explanation of the feature.

* Mutation: [createGuideline](https://api-docs.datasaur.ai/#mutation-createGuideline)
