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

# Files

> Use the Ruby SDK for file upload, metadata, and file-content retrieval.

**Methods**: `upload_file`, `list_files`, `retrieve_file`, `retrieve_file_content`.

### Example

```ruby theme={null}
require 'ai_stats_sdk'

client = AIStatsSdk::AIStats.new(api_key: ENV.fetch('AI_STATS_API_KEY'))

uploaded = client.upload_file(
  'purpose' => 'batch',
  'file' => 'data:application/json;base64,eyJ0ZXN0Ijp0cnVlfQ=='
)

file = client.retrieve_file('file_123')
content = client.retrieve_file_content('file_123')
```

<Note>
  `list_files` is wired through the SDK, but `GET /files` currently returns `file_list_not_supported_with_shared_gateway_key`
  on the shared gateway key. Persist uploaded file ids and retrieve them directly instead.
</Note>
