Create Workspace
curl --request POST \
--url https://app.tokencraft.dev/api/v1/workspaces \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.tokencraft.dev/api/v1/workspaces"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.tokencraft.dev/api/v1/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://app.tokencraft.dev/api/v1/workspaces",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.tokencraft.dev/api/v1/workspaces"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.tokencraft.dev/api/v1/workspaces")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tokencraft.dev/api/v1/workspaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyWorkspaces
Create Workspace
Create a new workspace
POST
/
workspaces
Create Workspace
curl --request POST \
--url https://app.tokencraft.dev/api/v1/workspaces \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.tokencraft.dev/api/v1/workspaces"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.tokencraft.dev/api/v1/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://app.tokencraft.dev/api/v1/workspaces",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.tokencraft.dev/api/v1/workspaces"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.tokencraft.dev/api/v1/workspaces")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tokencraft.dev/api/v1/workspaces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyCreate Workspace
Creates a new workspace for the authenticated user.Write access policy - This endpoint requires the
write:tokens scope and API write access on the token owner account.
Workspace creation is blocked when the owner is at/above their workspace plan limit (existing workspaces stay accessible).Endpoint
POST /workspaces
Authentication
Requires a valid API token in the Authorization header.Request
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer token | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Workspace name (max 255 characters) |
description | string | No | Optional description |
Request Body
{
"name": "Design System",
"description": "Main product design system"
}
Response
Success Response
Status:201 Created
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Design System",
"description": "Main product design system",
"user_id": "user-123",
"created_at": "2025-01-15T10:00:00Z",
"updated_at": "2025-01-15T10:00:00Z"
}
Examples
curl -X POST https://app.tokencraft.dev/api/v1/workspaces \
-H "Authorization: Bearer tkc_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Design System",
"description": "Main product design system"
}'
const response = await fetch('https://app.tokencraft.dev/api/v1/workspaces', {
method: 'POST',
headers: {
'Authorization': 'Bearer tkc_your_token_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Design System',
description: 'Main product design system'
})
});
const workspace = await response.json();
console.log('Created workspace:', workspace.id);
import requests
response = requests.post(
'https://app.tokencraft.dev/api/v1/workspaces',
headers={
'Authorization': 'Bearer tkc_your_token_here',
'Content-Type': 'application/json'
},
json={
'name': 'Design System',
'description': 'Main product design system'
}
)
workspace = response.json()
print(f"Created workspace: {workspace['id']}")
Error Responses
400 Bad Request
{
"error": "Name is required and must be a non-empty string"
}
- Missing or empty
namefield nameexceeds 255 characters- Invalid field types
401 Unauthorized
{
"error": "Invalid API token"
}
403 Forbidden
{
"error": "API write access requires PRO or TEAM plan. Upgrade your plan to create resources via API."
}
- Owner plan does not include API write access
- Owner reached workspace creation limit on current plan
500 Internal Server Error
{
"error": "Internal server error"
}
Validation Rules
- name: Required, non-empty string, max 255 characters
- description: Optional string
Next Steps
Update Workspace
Update workspace details
Create Tokenset
Add tokensets to your workspace