Skip to main content
POST
/
api
/
v1
/
organizations
Create Organization
curl --request POST \
  --url https://api.bunship.com/api/v1/organizations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "slug": "<string>",
  "description": "<string>",
  "logoUrl": "<string>"
}
'
import requests

url = "https://api.bunship.com/api/v1/organizations"

payload = {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"logoUrl": "<string>"
}
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: '<string>',
slug: '<string>',
description: '<string>',
logoUrl: '<string>'
})
};

fetch('https://api.bunship.com/api/v1/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.bunship.com/api/v1/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' => '<string>',
'slug' => '<string>',
'description' => '<string>',
'logoUrl' => '<string>'
]),
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.bunship.com/api/v1/organizations"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"logoUrl\": \"<string>\"\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.bunship.com/api/v1/organizations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"logoUrl\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.bunship.com/api/v1/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\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"logoUrl\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "org_cld2abc123def456",
  "name": "Acme Corp",
  "slug": "acme-corp",
  "description": "Building the future of widgets",
  "logoUrl": "https://cdn.bunship.com/logos/acme.png",
  "settings": {},
  "createdBy": "usr_cld2abc123def456",
  "createdAt": "2024-01-15T10:00:00Z",
  "updatedAt": "2024-01-15T10:00:00Z"
}
Creates a new organization. The authenticated user automatically becomes the organization owner with full permissions.

Auth

Requires a valid Bearer token.

Request Body

name
string
required
Organization display name. Between 1 and 100 characters.
slug
string
required
URL-friendly identifier. Lowercase letters, numbers, and hyphens only. Between 3 and 50 characters. Must match the pattern ^[a-z0-9]+(?:-[a-z0-9]+)*$.
description
string
Organization description. Maximum 500 characters.
logoUrl
string
URL of the organization logo image. Must be a valid URI.

Response

id
string
Organization identifier.
name
string
Organization name.
slug
string
URL slug.
description
string | null
Description.
logoUrl
string | null
Logo URL.
settings
object
Organization settings (branding, features, billing).
createdBy
string
User ID of the creator.
createdAt
string
ISO 8601 creation timestamp.
updatedAt
string
ISO 8601 last update timestamp.
{
  "id": "org_cld2abc123def456",
  "name": "Acme Corp",
  "slug": "acme-corp",
  "description": "Building the future of widgets",
  "logoUrl": "https://cdn.bunship.com/logos/acme.png",
  "settings": {},
  "createdBy": "usr_cld2abc123def456",
  "createdAt": "2024-01-15T10:00:00Z",
  "updatedAt": "2024-01-15T10:00:00Z"
}

Errors

StatusCodeDescription
400VALIDATION_ERRORInvalid slug format or missing required fields
401AUTHENTICATION_ERRORMissing or invalid Bearer token
409CONFLICTOrganization slug already exists

Example

curl -X POST https://api.bunship.com/api/v1/organizations \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "slug": "acme-corp",
    "description": "Building the future of widgets"
  }'