post__workspace
POST /workspace
Create Workspace
Create a new workspace for the authenticated user's organization. The creator will automatically be added as an admin of the workspace.
TypeScript Client Library
public createWorkspace = async (request: WorkspaceTypes.CreateWorkspaceRequest): Promise<WorkspaceTypes.CreateWorkspaceResponse> => {
return this.makeRequest<WorkspaceTypes.CreateWorkspaceResponse>('workspace', 'POST', request);
};Code Samples
# You can also use wget
curl -X POST https://backend.flashback.tech/workspace \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-d '{
"name": "Development Workspace"
}'POST https://backend.flashback.tech/workspace HTTP/1.1
Host: backend.flashback.tech
Content-Type: application/json
Accept: application/json
Authorization: Bearer {access-token}
{
"name": "Development Workspace"
}const inputBody = '{
"name": "Development Workspace"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://backend.flashback.tech/workspace',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://backend.flashback.tech/workspace',
'{"name": "Development Workspace"}', headers: headers
p JSON.parse(result)import requests
import json
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
data = {
'name': 'Development Workspace'
}
r = requests.post('https://backend.flashback.tech/workspace',
headers=headers,
json=data)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array(
'name' => 'Development Workspace'
);
try {
$response = $client->request('POST','https://backend.flashback.tech/workspace', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}URL obj = new URL("https://backend.flashback.tech/workspace");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");
String jsonInputString = "{\"name\": \"Development Workspace\"}";
con.setDoOutput(true);
try(OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());package main
import (
"bytes"
"net/http"
"encoding/json"
)
func main() {
data := map[string]string{
"name": "Development Workspace",
}
jsonData, _ := json.Marshal(data)
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
req, err := http.NewRequest("POST", "https://backend.flashback.tech/workspace", bytes.NewBuffer(jsonData))
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}Body parameter
{
"name": "Development Workspace"
}Parameters
body
body
object
true
Workspace creation data
» name
body
string
true
The name of the workspace to create
Request Body Schema
» name
string
true
none
The name of the workspace
Example responses
201 Response
{
"success": true,
"workspace": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Development Workspace",
"orgId": "987fcdeb-51a2-43d1-9f12-345678901234"
}
}400 Response
{
"success": false,
"message": "User not found or account is not validated"
}403 Response
{
"success": false,
"message": "Insufficient permissions to create workspaces"
}500 Response
{
"success": false,
"message": "Failed to create workspace"
}Responses
Response Schema
Status Code 201
» success
boolean
true
none
Operation success status
» workspace
object
true
none
Created workspace details
»» id
string
true
none
Unique workspace identifier
»» name
string
true
none
Workspace name
»» orgId
string
true
none
Organization identifier
Status Code 400
» success
boolean
true
none
Operation success status
» message
string
true
none
Error message
Status Code 403
» success
boolean
true
none
Operation success status
» message
string
true
none
Error message
Status Code 500
» success
boolean
true
none
Operation success status
» message
string
true
none
Error message
Notes
Authentication Required: User must be authenticated with a valid Bearer token
Permissions: User must have OWNER, ADMINISTRATORS, or WORKSPACES role in their organization
Account Validation: User account must be validated to create workspaces
Workspace Naming: Workspace names must be unique within the organization
Auto-Admin: The creator is automatically added as an admin of the workspace
Last updated
Was this helpful?