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

# Get Documents

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.

# Endpoint

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

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**organizationId** `string` *required*

Organization ID

**documentIds** `string[]`

Array of Document IDs. Limit: Only 30 IDs can be passed at a time.

**folderId** `string`

Folder ID. Filters documents by the given folder ID.

**pageSize** `number`

Number of items to be retrieved per page. Default: 1000.

**pageToken** `string`

Page token retrieved from previous API call.

## **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"
  }
}
```

#### Partial Failures

When you request specific `documentIds` and any of them cannot be returned, this endpoint returns HTTP `500` and puts a per-item breakdown in `error.details`, as an array in the same order you sent the IDs.

> [!WARNING]
>
> A missing document is reported as `500 INTERNAL` even though nothing went wrong on the server. Branch on the per-item `code` rather than the HTTP status when deciding whether to retry. Retrying on the status alone will loop on `not-found`, which will never succeed.
>
> This also means `get` is not a reliable existence check today: asking whether a document exists and receiving `500` is the expected answer for "no". Read `code` to tell that apart from a real failure.

**code** `string`

Why this particular item could not be returned. Present on every entry with `"success": false`.

| Value | Meaning | Safe to retry? |
| - | - | - |
| `not-found` | The document does not exist. | No |
| `internal` | A genuine server-side failure. | Yes |

```JSON theme={null}
{
  "error": {
    "status": "INTERNAL",
    "message": "Error retrieving document(s).",
    "details": [
      {
        "documentName": "yourDocumentName",
        "disabled": false,
        "accessType": "public",
        "id": "yourDocumentId1"
      },
      {
        "id": "yourDocumentId2",
        "success": false,
        "message": "Document does not exist",
        "code": "not-found"
      }
    ]
  }
}
```

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.