Create Service Accounts
Create Service Account
Create a new service account for your organization and optionally add it to one or more projects in your organization
POST
/
organizations
/
{organizationId}
/
service-accounts
Create Service Account
curl --request POST \
--url https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"expires": "2023-11-07T05:31:56Z",
"projects": [
{
"id": 123
}
]
}
'import requests
url = "https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts"
payload = {
"username": "<string>",
"expires": "2023-11-07T05:31:56Z",
"projects": [{ "id": 123 }]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({username: '<string>', expires: '2023-11-07T05:31:56Z', projects: [{id: 123}]})
};
fetch('https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts', 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://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'username' => '<string>',
'expires' => '2023-11-07T05:31:56Z',
'projects' => [
[
'id' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts"
payload := strings.NewReader("{\n \"username\": \"<string>\",\n \"expires\": \"2023-11-07T05:31:56Z\",\n \"projects\": [\n {\n \"id\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"username\": \"<string>\",\n \"expires\": \"2023-11-07T05:31:56Z\",\n \"projects\": [\n {\n \"id\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"username\": \"<string>\",\n \"expires\": \"2023-11-07T05:31:56Z\",\n \"projects\": [\n {\n \"id\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": {
"token": "<string>",
"id": 123,
"username": "<string>",
"last_used": "2023-11-07T05:31:56Z",
"expires": "2023-11-07T05:31:56Z",
"creator": 123,
"created": "2023-11-07T05:31:56Z",
"user": 123
},
"status": "ok"
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}Authorizations
Service Account
Path Parameters
Your organization id (eg: 12345)
Body
application/json
A descriptive name for the service account
The service account's role
Available options:
owner, admin, analyst, consumer The datetime that the service account should expire
A list of projects to make this serivce account a member of
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create Service Account
curl --request POST \
--url https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"expires": "2023-11-07T05:31:56Z",
"projects": [
{
"id": 123
}
]
}
'import requests
url = "https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts"
payload = {
"username": "<string>",
"expires": "2023-11-07T05:31:56Z",
"projects": [{ "id": 123 }]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({username: '<string>', expires: '2023-11-07T05:31:56Z', projects: [{id: 123}]})
};
fetch('https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts', 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://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'username' => '<string>',
'expires' => '2023-11-07T05:31:56Z',
'projects' => [
[
'id' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$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://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts"
payload := strings.NewReader("{\n \"username\": \"<string>\",\n \"expires\": \"2023-11-07T05:31:56Z\",\n \"projects\": [\n {\n \"id\": 123\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"username\": \"<string>\",\n \"expires\": \"2023-11-07T05:31:56Z\",\n \"projects\": [\n {\n \"id\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/api/app/organizations/{organizationId}/service-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"username\": \"<string>\",\n \"expires\": \"2023-11-07T05:31:56Z\",\n \"projects\": [\n {\n \"id\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": {
"token": "<string>",
"id": 123,
"username": "<string>",
"last_used": "2023-11-07T05:31:56Z",
"expires": "2023-11-07T05:31:56Z",
"creator": 123,
"created": "2023-11-07T05:31:56Z",
"user": 123
},
"status": "ok"
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}