Create a workspace and its connections
const url = 'http://localhost:3000/admin/workspaces';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","slug":"example","description":"example","ephemeral":false,"idleTtlSeconds":1,"retention":1,"maxMessages":1,"rateLimit":{"limit":1,"windowSeconds":1,"burst":1},"simulation":{"rates":{"delivered":100},"rules":[],"latency":{"minMs":0,"maxMs":0},"openRate":0,"clickRate":0},"metadata":{"additionalProperty":"example"},"connections":[{"kind":"resend","name":"example","retention":1,"rateLimit":{"limit":1,"windowSeconds":1,"burst":1},"simulation":{"rates":{"additionalProperty":1},"rules":[{"match":"example","status":"delivered","delayMs":1,"smtpCode":1}],"latency":{"minMs":1,"maxMs":1},"openRate":1,"clickRate":1}}],"templates":[{"externalId":1,"name":"example","subject":"example","html":"example","text":"example","sender":{"email":"example","name":"example"}}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/admin/workspaces \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "slug": "example", "description": "example", "ephemeral": false, "idleTtlSeconds": 1, "retention": 1, "maxMessages": 1, "rateLimit": { "limit": 1, "windowSeconds": 1, "burst": 1 }, "simulation": { "rates": { "delivered": 100 }, "rules": [], "latency": { "minMs": 0, "maxMs": 0 }, "openRate": 0, "clickRate": 0 }, "metadata": { "additionalProperty": "example" }, "connections": [ { "kind": "resend", "name": "example", "retention": 1, "rateLimit": { "limit": 1, "windowSeconds": 1, "burst": 1 }, "simulation": { "rates": { "additionalProperty": 1 }, "rules": [ { "match": "example", "status": "delivered", "delayMs": 1, "smtpCode": 1 } ], "latency": { "minMs": 1, "maxMs": 1 }, "openRate": 1, "clickRate": 1 } } ], "templates": [ { "externalId": 1, "name": "example", "subject": "example", "html": "example", "text": "example", "sender": { "email": "example", "name": "example" } } ] }'Secrets (connection keys, SMTP passwords, workspace key) are answered once.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
object
Responses
Section titled “Responses”Created.
object
object
object
object
object
object
object
object
Example
{ "workspace": { "rateLimit": { "windowSeconds": 1 }, "simulation": { "rates": { "delivered": 100 }, "rules": [], "latency": { "minMs": 0, "maxMs": 0 }, "openRate": 0, "clickRate": 0 } }, "connections": [ { "kind": "resend", "rateLimit": { "windowSeconds": 1 }, "simulation": { "rules": [ { "status": "delivered" } ] }, "credentials": { "kind": "resend" } } ]}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Error: validation_error
object
object
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Error: unauthorized
object
object
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Sent with every 401.
Sent with every 401.
Error: forbidden
object
object
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Error: conflict
object
object
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Error: payload_too_large
object
object
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Error: validation_error
object
object
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.
Error: internal_error
object
object
Example
{ "error": { "code": "unauthorized" }}Headers
Section titled “Headers”Id of the request (req_…), also the id of its request log row.
Id of the request (req_…), also the id of its request log row.