Skip to main content

Authentication

The API uses OAuth 2.0 client credentials. Your app exchanges a client id and secret for an access token, then sends that token on later requests.


Set up your API client​

  1. Log in: Open your Zigned account and go to the developer settings.
  2. Create an API client: In "API Clients", choose 'Create New API Client'.
  3. Save your credentials: Copy the Client ID and Client Secret. Treat them like a password. Anyone with them can call the API as you.

Access tokens​


Request a token​

Send a POST request to the /token endpoint:

Requesting a token
curl -X POST https://api.zigned.se/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET"

Token response​

A successful response looks like this. Send the access token on later API requests.

Access token response
{
"access_token": "your_access_token",
"token_type": "Bearer",
"expires_in": 10000000
}

Call the API with the token​

Authenticated API request
curl -X GET https://api.zigned.se/oauth/test \
-H "Authorization: Bearer your_access_token"

How long tokens last​

Tokens stay valid for a long time. Store them safely.


Revoke a token​

Revoke an access token
curl -X DELETE http://api.zigned.se/oauth/token/YOUR_ACCESS_TOKEN

Next​

The following pages cover tokens and authentication in more detail.