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

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

payload = {
"name": "web-app",
"description": "Browser integration"
}
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: 'web-app', description: 'Browser integration'})
};

fetch('https://management-api.suprsend.com/v1/{workspace}/ws_public_key/', 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}/ws_public_key/",
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' => 'web-app',
'description' => 'Browser integration'
]),
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}/ws_public_key/"

payload := strings.NewReader("{\n \"name\": \"web-app\",\n \"description\": \"Browser integration\"\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}/ws_public_key/")
.header("ServiceToken <token>", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"web-app\",\n \"description\": \"Browser integration\"\n}")
.asString();
require 'uri'
require 'net/http'

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

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\": \"web-app\",\n \"description\": \"Browser integration\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "ws_pubk_exampleId01",
  "api_key": "SS.PUBK.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "name": "web-app",
  "allowed_domains": null,
  "is_secure_mode_enabled": false,
  "is_deleted": false,
  "is_default": false,
  "created_at": "2026-04-21T12:31:18.943398Z",
  "created_by": {
    "name": "System User",
    "email": "org_XXXXXXXXXXXXXXXXXXXXXX@systemuser.suprsend.com"
  },
  "rotated_at": null,
  "rotated_by": null,
  "updated_at": "2026-04-21T12:31:18.943443Z",
  "updated_by": null
}
{
"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."
}
{
"code": 404,
"error_code": "not_found",
"type": "NotFound",
"message": "workspace 'demo' not found",
"detail": "workspace 'demo' not found"
}

Authorizations

ServiceToken <token>
string
header
required

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

Path Parameters

workspace
string
required

Workspace slug (e.g. staging, production).

Body

application/json
name
string
required

Label for the public key.

Example:

"web-app"

description
string | null

Optional notes.

Response

Public key created.

Workspace public key used by client SDKs.

id
string

Unique identifier of the public key.

Example:

"ws_pubk_exampleId01"

api_key
string

Public key value exposed to clients.

Example:

"SS.PUBK.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

name
string

Label for the public key.

Example:

"web-app"

allowed_domains
string[] | null

Domains allowed to use this public key.

is_secure_mode_enabled
boolean

Indicates whether secure mode is enabled for this key.

is_deleted
boolean

Indicates whether the public key has been deleted.

is_default
boolean

Indicates whether this is the default public key for the workspace.

created_at
string<date-time>

Timestamp when the public key was created.

created_by
object | null

Identity that performed an action (created, updated, rolled, deleted, rotated).

rotated_at
string<date-time> | null

Timestamp when the public key was last rotated.

rotated_by
object | null

Identity that performed an action (created, updated, rolled, deleted, rotated).

updated_at
string<date-time>

Timestamp when the public key was last updated.

updated_by
object | null

Identity that performed an action (created, updated, rolled, deleted, rotated).