service-accounts
Read a service account with its tokens and project grants
GET
/
api
/
v1
/
service-accounts
/
{id}
Read a service account with its tokens and project grants
curl --request GET \
--url https://api.nitsor.com/api/v1/service-accounts/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nitsor.com/api/v1/service-accounts/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nitsor.com/api/v1/service-accounts/{id}', 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.nitsor.com/api/v1/service-accounts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nitsor.com/api/v1/service-accounts/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nitsor.com/api/v1/service-accounts/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nitsor.com/api/v1/service-accounts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"grants": [
{
"createdAt": "2023-11-07T05:31:56Z",
"projectId": "<string>",
"rung": "read",
"projectName": "<string>"
}
],
"grantsTruncated": true,
"serviceAccount": {
"accountPermissions": [
"account:read"
],
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"id": "<string>",
"liveTokens": {
"count": 1,
"truncated": true,
"lastUsedAt": "2023-11-07T05:31:56Z",
"soonestExpiresAt": "2023-11-07T05:31:56Z"
},
"name": "<string>",
"projectGrants": {
"count": 1,
"truncated": true
},
"status": "active",
"subject": "<string>",
"description": "<string>",
"disabledAt": "2023-11-07T05:31:56Z",
"disabledBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"disabledReason": "<string>",
"owner": {
"active": true,
"membershipId": "<string>",
"email": "<string>",
"leftAt": "2023-11-07T05:31:56Z",
"name": "<string>"
},
"retiredAt": "2023-11-07T05:31:56Z",
"retiredBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"retiredReason": "<string>"
},
"tokens": [
{
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"effectivePermissions": [
"account:read"
],
"id": "<string>",
"name": "<string>",
"restriction": {
"projects": [
"<string>"
],
"accountPermissions": [
"account:read"
]
},
"serviceAccountId": "<string>",
"status": "active",
"expiresAt": "2023-11-07T05:31:56Z",
"hint": "<string>",
"lastUsedAt": "2023-11-07T05:31:56Z",
"replacedAt": "2023-11-07T05:31:56Z",
"replacedByTokenId": "<string>",
"replacesTokenId": "<string>",
"revokedAt": "2023-11-07T05:31:56Z",
"revokedBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"revokedReason": "<string>",
"storageNote": "<string>"
}
],
"tokensTruncated": true
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}No plan can call this operation today. It needs a personal access token, and Nitsor does not issue personal access tokens.
Authorizations
⌘I
Read a service account with its tokens and project grants
curl --request GET \
--url https://api.nitsor.com/api/v1/service-accounts/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.nitsor.com/api/v1/service-accounts/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.nitsor.com/api/v1/service-accounts/{id}', 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.nitsor.com/api/v1/service-accounts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nitsor.com/api/v1/service-accounts/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nitsor.com/api/v1/service-accounts/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nitsor.com/api/v1/service-accounts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"grants": [
{
"createdAt": "2023-11-07T05:31:56Z",
"projectId": "<string>",
"rung": "read",
"projectName": "<string>"
}
],
"grantsTruncated": true,
"serviceAccount": {
"accountPermissions": [
"account:read"
],
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"id": "<string>",
"liveTokens": {
"count": 1,
"truncated": true,
"lastUsedAt": "2023-11-07T05:31:56Z",
"soonestExpiresAt": "2023-11-07T05:31:56Z"
},
"name": "<string>",
"projectGrants": {
"count": 1,
"truncated": true
},
"status": "active",
"subject": "<string>",
"description": "<string>",
"disabledAt": "2023-11-07T05:31:56Z",
"disabledBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"disabledReason": "<string>",
"owner": {
"active": true,
"membershipId": "<string>",
"email": "<string>",
"leftAt": "2023-11-07T05:31:56Z",
"name": "<string>"
},
"retiredAt": "2023-11-07T05:31:56Z",
"retiredBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"retiredReason": "<string>"
},
"tokens": [
{
"createdAt": "2023-11-07T05:31:56Z",
"createdBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"effectivePermissions": [
"account:read"
],
"id": "<string>",
"name": "<string>",
"restriction": {
"projects": [
"<string>"
],
"accountPermissions": [
"account:read"
]
},
"serviceAccountId": "<string>",
"status": "active",
"expiresAt": "2023-11-07T05:31:56Z",
"hint": "<string>",
"lastUsedAt": "2023-11-07T05:31:56Z",
"replacedAt": "2023-11-07T05:31:56Z",
"replacedByTokenId": "<string>",
"replacesTokenId": "<string>",
"revokedAt": "2023-11-07T05:31:56Z",
"revokedBy": {
"issuer": "<string>",
"subject": "<string>",
"type": "system"
},
"revokedReason": "<string>",
"storageNote": "<string>"
}
],
"tokensTruncated": true
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}{
"requestId": "<string>",
"retryable": true,
"code": "AUTHORIZATION_DENIED",
"message": "<string>",
"missingScope": "<string>",
"reason": "<string>",
"decisionId": "<string>"
}