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

# Get client files

> List files for a specific client from a provider connection

Query the list of files available for a specific client from a provider connection. This allows Filed to discover files associated with a client.

```graphql theme={null}
query GetClientFiles($workspaceId: ID!, $connectionId: ID!, $clientId: String!, $options: JSON) {
  me {
    workspaces(filters: { ids: [$workspaceId] }) {
      id
      connections(filters: { ids: [$connectionId] }) {
        id
        clients(options: { id: $clientId }) {
          id
          files(options: $options) {
            id
            fileName
            fileSize
            mimeType
            downloadUrl
            dateCreated
          }
        }
      }
    }
  }
}
```

## Arguments

<ParamField path="workspaceId" type="ID!" required>
  The ID of the workspace containing the provider connection.
</ParamField>

<ParamField path="connectionId" type="ID!" required>
  The ID of the provider connection. This identifies which integration connection to query files from.
</ParamField>

<ParamField path="clientId" type="String!" required>
  The client ID from your platform. This should match the `id` returned from [get connection clients](/legacy/apis/endpoint/get-connection-clients).
</ParamField>

<ParamField path="options" type="JSON">
  Optional query parameters for filtering or pagination. The exact options depend on your platform's implementation and will be coordinated with Filed during integration setup.
</ParamField>

## Returns

<ResponseField name="id" type="String!">
  File identifier from your platform.
</ResponseField>

<ResponseField name="fileName" type="String!">
  Name of the file.
</ResponseField>

<ResponseField name="fileSize" type="Int">
  Size of the file in bytes.
</ResponseField>

<ResponseField name="mimeType" type="String">
  MIME type of the file (e.g., "application/pdf", "image/jpeg").
</ResponseField>

<ResponseField name="downloadUrl" type="String">
  URL where the file can be downloaded. Filed will use this URL to fetch the file.
</ResponseField>

<ResponseField name="dateCreated" type="Date">
  Timestamp when the file was created in your platform.
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://gateway.filed.com/graphql \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <accessToken>" \
    -H "source-platform: my-sample-platform" \
    -d '{
      "query": "query GetClientFiles($workspaceId: ID!, $connectionId: ID!, $clientId: String!, $options: JSON) { me { workspaces(filters: { ids: [$workspaceId] }) { id connections(filters: { ids: [$connectionId] }) { id clients(options: { id: $clientId }) { id files(options: $options) { id fileName fileSize mimeType downloadUrl dateCreated } } } } } }",
      "variables": {
        "workspaceId": "workspace_123456",
        "connectionId": "connection_789",
        "clientId": "client-12345",
        "options": {
          "limit": 50,
          "offset": 0
        }
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "data": {
      "me": {
        "workspaces": [
          {
            "id": "workspace_123456",
            "connections": [
          {
            "id": "connection_789",
            "clients": [
              {
                "id": "client-12345",
                "files": [
              {
                "id": "file-001",
                "fileName": "W-2 Form 2024.pdf",
                "fileSize": 245678,
                "mimeType": "application/pdf",
                "downloadUrl": "https://api.example.com/files/file-001/download",
                "dateCreated": "2024-01-10T08:00:00Z"
              },
              {
                "id": "file-002",
                "fileName": "1099-INT Statement.pdf",
                "fileSize": 189234,
                "mimeType": "application/pdf",
                "downloadUrl": "https://api.example.com/files/file-002/download",
                "dateCreated": "2024-01-12T14:30:00Z"
              }
                ]
              }
            ]
          }
        ]
          }
        ]
      }
    }
  }
  ```
</ResponseExample>

<Warning>
  **File URL Accessibility**: Ensure the `downloadUrl` values are accessible to Filed. Filed will use the connection credentials to download files from these URLs. Test that Filed can access the URLs using those credentials.
</Warning>

<Note>
  To download a file, Filed will use the `downloadUrl` from the file object. Ensure these URLs are valid and accessible with the connection credentials provided during connection setup.
</Note>

## Troubleshooting

**Problem**: No files returned for client

**Solutions**:

* Verify the client ID is correct and exists in your platform
* Check that the client has files associated with it
* Review the `options` parameter to ensure filters aren't excluding all files
* Verify the connection credentials have permission to access client files

**Problem**: Files returned but download URLs are inaccessible

**Solutions**:

* Ensure download URLs are valid and use the correct protocol (https\://)
* Verify the connection credentials have permission to access the file URLs
* Test the download URLs manually to ensure they return the expected files
* Check that file URLs haven't expired or been moved
