> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ziik.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> To authorize, you will need to authenticate with the service to get an access token for use with the API. 

## Find your API URL

To find your API URL, simply log in to Ziik via the browser, copy the URL and append /api.
Should look something like this: [https://your-identifier.ziik.io/api](https://your-identifier.ziik.io/api)

## Get an accesstoken

To get an accesstoken, call the authenticate endpoint with your username and password:

```curl theme={null}
curl "https://example.ziik.io/api/authenticate"
  -d '{"username":"example@example.com","password":"thisIsMyPassword"}'
```

The above command returns JSON structured like this:

```json theme={null}
[
  {
    "jwt": "aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc",
    "expires": 12345678
  }
]
```

"expires" is the Unix timestamp of when the accesstoken is no longer valid.

## Set Authorization header

The API expects the accesstoken to be included in all following API requests:

`Authorization: Bearer aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc`

## Renew an accesstoken

To renew the accesstoken, simply call the renew endpoint and use the renewed token for future calls.

```
curl "https://example.ziik.io/api/renew"
  -H "Authorization: Bearer aaaaaaaaaa.bbbbbbbbbbb.cccccccccccc"
```
