Полное руководство по работе с API SyncDataCloud для интеграции облачного хранилища в ваши приложения.
SyncDataCloud API предоставляет простой REST-интерфейс для управления файлами, пользователями и настройками хранилища. Для работы с API вам понадобится API-ключ, который можно получить в личном кабинете.
https://api.syncdatacloud.ru/v2/
Все запросы к API должны содержать заголовок Authorization с вашим API-ключом:
Authorization: Bearer YOUR_API_KEY
Получить список всех файлов в хранилище.
folder (string, optional) - ID папкиlimit (integer, optional) - Количество файлов (по умолчанию 50)offset (integer, optional) - Смещение для пагинацииcurl -X GET "https://api.syncdatacloud.ru/v2/files?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"files": [
{
"id": "file_abc123",
"name": "document.pdf",
"size": 1024000,
"created_at": "2025-11-01T10:30:00Z",
"modified_at": "2025-11-08T14:20:00Z"
}
],
"total": 234,
"offset": 0,
"limit": 10
}
Загрузить новый файл в хранилище.
file (binary) - Содержимое файлаfolder_id (string, optional) - ID папки назначенияname (string, optional) - Имя файлаcurl -X POST "https://api.syncdatacloud.ru/v2/files/upload" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/file.pdf" \
-F "name=document.pdf"
{
"id": "file_xyz789",
"name": "document.pdf",
"size": 2048000,
"url": "https://syncdatacloud.ru/files/file_xyz789",
"created_at": "2025-11-08T15:45:00Z"
}
Скачать файл по ID.
curl -X GET "https://api.syncdatacloud.ru/v2/files/file_abc123/download" \
-H "Authorization: Bearer YOUR_API_KEY" \
--output file.pdf
Удалить файл.
curl -X DELETE "https://api.syncdatacloud.ru/v2/files/file_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"success": true,
"message": "File deleted successfully"
}
Для real-time уведомлений о изменениях файлов используйте WebSocket-соединение:
wss://api.syncdatacloud.ru/v2/stream
При подключении отправьте API-ключ в первом сообщении:
{
"type": "auth",
"token": "YOUR_API_KEY"
}
После успешной аутентификации вы будете получать события об изменениях:
{
"type": "file.created",
"data": {
"id": "file_new123",
"name": "new_file.pdf",
"created_at": "2025-11-08T16:00:00Z"
}
}
200 OK - Запрос выполнен успешно201 Created - Ресурс создан400 Bad Request - Неверные параметры запроса401 Unauthorized - Неверный или отсутствует API-ключ403 Forbidden - Недостаточно прав404 Not Found - Ресурс не найден429 Too Many Requests - Превышен лимит запросов500 Internal Server Error - Внутренняя ошибка сервераAPI имеет следующие ограничения:
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.syncdatacloud.ru/v2"
headers = {
"Authorization": f"Bearer {API_KEY}"
}
# Получить список файлов
response = requests.get(f"{BASE_URL}/files", headers=headers)
files = response.json()
# Загрузить файл
with open("document.pdf", "rb") as f:
files = {"file": f}
data = {"name": "document.pdf"}
response = requests.post(
f"{BASE_URL}/files/upload",
headers=headers,
files=files,
data=data
)
print(response.json())
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://api.syncdatacloud.ru/v2';
const headers = {
'Authorization': `Bearer ${API_KEY}`
};
// Получить список файлов
axios.get(`${BASE_URL}/files`, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));
// Загрузить файл
const form = new FormData();
form.append('file', fs.createReadStream('document.pdf'));
form.append('name', 'document.pdf');
axios.post(`${BASE_URL}/files/upload`, form, {
headers: {
...headers,
...form.getHeaders()
}
}).then(response => console.log(response.data));
Если у вас возникли вопросы по работе с API, свяжитесь с нами: