Obtain an access token
curl --request POST \
--url https://api.zivio.net/api/v4/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'zivio-tenant-id: <api-key>' \
--data grant_type=client_credentials \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data 'scope=projects:read milestones:read invoices:read'import requests
url = "https://api.zivio.net/api/v4/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "<string>",
"client_secret": "<string>",
"scope": "projects:read milestones:read invoices:read"
}
headers = {
"zivio-tenant-id": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'zivio-tenant-id': '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: '<string>',
client_secret: '<string>',
scope: 'projects:read milestones:read invoices:read'
})
};
fetch('https://api.zivio.net/api/v4/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zivio.net/api/v4/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"zivio-tenant-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zivio.net/api/v4/oauth/token"
payload := strings.NewReader("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("zivio-tenant-id", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zivio.net/api/v4/oauth/token")
.header("zivio-tenant-id", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zivio.net/api/v4/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["zivio-tenant-id"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 7200,
"scope": "projects:read milestones:read invoices:read"
}{
"error": "invalid_client",
"error_description": "Client authentication failed"
}{
"error": "invalid_client",
"error_description": "Client authentication failed"
}Authentication
Obtain an access token
Exchange client credentials for an access token using the OAuth 2.0 client_credentials grant type.
POST
/
oauth
/
token
Obtain an access token
curl --request POST \
--url https://api.zivio.net/api/v4/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'zivio-tenant-id: <api-key>' \
--data grant_type=client_credentials \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data 'scope=projects:read milestones:read invoices:read'import requests
url = "https://api.zivio.net/api/v4/oauth/token"
payload = {
"grant_type": "client_credentials",
"client_id": "<string>",
"client_secret": "<string>",
"scope": "projects:read milestones:read invoices:read"
}
headers = {
"zivio-tenant-id": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'zivio-tenant-id': '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: '<string>',
client_secret: '<string>',
scope: 'projects:read milestones:read invoices:read'
})
};
fetch('https://api.zivio.net/api/v4/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zivio.net/api/v4/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"zivio-tenant-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zivio.net/api/v4/oauth/token"
payload := strings.NewReader("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("zivio-tenant-id", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zivio.net/api/v4/oauth/token")
.header("zivio-tenant-id", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zivio.net/api/v4/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["zivio-tenant-id"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=client_credentials&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&scope=projects%3Aread%20milestones%3Aread%20invoices%3Aread"
response = http.request(request)
puts response.read_body{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 7200,
"scope": "projects:read milestones:read invoices:read"
}{
"error": "invalid_client",
"error_description": "Client authentication failed"
}{
"error": "invalid_client",
"error_description": "Client authentication failed"
}Authorizations
Your Zivio organisation identifier. The regional API endpoints serve every Zivio organisation, so each request must identify yours.
Body
application/x-www-form-urlencoded
OAuth 2.0 grant type
Available options:
client_credentials Your application client ID
Your application client secret
Space-separated list of scopes (e.g., "projects:read invoices:read")
Example:
"projects:read milestones:read invoices:read"

