You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sim makes it easy to work with files throughout your workflows. Blocks can receive files, process them, and pass them to other blocks seamlessly.
9
+
10
+
## File Objects
11
+
12
+
When blocks output files (like Gmail attachments, generated images, or parsed documents), they return a standardized file object:
13
+
14
+
```json
15
+
{
16
+
"name": "report.pdf",
17
+
"url": "https://...",
18
+
"base64": "JVBERi0xLjQK...",
19
+
"type": "application/pdf",
20
+
"size": 245678
21
+
}
22
+
```
23
+
24
+
You can access any of these properties when referencing files from previous blocks.
25
+
26
+
## Passing Files Between Blocks
27
+
28
+
Reference files from previous blocks using the tag dropdown. Click in any file input field and type `<` to see available outputs.
29
+
30
+
**Common patterns:**
31
+
32
+
```
33
+
// Single file from a block
34
+
<gmail.attachments[0]>
35
+
36
+
// Pass the whole file object
37
+
<file_parser.files[0]>
38
+
39
+
// Access specific properties
40
+
<gmail.attachments[0].name>
41
+
<gmail.attachments[0].base64>
42
+
```
43
+
44
+
Most blocks accept the full file object and extract what they need automatically. You don't need to manually extract `base64` or `url` in most cases.
45
+
46
+
## Triggering Workflows with Files
47
+
48
+
When calling a workflow via API that expects file input, include files in your request:
49
+
50
+
<Tabsitems={['Base64', 'URL']}>
51
+
<Tabvalue="Base64">
52
+
```bash
53
+
curl -X POST "https://sim.ai/api/workflows/YOUR_WORKFLOW_ID/execute" \
54
+
-H "Content-Type: application/json" \
55
+
-H "x-api-key: YOUR_API_KEY" \
56
+
-d '{
57
+
"document": {
58
+
"name": "report.pdf",
59
+
"base64": "JVBERi0xLjQK...",
60
+
"type": "application/pdf"
61
+
}
62
+
}'
63
+
```
64
+
</Tab>
65
+
<Tabvalue="URL">
66
+
```bash
67
+
curl -X POST "https://sim.ai/api/workflows/YOUR_WORKFLOW_ID/execute" \
68
+
-H "Content-Type: application/json" \
69
+
-H "x-api-key: YOUR_API_KEY" \
70
+
-d '{
71
+
"document": {
72
+
"name": "report.pdf",
73
+
"url": "https://example.com/report.pdf",
74
+
"type": "application/pdf"
75
+
}
76
+
}'
77
+
```
78
+
</Tab>
79
+
</Tabs>
80
+
81
+
The workflow's Start block should have an input field configured to receive the file parameter.
82
+
83
+
## Receiving Files in API Responses
84
+
85
+
When a workflow outputs files, they're included in the response:
86
+
87
+
```json
88
+
{
89
+
"success": true,
90
+
"output": {
91
+
"generatedFile": {
92
+
"name": "output.png",
93
+
"url": "https://...",
94
+
"base64": "iVBORw0KGgo...",
95
+
"type": "image/png",
96
+
"size": 34567
97
+
}
98
+
}
99
+
}
100
+
```
101
+
102
+
Use `url` for direct downloads or `base64` for inline processing.
103
+
104
+
## Blocks That Work with Files
105
+
106
+
**File inputs:**
107
+
-**File** - Parse documents, images, and text files
108
+
-**Vision** - Analyze images with AI models
109
+
-**Mistral Parser** - Extract text from PDFs
110
+
111
+
**File outputs:**
112
+
-**Gmail** - Email attachments
113
+
-**Slack** - Downloaded files
114
+
-**TTS** - Generated audio files
115
+
-**Video Generator** - Generated videos
116
+
-**Image Generator** - Generated images
117
+
118
+
**File storage:**
119
+
-**Supabase** - Upload/download from storage
120
+
-**S3** - AWS S3 operations
121
+
-**Google Drive** - Drive file operations
122
+
-**Dropbox** - Dropbox file operations
123
+
124
+
<Callouttype="info">
125
+
Files are automatically available to downstream blocks. The execution engine handles all file transfer and format conversion.
126
+
</Callout>
127
+
128
+
## Best Practices
129
+
130
+
1.**Use file objects directly** - Pass the full file object rather than extracting individual properties. Blocks handle the conversion automatically.
131
+
132
+
2.**Check file types** - Ensure the file type matches what the receiving block expects. The Vision block needs images, the File block handles documents.
133
+
134
+
3.**Consider file size** - Large files increase execution time. For very large files, consider using storage blocks (S3, Supabase) for intermediate storage.
0 commit comments