Create workspace API key
Generate a new API key (sk_...) for the workspace. A workspace can only have one API key at a time — returns 409 if one already exists.
Requires a platform API key (sk_user_...). Workspace keys are rejected with 403. Only owners and admins can manage API keys.
curl -X POST "https://api.sendkit.ai/v1/workspaces/example_string/api-key" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY"
import requests
import json
url = "https://api.sendkit.ai/v1/workspaces/example_string/api-key"
headers = {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
response = requests.post(url, headers=headers)
print(response.json())
const response = await fetch("https://api.sendkit.ai/v1/workspaces/example_string/api-key", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Api-Key": "YOUR_API_KEY"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("POST", "https://api.sendkit.ai/v1/workspaces/example_string/api-key", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.sendkit.ai/v1/workspaces/example_string/api-key')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-Api-Key'] = 'YOUR_API_KEY'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"apiKey": "sk_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4",
"createdAt": "2025-06-01T10:30:00.000Z",
"createdBy": "664f0a1b2c3d4e5f6a7b8c9d"
}
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
{
"error": "Not Found",
"message": "The requested resource was not found",
"code": 404
}
{
"error": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
POST
/v1/workspaces/{workspaceId}/api-keyPOST
API Key (header: X-Api-Key)
X-Api-Keystring
RequiredPlatform API key (sk_user_...) or Workspace API key (sk_...)
Platform API key (sk_user_...) or Workspace API key (sk_...)
path
workspaceIdstring
RequiredWorkspace ID
Request Preview
Response
Response will appear here after sending the request
Authentication
header
X-Api-Keystring
RequiredAPI Key for authentication. Platform API key (sk_user_...) or Workspace API key (sk_...)
Path Parameters
workspaceIdstring
RequiredWorkspace ID
Responses
successboolean
dataobject
apiKeystring
The generated workspace API key
createdAtstring
createdBystring
User ID of the key creator
successboolean
errorobject
codestring
messagestring
successboolean
Allowed values:
falseerrorobject
codestring
messagestring
detailsobject[]
successboolean
errorobject
codestring
messagestring
Was this page helpful?
Last updated today
Built with Documentation.AI