synology-api is a free, open source automation project written in Python and released under MIT. It has 608 GitHub stars, 168 forks and 7 open issues, and was last pushed 28 hours ago. On this registry it ranks #54 of 66 tracked projects in Automation, with 5 head-to-head comparisons available. It gained 12 stars over the last 30 tracked days.

What is synology-api?

A Python wrapper around Synology's DiskStation Manager (DSM) API that lets developers script and automate their Synology NAS in Python, aimed at NAS owners and hobbyist developers who want to build tooling on top of their own hardware.

What it is

Synology-api is a Python library that wraps the Synology DSM API, exposing NAS functions as Python classes and methods so a developer can drive a Synology device from a script instead of writing raw API calls by hand. It lives in the Python 3 ecosystem and is distributed as synology-api on PyPI. The README states plainly that the project exists for people who are "trying to develop something for your NAS," and that the wrapper is meant to help build that script. The topic list places it in automation, home automation, and DSM territory, alongside synology-nas, api-wrapper, and python-3.

The concrete problem it solves is the repetitive work of authenticating against DSM and shaping requests and responses for each NAS service. Rather than reimplementing that plumbing per script, a developer imports a class such as FileStation or DownloadStation from synology_api and calls methods on it. Authentication, session handling, and parameters such as secure, cert_verify, dsm_version, debug, and otp_code are handled through the constructor. The library implements around 300 APIs, so it stands in for hand-written integration code across a wide slice of DSM rather than for one narrow endpoint.

Key capabilities

  • Ships as the pip3 install synology-api package, and can also be installed from source with pip3 install git+https://github.com/N4S4/synology-api.
  • Implements roughly 300 Synology APIs with methods for each, though the majority are undocumented and an exhaustive list lives on the docs site under "Supported APIs."
  • Provides service classes including synology_api.filestation.FileStation and synology_api.downloadstation.DownloadStation, with methods such as get_info() and get_file_list().
  • Connects either by IP address and port or through a QuickConnect ID, in which case HTTPS is used automatically.
  • Accepts otp_code in the constructor, so two-factor authentication can be handled from a script.
  • Offers an asynchronous client in beta, synology_api.async_client.AsyncClient, which wraps any existing class to make all its methods awaitable with no extra dependencies.
  • Supports parallel calls, for example asyncio.gather() over get_file_list() for several directories at once.

Who uses it and how

  • NAS owners who automate file and download operations on their own Synology device, calling FileStation and DownloadStation from a Python script.
  • Home automation builders, reflected in the home-automation topic and the related companion project homeassistant-synology-pro.
  • Bot authors, indicated by the related synology-api-telegram-bot project listed in the README.
  • Users on remote or non-LAN setups who reach the NAS by QuickConnect ID rather than by local IP and port.
  • Developers with concurrent workloads, who use AsyncClient with asyncio.gather() to issue several NAS requests in parallel.

Getting started

Install with pip3 install synology-api, or from source with pip3 install git+https://github.com/N4S4/synology-api. Usage examples for synchronous and async clients are documented at https://n4s4.github.io/synology-api/docs/getting-started/usage.

How it compares

No list of paid products this project replaces is provided in the available facts, and the README names no directly comparable client libraries; it names only companion projects, the Telegram bot and the Home Assistant integration, both built by the same author. On that evidence it stands alone in this registry as a Synology-focused Python API wrapper.

When to use it — and when not to

This is a hobby project, as the author states directly: it is provided "As Is," with no warranties, written in the author's free time, and only tested against Python 3, with the further note that much of the code is undocumented and in some parts "twisted." Much of what a self-hoster would operate is therefore the library itself and the docs, not infrastructure such as a database or mail server. Anyone who needs vendor-backed support, complete API documentation, or a stable interface across many hundreds of DSM endpoints should look elsewhere; the 300-odd implemented APIs do not come with documentation for most of them, and the README itself lists "still a lot to implement."

project readme (upstream, from github) — read inline

synology-api Pepy Total Downloads Website

GitHub last commit GitHub License

Synology Wrapper

If you find yourself here, most probably you are trying to develop something for your NAS, this wrapper might come to your help to build your script.

I would like to specify that I do this for hobby as is my passion and in my little free time.

Said this, there is no warranties chained and this library is provided "As Is", you will find many things can be simplified, and I slowly will but feel free to Contribute.

Premise

I've tried this wrapper only with python3. I do not know if it actually runs with previous versions

Before opening an issue make sure you do your own research, if you are not sure, write me.

Installation

The package is distributed via pip3, but it can also be installed from source.

pip3 install synology-api

or

pip3 install git+https://github.com/N4S4/synology-api

Basic Usage

Here is a basic example on how to use the package, check Getting Started - Basic Usage for more details.

from synology_api.filestation import FileStation
from synology_api.downloadstation import DownloadStation

fs = FileStation(
    'Synology Ip',
    'Synology Port',
    'Username',
    'Password',
    secure=False,
    cert_verify=False,
    dsm_version=7,
    debug=True,
    otp_code=None
)

ds = DownloadStation(
    'Synology Ip',
    'Synology Port',
    'Username',
    'Password',
    secure=False,
    cert_verify=False,
    dsm_version=7,
    debug=True,
    otp_code=None
)

fs_info = fs.get_info()
ds_info = ds.get_info()

For NAS devices reachable through QuickConnect, pass the NAS QuickConnect ID instead of an IP address and port. QuickConnect uses HTTPS automatically.

fs = FileStation(
    quickconnect_id='QuickConnect ID',
    username='Username',
    password='Password',
    cert_verify=False,
    dsm_version=7,
    debug=True,
    otp_code=None
)

Async Client (beta)

Every existing synology-api class can be made async with a single wrapper — no extra dependencies:

import asyncio
from synology_api.filestation import FileStation
from synology_api.async_client import AsyncClient

async def main():
    fs = AsyncClient(FileStation("192.168.1.x", "5001", "admin", "pass",
                                  secure=True, cert_verify=False, dsm_version=7))

    # All methods automatically awaitable
    info = await fs.get_info()
    files = await fs.get_file_list("/home")

    # Run parallel calls
    a, b, c = await asyncio.gather(
        fs.get_file_list("/home"),
        fs.get_file_list("/photo"),
        fs.get_file_list("/music"),
    )

asyncio.run(main())

Check the Async Client documentation for details.

Available Functions

At the moment there are around +300 APIs implemented with countless methods for each, the majority is not documented, but some are.

You can find a exhaustive list here: APIs - Supported APIs

Feeling kind?

If this code helps and you wish to support me:

Community

See Related projects

If you want to show your project in this section, write me.

Bugs

Maybe?

I hate bugs..

Well report them please (if you'll ever use this code)

Conclusions

There is still a lot to implement.

The code is probably in some parts twisted, I will try to optimize it at best.

Contributing

Just Don't Be Scared. Check Contribute - Contribution 101 for useful information.

Author

  • Renato Visaggio - Initial Work - N4S4

Contributors

Frequently asked questions

Is synology-api free to use?

synology-api is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does synology-api do?

A Python wrapper around Synology API

What is synology-api written in?

synology-api is primarily written in Python. Its source is publicly available at https://github.com/N4S4/synology-api, and it has 608 GitHub stars.