Create a tenant
curl --request POST \
--url https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tenant_id": "acme-corp",
"name": "Acme Corporation"
}
'import requests
url = "https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants"
payload = {
"tenant_id": "acme-corp",
"name": "Acme Corporation"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({tenant_id: 'acme-corp', name: 'Acme Corporation'})
};
fetch('https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants', 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://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants",
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([
'tenant_id' => 'acme-corp',
'name' => 'Acme Corporation'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants"
payload := strings.NewReader("{\n \"tenant_id\": \"acme-corp\",\n \"name\": \"Acme Corporation\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tenant_id\": \"acme-corp\",\n \"name\": \"Acme Corporation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tenant_id\": \"acme-corp\",\n \"name\": \"Acme Corporation\"\n}"
response = http.request(request)
puts response.read_body{
"tenant": {
"tenant_id": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "validation_error",
"message": "Request body failed schema validation.",
"details": [
{
"path": "/subject_id",
"message": "subject_id is required."
}
]
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required."
}
}{
"error": {
"code": "validation_error",
"message": "Request body failed schema validation.",
"details": [
{
"path": "/subject_id",
"message": "subject_id is required.",
"code": "invalid_type"
}
],
"request_id": "req_01j2k3m4n5"
}
}Tenants & Principals
Create Tenant
Creates a new tenant and bootstraps the calling principal as its first
tenant_admin. The tenant becomes the owner of subjects created under it.
POST
/
v1
/
tenants
Create a tenant
curl --request POST \
--url https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tenant_id": "acme-corp",
"name": "Acme Corporation"
}
'import requests
url = "https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants"
payload = {
"tenant_id": "acme-corp",
"name": "Acme Corporation"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({tenant_id: 'acme-corp', name: 'Acme Corporation'})
};
fetch('https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants', 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://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants",
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([
'tenant_id' => 'acme-corp',
'name' => 'Acme Corporation'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants"
payload := strings.NewReader("{\n \"tenant_id\": \"acme-corp\",\n \"name\": \"Acme Corporation\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tenant_id\": \"acme-corp\",\n \"name\": \"Acme Corporation\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tally-platform-api-xwka6vu2kq-ue.a.run.app/v1/tenants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tenant_id\": \"acme-corp\",\n \"name\": \"Acme Corporation\"\n}"
response = http.request(request)
puts response.read_body{
"tenant": {
"tenant_id": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "validation_error",
"message": "Request body failed schema validation.",
"details": [
{
"path": "/subject_id",
"message": "subject_id is required."
}
]
}
}{
"error": {
"code": "unauthorized",
"message": "Authentication required."
}
}{
"error": {
"code": "validation_error",
"message": "Request body failed schema validation.",
"details": [
{
"path": "/subject_id",
"message": "subject_id is required.",
"code": "invalid_type"
}
],
"request_id": "req_01j2k3m4n5"
}
}Authorizations
Firebase Auth JWT issued by Google Identity Platform.
Obtain a token by signing in at your app domain and calling
firebase.auth().currentUser.getIdToken().
Body
application/json
Response
Tenant created.
Show child attributes
Show child attributes
⌘I