curl --request POST \
--url https://api.hq.zone/v1/api/me/workspaces \
--header 'Content-Type: application/json' \
--cookie hq-session= \
--data '
{
"invite_code": "<string>",
"workspace_name": "<string>",
"website": "<string>"
}
'import requests
url = "https://api.hq.zone/v1/api/me/workspaces"
payload = {
"invite_code": "<string>",
"workspace_name": "<string>",
"website": "<string>"
}
headers = {
"cookie": "hq-session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'hq-session=', 'Content-Type': 'application/json'},
body: JSON.stringify({invite_code: '<string>', workspace_name: '<string>', website: '<string>'})
};
fetch('https://api.hq.zone/v1/api/me/workspaces', 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.hq.zone/v1/api/me/workspaces",
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([
'invite_code' => '<string>',
'workspace_name' => '<string>',
'website' => '<string>'
]),
CURLOPT_COOKIE => "hq-session=",
CURLOPT_HTTPHEADER => [
"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.hq.zone/v1/api/me/workspaces"
payload := strings.NewReader("{\n \"invite_code\": \"<string>\",\n \"workspace_name\": \"<string>\",\n \"website\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "hq-session=")
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.hq.zone/v1/api/me/workspaces")
.header("cookie", "hq-session=")
.header("Content-Type", "application/json")
.body("{\n \"invite_code\": \"<string>\",\n \"workspace_name\": \"<string>\",\n \"website\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hq.zone/v1/api/me/workspaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'hq-session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"invite_code\": \"<string>\",\n \"workspace_name\": \"<string>\",\n \"website\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"onboarded": true,
"slug": "<string>"
}Create a new workspace
Greenfield-creates a brand-new tenant owned by the caller and switches the
session into it - the authenticated, in-product counterpart to the public
magic-link /v1/auth/signup funnel. Shares the exact same atomic provisioning
(signup::provision_email_tenant), so the new workspace gets the identical
onboarding flow; the only differences are that the owner is taken from the
caller’s verified session email (no re-entry, no magic-link round-trip) and
the session cookie is re-minted for the new tenant on the way out.
Still invite-gated: an invite_code is required and consumed single-use, so
an authenticated member can’t mint workspaces freely. Web-session only - a
PAT / OAuth token is pinned to one workspace and can’t create another.
Idempotency: the single-use invite row is the HARD guard (no double-create
even under concurrency or a cache outage). An optional Idempotency-Key
header adds soft lost-response replay - a retry with the same key returns the
already-created workspace instead of a spurious “invite already used”.
curl --request POST \
--url https://api.hq.zone/v1/api/me/workspaces \
--header 'Content-Type: application/json' \
--cookie hq-session= \
--data '
{
"invite_code": "<string>",
"workspace_name": "<string>",
"website": "<string>"
}
'import requests
url = "https://api.hq.zone/v1/api/me/workspaces"
payload = {
"invite_code": "<string>",
"workspace_name": "<string>",
"website": "<string>"
}
headers = {
"cookie": "hq-session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'hq-session=', 'Content-Type': 'application/json'},
body: JSON.stringify({invite_code: '<string>', workspace_name: '<string>', website: '<string>'})
};
fetch('https://api.hq.zone/v1/api/me/workspaces', 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.hq.zone/v1/api/me/workspaces",
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([
'invite_code' => '<string>',
'workspace_name' => '<string>',
'website' => '<string>'
]),
CURLOPT_COOKIE => "hq-session=",
CURLOPT_HTTPHEADER => [
"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.hq.zone/v1/api/me/workspaces"
payload := strings.NewReader("{\n \"invite_code\": \"<string>\",\n \"workspace_name\": \"<string>\",\n \"website\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "hq-session=")
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.hq.zone/v1/api/me/workspaces")
.header("cookie", "hq-session=")
.header("Content-Type", "application/json")
.body("{\n \"invite_code\": \"<string>\",\n \"workspace_name\": \"<string>\",\n \"website\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hq.zone/v1/api/me/workspaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'hq-session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"invite_code\": \"<string>\",\n \"workspace_name\": \"<string>\",\n \"website\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"onboarded": true,
"slug": "<string>"
}Authorizations
Browser session cookie set by sign-in. Web SPA only; not for PAT/OAuth integrators.
Body
Invite code (inv-…). Required and consumed single-use - creating a
workspace is invite-gated even for an already-authenticated member, so a
signed-in user can't mint workspaces without an invite to spend.
Display name for the new workspace; the URL slug derives from it.
Optional company website / domain; seeds the brand-style crawl. Falls back to the caller's email domain (unless free-mail) when omitted.
Response
Workspace created; session re-scoped to it (fresh cookie set)