Summary

The createEmptyOrganization() mutation creates a new, empty organization in LogScale. The new organization has no repositories, users, or configured limits. Provide the organization name at minimum; optionally supply a description, subdomain, organization ID, and CID to pre-populate those fields at creation time.

Syntax

graphql
createEmptyOrganization(
      name: String!,
      description: String,
      organizationId: String,
      subdomain: String,
      cid: String
   ): Organization!

The name argument is required. All other arguments are optional. The mutation returns an Organization! object representing the new organization.

Example

Raw
graphql
mutation {
  createEmptyOrganization(
        name: "corporate",
        description: "The Corporation"
        )
  { id }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  createEmptyOrganization(
        name: \"corporate\",
        description: \"The Corporation\"
        )
  { id }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  createEmptyOrganization(
        name: \"corporate\",
        description: \"The Corporation\"
        )
  { id }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  createEmptyOrganization( ^
        name: \"corporate\", ^
        description: \"The Corporation\" ^
        ) ^
  { id } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  createEmptyOrganization(
        name: \"corporate\",
        description: \"The Corporation\"
        )
  { id }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  createEmptyOrganization(
        name: \"corporate\",
        description: \"The Corporation\"
        )
  { id }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  createEmptyOrganization(
        name: \"corporate\",
        description: \"The Corporation\"
        )
  { id }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  createEmptyOrganization(
        name: \"corporate\",
        description: \"The Corporation\"
        )
  { id }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "createEmptyOrganization": {
      "id": "SINGLE_ORGANIZATION_ID"
    }
  }
}

Input Parameters

Only name is required. Supply the remaining parameters to pre-populate optional fields at creation time.

Table: Input Parameters and Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
cid String     The CrowdStrike Customer ID (CID) to associate with this organization. The CID links the organization to a CrowdStrike parent account for billing attribution and cross-product identity. If omitted, the organization has no CID association.
description String     A free-text description of the organization's purpose or scope. If omitted, the description field is blank.
name String yes   The display name for the organization. This value appears in the LogScale interface and in API responses.
organizationId String     A custom unique identifier for the organization. If omitted, LogScale generates an ID automatically.
subdomain String     The subdomain prefix used to construct the organization's URL. Omitting this argument leaves the subdomain unset at creation time.

Returned Values

The mutation returns an Organization! object representing the newly created organization. Request the id field to obtain the organization's unique identifier for use in follow-on mutations and queries. All other fields reflect default values set at creation time.