Import json backup file with curl


I’m using duplicati and I try to import a json file with curl instead of WUI. But I don’t know which is URL to import the backup. Can someone help me?

Thank you very much in advance.


Hi again,

I try curl -X POST -F config=@default-backup-conf.json localhost:8200/api/v1/import?x-xsrf-token=TEG6Vj96JSfsZtUAhY6lP3NWhSnoA8IfKAChGqpFApA%3D

I had the following error:

‘Import completed, but a browser issue prevents loading the contents. Try using the direct import method instead.’

Can the import be done in some other way?


Which json file are you trying to open and what are you hoping to get out of it?

Hi Jon,

I have a json export from duplicati, I’m trying to insert it with curl, because I want to automate this process in a container docker.


OK, I can see one wanting to do that - unfortunately I don’t know enough about curl to offer much help beyond the obvious like “is there a password on Duplicati or encryption on the backup that might be causing issues”…

No, the password on Duplicati is disabled and the encryption too. But I believe that duplicati does not support it.

Thanks for your interest

I realize this isn’t specifically what you asked for, but would you be open to automating the process through something other than curl?

For example, there’s a --control-file parameter that might be able to do what you ultimately want (though I’m not sure it’s fully fleshed out yet).

Additionally, most of the GUI commands (like Export or Add backup) are really just calls to the command line so in theory there should be a commandline equivalent of Add backup that could get a job imported in an automated way…

Yes, I tried to use the command line, but I can not find any command that allows me to import the json file:

mono app/Duplicati.CommandLine.exe --help

See duplicati.commandline.exe help for more information.
General: example, changelog
Commands: backup, find, restore, delete, compact, test, compare, purge,
Reparing: repair, affected, list-broken-files, purge-broken-files
Debugging: debug, logging, create-report, test-filters, system-info,
Targets: aftp, amzcd, azure, b2, box, cloudfiles, dropbox, ftp, file,
googledrive, gcs, hubic, jottacloud, mega, onedrive, openstack, s3, ssh,
od4b, mssp, sia, tahoe, webdav
Modules: aes, gpg, zip, 7z, console-password-input, mssql-options,
hyperv-options, http-options, sendhttp, sendmail, runscript, sendxmpp,
Formats: date, time, size, encryption, compression
Advanced: mail, advanced, returncodes, filter, default-filter-sets, Version: -

Can you help me?


I couldn’t find one either, but I’d guess one must exist and just not be documented. @kenkendk would know for sure.

The commandline is intended as a “headless” version of Duplicati, and does not do anything with the server, so you cannot import with that.

The import command works as you write, but it expects that it can redirect you to finalize editing the backup configuration. Since you are using curl, that does not work.

The error message hints that you can set direct=true in the url, something like:

curl -X POST -F config=@default-backup-conf.json localhost:8200/api/v1/backups/import?x-xsrf-token=TEG6Vj96JSfsZtUAhY6lP3NWhSnoA8IfKAChGqpFApA%3D&direct=true

This will import the backup configuration if it is complete and otherwise fail (i.e. if there are not source folders, or no destination url).

1 Like

Thanks for your reply.

I have performed the test that you have indicated to me, but it does not work:

  • About to connect() to localhost port 8200 (#0)
  • Trying ::1…
  • Connection refused
  • Trying…
  • connected
  • Connected to localhost ( port 8200 (#0)

POST /api/v1/import?x-xsrf-token=eL3I6QPNK%2Flpyu0ZtfPwnSnuND4CYsKDo%2FQ%2BkPXkc9Q%3D&direct=true HTTP/1.1
User-Agent: curl/7.26.0
Host: localhost:8200
Accept: /
Content-Length: 4124
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------4e981f372d31

  • additional stuff not fine transfer.c:1037: 0 0
  • HTTP 1.0, assume close after body
    < HTTP/1.0 100 Please continue mate.
  • additional stuff not fine transfer.c:1037: 0 0
  • additional stuff not fine transfer.c:1037: 0 0
  • additional stuff not fine transfer.c:1037: 0 0
  • additional stuff not fine transfer.c:1037: 0 0
    < HTTP/1.1 404 No such module
    < Date: Tue, 31 Oct 2017 09:25:33 GMT
    < Content-Length: 3
    < Content-Type: text/html;charset=UTF-8
    < Server: Tiny WebServer
    < Connection: close
    < Set-Cookie: xsrf-token=eL3I6QPNK%2Flpyu0ZtfPwnSnuND4CYsKDo%2FQ%2BkPXkc9Q%3D; expires=Tue, 31 Oct 2017 09:35:33 GMT;path=/;
  • Closing connection #0

Is there any way to do it?


Arh, I did not notice before, but you need to use /api/v1/backups/import.

Oh thank you! it’s true!

everything works now correctly! Thanks

1 Like

Is that a typo in your first reply or something specific to this instance? (If a typo, can we fix your reply and flag it as the solution?)

Yes. I copy-pasted the url from the OP, and did not notice the missing backups part.
I have edited my original post to use the correct url, and marked it as the answer.

1 Like