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

# Get documents (v2)

> Retrieve documents within an organization filtered by IDs, folders, or metadata using the Velt v2 REST API for syncing, exports, and dashboards.

Use this API to retrieve specific documents or all documents from an organization.

<Warning>
  Prior to using this API, you must:

  * Enable advanced queries option in [the console](https://console.velt.dev/dashboard/config/appconfig)
  * Deploy v4 series of the Velt SDK.
</Warning>

# Endpoint

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

# 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="documentIds" type="string[]">
      Array of Document IDs. Limit: Only 30 IDs can be passed at a time.
    </ParamField>

    <ParamField body="folderId" type="string">
      Folder ID. Filters documents by the given folder ID.
    </ParamField>

    <ParamField body="pageSize" type="number">
      Number of items to be retrieved per page. Default: 1000.
    </ParamField>

    <ParamField body="pageToken" type="string">
      Page token retrieved from previous API call.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### 1. Get all documents from organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "pageSize": 20,
    "pageToken": "8740648311207869"
  }
}
```

#### 2. Get specific documents from organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentIds": ["yourDocumentId1", "yourDocumentId2"],
  }
}
```

#### 3. Get documents by organizationId, folderId

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "folderId": "yourFolderId"
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Document(s) retrieved successfully.",
    "data": [
      {
        "documentName": "yourDocumentName",
        "disabled": false,
        "accessType": "public",
        "id": "yourDocumentId",
      }
    ],
    "pageToken": "nextPageToken"
  }
}

```

#### Failure Response

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

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Document(s) retrieved successfully.",
      "data": [
        {
          "documentName": "yourDocumentName",
          "disabled": false,
          "accessType": "public",
          "id": "yourDocumentId",
        }
      ],
      "pageToken": "nextPageToken"
    }
  }
  ```
</ResponseExample>
