Update Workspace
curl --request PATCH \
--url https://app.tokencraft.dev/api/v1/workspaces/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.tokencraft.dev/api/v1/workspaces/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.tokencraft.dev/api/v1/workspaces/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
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/{id}"
req, _ := http.NewRequest("PATCH", 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.patch("https://app.tokencraft.dev/api/v1/workspaces/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tokencraft.dev/api/v1/workspaces/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyWorkspaces
Update Workspace
Update workspace details
PATCH
/
workspaces
/
{id}
Update Workspace
curl --request PATCH \
--url https://app.tokencraft.dev/api/v1/workspaces/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.tokencraft.dev/api/v1/workspaces/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.tokencraft.dev/api/v1/workspaces/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
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/{id}"
req, _ := http.NewRequest("PATCH", 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.patch("https://app.tokencraft.dev/api/v1/workspaces/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tokencraft.dev/api/v1/workspaces/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyUpdate Workspace
Updates an existing workspace. Only provided fields will be updated.Write access policy - This endpoint requires the
write:tokens scope.- TEAM-owned workspace:
owner,admin,editorcan write;vieweris blocked (403). - Non-TEAM workspace: only the workspace owner can write.
- If the workspace owner plan has no API write access (for example FREE), write is blocked.
Endpoint
PATCH /workspaces/{id}
Authentication
Requires a valid API token in the Authorization header.Request
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer token | Yes |
Content-Type | application/json | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Workspace ID |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | New workspace name (max 255 characters) |
description | string | No | New description (null to remove) |
All body parameters are optional. Only provided fields will be updated.
Request Body
{
"name": "Updated Design System",
"description": "Updated description"
}
Response
Success Response
Status:200 OK
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Updated Design System",
"description": "Updated description",
"user_id": "user-123",
"created_at": "2025-01-15T10:00:00Z",
"updated_at": "2025-01-15T14:30:00Z"
}
Examples
curl -X PATCH https://app.tokencraft.dev/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer tkc_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Design System"
}'
curl -X PATCH https://app.tokencraft.dev/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer tkc_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"description": "New description"
}'
curl -X PATCH https://app.tokencraft.dev/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer tkc_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"description": null
}'
const workspaceId = '550e8400-e29b-41d4-a716-446655440000';
const response = await fetch(
`https://app.tokencraft.dev/api/v1/workspaces/${workspaceId}`,
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer tkc_your_token_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Updated Design System',
description: 'Updated description'
})
}
);
const workspace = await response.json();
workspace_id = '550e8400-e29b-41d4-a716-446655440000'
response = requests.patch(
f'https://app.tokencraft.dev/api/v1/workspaces/{workspace_id}',
headers={
'Authorization': 'Bearer tkc_your_token_here',
'Content-Type': 'application/json'
},
json={
'name': 'Updated Design System',
'description': 'Updated description'
}
)
workspace = response.json()
Error Responses
400 Bad Request
{
"error": "Name must be a non-empty string"
}
- Empty
namefield nameexceeds 255 characters- Invalid field types
401 Unauthorized
{
"error": "Invalid API token"
}
404 Not Found
{
"error": "Workspace not found"
}
- Workspace ID doesn’t exist
- You do not have access to this workspace
Validation Rules
- name: If provided, must be non-empty string, max 255 characters
- description: If provided, must be string or null
Use Cases
1. Rename Workspace
await updateWorkspace(id, { name: 'New Name' });
2. Update Description
await updateWorkspace(id, {
description: 'Updated project description'
});
3. Remove Description
await updateWorkspace(id, { description: null });
Next Steps
Delete Workspace
Permanently delete a workspace
Get Workspace
Retrieve workspace details