Skip to main content
Query the list of files available for a specific client from a provider connection. This allows Filed to discover files associated with a client.
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

workspaceId
ID!
required
The ID of the workspace containing the provider connection.
connectionId
ID!
required
The ID of the provider connection. This identifies which integration connection to query files from.
clientId
String!
required
The client ID from your platform. This should match the id returned from get connection clients.
options
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.

Returns

id
String!
File identifier from your platform.
fileName
String!
Name of the file.
fileSize
Int
Size of the file in bytes.
mimeType
String
MIME type of the file (e.g., “application/pdf”, “image/jpeg”).
downloadUrl
String
URL where the file can be downloaded. Filed will use this URL to fetch the file.
dateCreated
Date
Timestamp when the file was created in your platform.

Example

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
      }
    }
  }'
{
  "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"
            }
              ]
            }
          ]
        }
      ]
        }
      ]
    }
  }
}
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.
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.

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