---
title: "List documents"
description: "List documents in the tenant, cursor-paginated: newest first by default, or searched by name and sorted by name or size."
source: "https://www.cloudpdf.com/docs/api-reference/documents/list"
---

# List documents

`GET /v1/tenants/{tenantId}/documents` · v3.5.0

List documents in the tenant, cursor-paginated: newest first by default, or searched by name and sorted by name or size.

## Authentication

Any one of these credentials is accepted.

- **apiToken** — The deployment's static root credential (CLOUDPDF\_API\_AUTH\_TOKENS), valid on every surface.
- **tenantToken** — Delegated tenant JWT, valid only for its own tenant: under /v1/tenants/\{tenantId}/ the path tenant must equal the token's tenant\_id, and on /v1/docs/\{docId} the document must belong to that tenant and the token's scope must hold the operation's document permissions, as a document token does. For servers; browsers get document tokens. Doc-scoped viewer tokens are rejected on every admin route.

**Required scope:** `docs.read`

## Parameters

- `tenantId` string (path) — required
- `limit` integer (query)
- `cursor` string (query)
- `state` "pending" | "ready" | "failed" | "deleting" (query)
- `q` string (query)
- `folderId` string (query)
- `sort` "createdAt" | "name" | "size" (query)
- `order` "asc" | "desc" (query)

## SDK examples

**TypeScript**

```typescript
import { CloudPDFClient } from "@cloudpdf/sdk";

const client = new CloudPDFClient({
  token: "<token>",
});

await client.documents.list({
  tenantId: "tenantId"
});
```

**Python**

```python
from cloudpdf import CloudPDFClient

client = CloudPDFClient(
    token="<token>",
)

client.documents.list(
    tenant_id="tenantId",
)
```

**PHP**

```php
use CloudPDF\CloudPDFClient;

$client = new CloudPDFClient(
    token: '<token>',
);

$client->documents->list(
    'tenantId',
    new ListDocumentsRequest([]),
);
```

**.NET**

```csharp
using CloudPDF;

var client = new CloudPDFClient(
    "<token>"
);

await client.Documents.ListAsync(new ListDocumentsRequest { TenantId = "tenantId" });
```

**Go**

```go
import (
    "context"

    cloudpdf "github.com/embedpdf/cloudpdf-sdk-go/v3"
    client "github.com/embedpdf/cloudpdf-sdk-go/v3/client"
    option "github.com/embedpdf/cloudpdf-sdk-go/v3/option"
)

client := client.NewClient(
    option.WithToken("<token>"),
)

request := &cloudpdf.ListDocumentsRequest{
    TenantID: "tenantId",
}
client.Documents.List(
    context.TODO(),
    request,
)
```

**Java**

```java
import com.cloudpdf.api.CloudPDFClient;

CloudPDFClient client = CloudPDFClient
    .builder()
    .token("<token>")
    .build();

client.documents().list(
    "tenantId",
    ListDocumentsRequest
        .builder()
        .build()
);
```

**Ruby**

```ruby
require "cloudpdf"

client = CloudPDF::Client.new(
  token: "<token>"
)

client.documents.list(tenant_id: "tenantId")
```

## Responses

### 200 — OK

`application/json` — DocumentsListResponse

- `documents` object\[] — required
  - `id` string — required
  - `tenantId` string — required
  - `name` string — required
  - `folderId` string — required — The folder the document is in, or root.
  - `state` "pending" | "ready" | "failed" | "deleting" — required
  - `baseSha256` string — required
  - `sizeBytes` integer — required
  - `metadata` object — required
  - `idempotencyKey` string — required
  - `failureReason` string — required
  - `thumbnailState` "pending" | "ready" | "locked" | "failed" — required
  - `thumbnailUrl` string — required
  - `createdAt` string\<date-time> — required
  - `updatedAt` string\<date-time> — required
  - `createdBy` string — required
- `nextCursor` string — required

### 400 — Bad request

`application/json` — ErrorResponse

- `error` EngineError — required
  - `code` "Unknown" | "InvalidArg" | "DocNotOpen" | "DocOpenFailed" | "DocPasswordRequired" | "DocPasswordIncorrect" | "GrantPassphraseRequired" | "Aborted" | "Network" | "Unauthenticated" | "Forbidden" | "NotFound" | "WireFormat" | "RuntimeUnavailable" | "LayerVersionConflict" | "NotImplemented" | "MalformedPdf" | "SigningPending" | "SigningExpired" | "SigningVersionMismatch" | "SignatureRefused" | "ProtectedDocument" | "PayloadTooLarge" | "ObjectNumberUnavailable" | "LayerFull" | "ChangeConflict" | "UndoUnavailable" | "IdempotencyKeyReused" | "LayerDeleted" | "VisitorIdentityRequired" | "Conflict" | "EngineBusy" | "EngineRestarting" | "DocumentQuarantined" | "ThumbnailNotReady" | "TooManyRequests" | "GrantExpired" | "OriginRequired" | "OriginNotAllowed" | "FeatureNotEnabled" | "FeatureStopped" | "LicenseInvalid" | "LicenseUsageLimit" | "UpstreamError" — required — Why the request failed. A newer server can add codes: read one your client doesn't know as \`Unknown\`.
  - `message` string — required
  - `details` object — What a code carries besides its message, as each code says.

### default — Error

`application/json` — ErrorResponse

- `error` EngineError — required
  - `code` "Unknown" | "InvalidArg" | "DocNotOpen" | "DocOpenFailed" | "DocPasswordRequired" | "DocPasswordIncorrect" | "GrantPassphraseRequired" | "Aborted" | "Network" | "Unauthenticated" | "Forbidden" | "NotFound" | "WireFormat" | "RuntimeUnavailable" | "LayerVersionConflict" | "NotImplemented" | "MalformedPdf" | "SigningPending" | "SigningExpired" | "SigningVersionMismatch" | "SignatureRefused" | "ProtectedDocument" | "PayloadTooLarge" | "ObjectNumberUnavailable" | "LayerFull" | "ChangeConflict" | "UndoUnavailable" | "IdempotencyKeyReused" | "LayerDeleted" | "VisitorIdentityRequired" | "Conflict" | "EngineBusy" | "EngineRestarting" | "DocumentQuarantined" | "ThumbnailNotReady" | "TooManyRequests" | "GrantExpired" | "OriginRequired" | "OriginNotAllowed" | "FeatureNotEnabled" | "FeatureStopped" | "LicenseInvalid" | "LicenseUsageLimit" | "UpstreamError" — required — Why the request failed. A newer server can add codes: read one your client doesn't know as \`Unknown\`.
  - `message` string — required
  - `details` object — What a code carries besides its message, as each code says.
