> For the complete documentation index, see [llms.txt](https://docs.datasaur.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datasaur.ai/api/adding-documents.md).

# Adding Documents

Datasaur supports adding documents into an existing project, as described [here](/data-studio-projects/adding-documents-to-an-ongoing-project.md).

In this section, we'll be running through how to do this programmatically via our API, specifically through GraphQL mutation [addDocumentsToProject](https://api-docs.datasaur.ai/#mutation-addDocumentsToProject).

1. Make sure you have generated your [OAuth Credentials](/api/credentials.md). These are crucial for authentication and gaining access to the API capabilities.
2. Prepare the GraphQL payload which will be used for the API request. Below is a simplified version of the payload required for adding documents to a project. You can access the complete reference [here](https://api-docs.datasaur.ai/#definition-AddDocumentsToProjectInput).
3. Send the GraphQL request to submit your request. Upon successfully submitting your mutation, you will receive a `Job ID`. This ID can be used to monitor the progress.

```json
{
  "operationName": "AddDocumentsToProjectMutation",
  "query": "mutation AddDocumentsToProjectMutation($input: AddDocumentsToProjectInput!) {\n  result: addDocumentsToProject(input: $input) {\n    job {\n      ...JobFragment\n      __typename\n    }\n    name\n    __typename\n  }\n}\n\nfragment JobFragment on Job {\n  id\n  status\n  progress\n  errors {\n    id\n    stack\n    args\n    __typename\n  }\n  resultId\n  createdAt\n  updatedAt\n  result\n  additionalData {\n    documentIds\n    __typename\n  }\n  __typename\n}\n",
  "variables": {
    "input": {
      "documents": [
        {
          "document": {
            "name": "<FILENAME>",
            "objectKey": "<PATH_TO_FILE>"
          }
        }
      ],
      "projectId": "<PROJECT ID>"
    }
  }
}
```

The `documents` structure follows the same format as used in the `createProject` mutation. [Read more here](https://example.com/createProject-documentation) for document details.

{% hint style="info" %}
Currently, we don't have an example API client. If you require more personalized support or guidance, please reach out to us at <support@datasaur.ai>.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datasaur.ai/api/adding-documents.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
