How to use the API?

Supposedly there is an API at /api/v1/, but I can’t figure out how to access it.

I followed this thread to setup Kopia in container with web ui: Containerized Kopia server setup

So by this point I have an account with username: kopia@localhost and password: SuperSecretPassword. These credentials work when accessing the web ui.

When I do a GET request to /api/v1/sources, I get Missing credentials.

Using basic auth with username: kopia@localhost and password: SuperSecretPassword to do a GET request to the same url returns: Invalid or missing CSRF token.

If I do the same request with same credentials but instead to /api/v1/control/sources I get back a json object with this content:

{
	"code": "ACCESS_DENIED",
	"error": "access is denied"
}

What am I doing wrong? Or is API not working in container installation method?

1 Like

I know that this is quite the old post, but I have the exact same problem. Did you ever find a solution? Thanks!

Did you check the API documentation here? repo package - github.com/kopia/kopia/repo - Go Packages

Thanks for the reference. I did take a look at it, but I’m not looking to program something using the api. I was just trying to get the Kopia widget to work with homepage. Their api gives an error “Invalid or missing CSRF token.” when I try to use it, but I’m pretty sure it’s just me. I wanted to test the api to see if I had something setup wrong. I received the same access denied error as the OP when I tried to use curl to test why it wasn’t working.

Did you manage to solve the issue? I’m getting API Error in homepage and when i try to curl i get Invalid or missing CSRF token.