> ## 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.

# Upload connection file

> Upload a file to a client in a provider connection

Upload a file to a specific client in a provider connection. This allows Filed to send files back to your platform for a client.

```graphql theme={null}
mutation UploadConnectionFile($connectionId: ID!, $clientKey: String!, $file: FileUploadInput!) {
  uploadConnectionFile(connectionId: $connectionId, clientKey: $clientKey, file: $file) {
    success
    message
  }
}
```

## Arguments

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

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

<ParamField path="file" type="FileUploadInput!" required>
  File upload input containing file details.

  <Expandable title="FileUploadInput">
    <ParamField path="file.fileName" type="String!" required>
      Name of the file to upload (e.g., "tax-return-2024.pdf", "notes.txt").
    </ParamField>

    <ParamField path="file.contentType" type="String">
      MIME type of the file (e.g., "application/pdf", "text/plain", "image/jpeg").
    </ParamField>

    <ParamField path="file.tusdEndpoint" type="String!" required>
      TUS (resumable upload) endpoint URL for uploading the file. Filed uses TUS protocol for reliable file uploads.
    </ParamField>
  </Expandable>
</ParamField>

## Returns

<ResponseField name="success" type="Boolean!">
  Whether the upload was successful.
</ResponseField>

<ResponseField name="message" type="String">
  Success or error message describing the result of the upload operation.
</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": "mutation UploadConnectionFile($connectionId: ID!, $clientKey: String!, $file: FileUploadInput!) { uploadConnectionFile(connectionId: $connectionId, clientKey: $clientKey, file: $file) { success message } }",
      "variables": {
        "connectionId": "connection_789",
        "clientKey": "client-12345",
        "file": {
          "fileName": "tax-return-2024.pdf",
          "contentType": "application/pdf",
          "tusdEndpoint": "https://api.example.com/files/upload"
        }
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "data": {
      "uploadConnectionFile": {
        "success": true,
        "message": "File uploaded successfully"
      }
    }
  }
  ```
</ResponseExample>

<Info>
  **TUS Protocol**: Filed uses the TUS (resumable upload) protocol for file uploads. Your platform needs to implement a TUS-compatible endpoint. The `tusdEndpoint` should point to your TUS upload endpoint that accepts file uploads for the specified client.
</Info>

<Note>
  After the mutation succeeds, Filed will upload the file to your platform using the TUS endpoint. Ensure your platform's TUS endpoint is configured to accept uploads for the specified client and connection.
</Note>

## Troubleshooting

**Problem**: Upload fails with invalid client key

**Solutions**:

* Verify the `clientKey` matches a valid client ID from your platform
* Ensure the client exists and is accessible through this connection
* Check that the connection credentials have permission to upload files for this client

**Problem**: TUS endpoint not accessible or invalid

**Solutions**:

* Verify the `tusdEndpoint` URL is correct and accessible
* Ensure your platform implements a TUS-compatible upload endpoint
* Test the TUS endpoint manually to ensure it accepts uploads
* Check that the endpoint accepts uploads for the specified client

**Problem**: File upload fails after mutation succeeds

**Solutions**:

* Verify your TUS endpoint is properly configured
* Check file size limits and ensure the file doesn't exceed them
* Ensure the endpoint has proper error handling and returns appropriate TUS responses
* Review TUS protocol implementation to ensure compatibility
