Загрузка файлов
Attachments загружаются как multipart/form-data на POST /api/public/v1/attachments. Два поля: file (бинарный файл) и taskId (id задачи).
- Max размер: 100 MB.
- Учитывается в storage-квоте аккаунта (превышение → 403
plan_limit). - Scope:
attachments:write.
Загрузка
Заголовок раздела «Загрузка»curl -X POST \ -H "Authorization: Bearer $FW_KEY" \ -F "taskId=9001" \ -F "file=@./report.pdf" \ https://api.flowworker.ru/api/public/v1/attachmentsimport fs from 'node:fs';
const fd = new FormData();fd.append('taskId', '9001');fd.append('file', new Blob([fs.readFileSync('report.pdf')], { type: 'application/pdf' }), 'report.pdf');
const resp = await fetch('https://api.flowworker.ru/api/public/v1/attachments', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FW_KEY}` }, body: fd});const att = await resp.json();console.log(att.downloadUrl);with open('report.pdf', 'rb') as f: r = requests.post( 'https://api.flowworker.ru/api/public/v1/attachments', headers={'Authorization': f'Bearer {os.environ["FW_KEY"]}'}, data={'taskId': 9001}, files={'file': ('report.pdf', f, 'application/pdf')} )print(r.json()['downloadUrl'])<?php$ch = curl_init('https://api.flowworker.ru/api/public/v1/attachments');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('FW_KEY')], CURLOPT_POSTFIELDS => [ 'taskId' => 9001, 'file' => new CURLFile('./report.pdf', 'application/pdf', 'report.pdf'), ], CURLOPT_RETURNTRANSFER => true,]);$att = json_decode(curl_exec($ch), true);curl_close($ch);echo $att['downloadUrl'];{ "id": 501, "taskId": 9001, "fileName": "report.pdf", "contentType": "application/pdf", "sizeBytes": 184320, "createdAt": "2026-05-16T10:42:18Z", "downloadUrl": "/api/public/v1/attachments/501/content"}Скачивание
Заголовок раздела «Скачивание»curl -H "Authorization: Bearer $FW_KEY" \ https://api.flowworker.ru/api/public/v1/attachments/501/content \ --output report.pdfContent-Type и Content-Disposition приходят правильно - файл сохранится с оригинальным именем.
Удаление
Заголовок раздела «Удаление»curl -X DELETE -H "Authorization: Bearer $FW_KEY" \ https://api.flowworker.ru/api/public/v1/attachments/501Soft-delete (метаданные остаются, файл в storage помечается на удаление).