> ## Documentation Index
> Fetch the complete documentation index at: https://docs.velt.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Documents

Use this API to add documents with metadata to an organization.

# Endpoint

`POST https://api.velt.dev/v2/organizations/documents/add`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="createOrganization" type="boolean">
      If set to true, a new organization will be created (if it doesn't exist) before the document(s) are created.
    </ParamField>

    <ParamField body="documents" type="Document[]" required>
      Array of Document objects
    </ParamField>

    <ParamField body="folderId" type="string">
      Folder ID to add the documents to.
    </ParamField>

    <ParamField body="createFolder" type="boolean">
      If set to true and `folderId` is provided but doesn't exist, a new folder will be created before the document(s) are created.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### 1. Create new documents

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documents": [
      {
        "documentId": "yourDocumentId",
        "documentName": "Your Document Name"
      }
    ]
  }
}
```

#### 2. Create new documents in a specific folder

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documents": [
      {
        "documentId": "yourDocumentId",
        "documentName": "Your Document Name"
      }
    ],
    "folderId": "yourFolderId"
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Document(s) added successfully.",
    "data": {
      "yourDocumentId": {
        "success": true,
        "id": "8121657101517513",
        "message": "Added Successfully"
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Document(s) added successfully.",
      "data": {
        "yourDocumentId": {
          "success": true,
          "id": "8121657101517513",
          "message": "Added Successfully"
        }
      }
    }
  }
  ```
</ResponseExample>
