Skip to main content
POST
/
v1
/
workspace
/
Create Workspace
curl -X POST "https://management-api.suprsend.com/v1/workspace" \
  --header 'Authorization: ServiceToken <SERVICE_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{"name":"my-workspace","description":"Testing workspace API"}'
import requests

url = "https://management-api.suprsend.com/v1/workspace/"

payload = {
"name": "my-workspace",
"description": "Testing workspace API"
}
headers = {
"ServiceToken <token>": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'ServiceToken <token>': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'my-workspace', description: 'Testing workspace API'})
};

fetch('https://management-api.suprsend.com/v1/workspace/', 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://management-api.suprsend.com/v1/workspace/",
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([
'name' => 'my-workspace',
'description' => 'Testing workspace API'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ServiceToken <token>: <api-key>"
],
]);

$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://management-api.suprsend.com/v1/workspace/"

payload := strings.NewReader("{\n \"name\": \"my-workspace\",\n \"description\": \"Testing workspace API\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("ServiceToken <token>", "<api-key>")
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://management-api.suprsend.com/v1/workspace/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"my-workspace\",\n \"description\": \"Testing workspace API\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://management-api.suprsend.com/v1/workspace/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["ServiceToken <token>"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"my-workspace\",\n \"description\": \"Testing workspace API\"\n}"

response = http.request(request)
puts response.read_body
{
  "meta": {
    "count": 3,
    "limit": 10,
    "offset": 0
  },
  "results": [
    {
      "uid": "wksp_exampleUid01",
      "slug": "staging",
      "data_center": {},
      "is_expired": false,
      "has_limit_reached": false,
      "name": "Staging",
      "description": "Development environment to test iterations internally",
      "mode": "sandbox"
    },
    {
      "uid": "wksp_exampleUid02",
      "slug": "production",
      "data_center": {},
      "is_expired": false,
      "has_limit_reached": false,
      "name": "Production",
      "description": "Final environment to send notifications to live users",
      "mode": "production"
    },
    {
      "uid": "wksp_exampleUid03",
      "slug": "my-workspace",
      "data_center": {},
      "is_expired": false,
      "has_limit_reached": false,
      "name": "my-workspace",
      "description": "Testing workspace API",
      "mode": "sandbox"
    }
  ]
}
{
"code": 123,
"error_code": "<string>",
"type": "<string>",
"message": "<string>",
"detail": "<string>"
}
{
"code": 401,
"error_code": "authentication_failed",
"type": "AuthenticationFailed",
"message": "Invalid service token.",
"detail": "Invalid service token."
}

Authorizations

ServiceToken <token>
string
header
required

You can get Service Token from SuprSend dashboard -> Account Settings -> Service Tokens section.

Body

application/json
name
string
required

Workspace name.

Example:

"my-workspace"

description
string | null

Optional workspace description.

Example:

"Testing workspace API"

Response

Workspace created. Response returns the updated paginated list of workspaces in the account.

meta
object

Pagination metadata (when applicable)

results
object[]