Create organization
curl --request POST \
--url https://api.diversion.dev/v0/organizations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Example Organization"
}
'import requests
url = "https://api.diversion.dev/v0/organizations"
payload = { "name": "Example Organization" }
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({name: 'Example Organization'})
};
fetch('https://api.diversion.dev/v0/organizations', 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.diversion.dev/v0/organizations",
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([
'name' => 'Example Organization'
]),
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://api.diversion.dev/v0/organizations"
payload := strings.NewReader("{\n \"name\": \"Example Organization\"\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://api.diversion.dev/v0/organizations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Example Organization\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.diversion.dev/v0/organizations")
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 \"name\": \"Example Organization\"\n}"
response = http.request(request)
puts response.read_body{
"id": "org_123456",
"name": "Example Organization",
"owner_id": "user_123456",
"total_storage": 1000000,
"description": "This is an example organization.",
"members": [
{
"id": "member_123456",
"user_id": "user_123456",
"organization_id": "org_123456"
}
],
"invites": [
{
"id": 123456,
"organization_id": "org_123456",
"organization_name": "Great Organization",
"inviting_user_id": "user_123456",
"inviting_user_name": "John Doe",
"invited_email": "john.doe@example.com",
"created": "2023-01-01T00:00:00Z",
"expires": "2023-01-31T00:00:00Z"
}
],
"in_warning_group": true
}{
"status": 123,
"detail": "<string>",
"title": "<string>",
"type": "<string>"
}{
"status": 123,
"detail": "<string>",
"title": "<string>",
"type": "<string>"
}Organization Management
Create organization
Creates a new organization with the user as the owner If the user is already a member of an organization with the same name, the request will fail
POST
/
organizations
Create organization
curl --request POST \
--url https://api.diversion.dev/v0/organizations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Example Organization"
}
'import requests
url = "https://api.diversion.dev/v0/organizations"
payload = { "name": "Example Organization" }
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({name: 'Example Organization'})
};
fetch('https://api.diversion.dev/v0/organizations', 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.diversion.dev/v0/organizations",
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([
'name' => 'Example Organization'
]),
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://api.diversion.dev/v0/organizations"
payload := strings.NewReader("{\n \"name\": \"Example Organization\"\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://api.diversion.dev/v0/organizations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Example Organization\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.diversion.dev/v0/organizations")
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 \"name\": \"Example Organization\"\n}"
response = http.request(request)
puts response.read_body{
"id": "org_123456",
"name": "Example Organization",
"owner_id": "user_123456",
"total_storage": 1000000,
"description": "This is an example organization.",
"members": [
{
"id": "member_123456",
"user_id": "user_123456",
"organization_id": "org_123456"
}
],
"invites": [
{
"id": 123456,
"organization_id": "org_123456",
"organization_name": "Great Organization",
"inviting_user_id": "user_123456",
"inviting_user_name": "John Doe",
"invited_email": "john.doe@example.com",
"created": "2023-01-01T00:00:00Z",
"expires": "2023-01-31T00:00:00Z"
}
],
"in_warning_group": true
}{
"status": 123,
"detail": "<string>",
"title": "<string>",
"type": "<string>"
}{
"status": 123,
"detail": "<string>",
"title": "<string>",
"type": "<string>"
}Authorizations
This API uses OAuth 2 with the implicit grant flow
Body
application/json
Required string length:
1 - 128Example:
"Example Organization"
Response
Organization created
Unique identifier for the organization
Example:
"org_123456"
Name of the organization
Example:
"Example Organization"
ID of the user who owns the organization
Example:
"user_123456"
Total storage allocated to the organization
Example:
1000000
Description of the organization
Example:
"This is an example organization."
List of members in the organization
Show child attributes
Show child attributes
List of invites sent by the organization
Show child attributes
Show child attributes
Whether the organization is in the warning group
Example:
true
⌘I

