Accept Invite
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept"
payload = { "actingUserId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({actingUserId: '<string>'})
};
fetch('https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept', 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://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept",
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([
'actingUserId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept"
payload := strings.NewReader("{\n \"actingUserId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyWorkspace — Invitations
Accept Invite
Accept an invitation — identity-matched + verified-email, no token
Accept Invite
curl --request POST \
--url https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actingUserId": "<string>"
}
'import requests
url = "https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept"
payload = { "actingUserId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({actingUserId: '<string>'})
};
fetch('https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept', 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://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept",
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([
'actingUserId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept"
payload := strings.NewReader("{\n \"actingUserId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actingUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/workspace-invites/:inviteId/accept")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actingUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAccepts an invitation. Note the path is not
On accept, the stored grant is applied and the
The invitation is already
The
A service/master key called this route without naming an
A plain user token sent an
Every path id on the workspaces bundle is checked for UUID shape before the route runs, so a malformed one is a plain
See also: useAcceptWorkspaceInvite
:id-scoped — it is addressed by the (non-secret) invitation id.
Acceptance is identity-matched + verified-email, no token:
- The caller must be the invite’s target (by
userIdor normalizedemail). - The caller must have a verified email — required to accept any invite (userId- or email-addressed). An unverified accept returns
workspace/email-not-verifiedso your app can prompt verification. - Knowing the
inviteIddoes not let a non-target accept.
A service/master key does not bypass either gate. Naming an
actingUserId means being that user, so a backend auto-join flow must satisfy the invitee’s own conditions: the invitation must be actually addressed to the named user (otherwise 404 workspace/invite-not-found — accepting Alice’s invite while naming Bob does not work), and that user’s email must be verified (otherwise 403 workspace/email-not-verified). And there is no unbounded path here to fall back on: an acceptance has to land on somebody’s membership row, so actingUserId is required for a key — omitting it is a 400 workspace/missing-user-id, not a bypass. If your onboarding pre-accepts invites server-side, verify the address first. See Acting on behalf of a user.WorkspaceMember is created transactionally; the invite is marked accepted. Fires both workspace.invite.accepted and workspace.member.added (invitation-lifecycle vs roster-sync — intentionally two streams).
Idempotence: if the caller is already a member (or owner), accept is a no-op — the invite is marked accepted, no duplicate row is created, the existing grant is not overwritten, and no workspace.member.added fires.
Path Parameters
string
required
The (non-secret) invitation UUID.
Body Parameters
string
required
Service/master keys only — the accepting user. Required for a key: an acceptance has to land on somebody’s membership row, so there is no unbounded path — a key that names nobody is refused with
400 workspace/missing-user-id. Enforced: both gates above run against that user.A plain user token omits it — the actor is the token’s own user. The field is not ignored for such a token: sending your own user id is a harmless no-op, but sending anyone else’s is a 403 workspace/unauthorized. See Acting on behalf of a user.Response
{ "success": true, "workspaceId": "ws_abc" }
Error Responses
Email Not Verified — 403
Email Not Verified — 403
{ "error": "A verified email is required to accept an invitation.", "code": "workspace/email-not-verified" }
Not the Target — 404
Not the Target — 404
A caller who is not the invitation’s target receives the same
404 as a
non-existent invitation — knowing an invite id must never confirm to a
non-target that it exists.{ "error": "Invitation not found.", "code": "workspace/invite-not-found" }
Invite Expired — 409
Invite Expired — 409
{ "error": "This invitation has expired.", "code": "workspace/invite-expired" }
Invite Not Found — 404
Invite Not Found — 404
{ "error": "Invitation not found.", "code": "workspace/invite-not-found" }
Invite Terminal — 409
Invite Terminal — 409
{ "error": "This invitation is no longer pending.", "code": "workspace/invite-terminal" }
accepted, declined, or revoked.Acting User Not Found — 404
Acting User Not Found — 404
{ "error": "Acting user not found.", "code": "workspace/invalid-target" }
actingUserId a key named does not exist in this project. Naming is not authentication — the id is only looked up here.Missing Acting User — 400
Missing Acting User — 400
{ "error": "Missing user ID", "code": "workspace/missing-user-id" }
actingUserId. An acceptance creates someone’s membership row, so there is nobody for it to land on.Acted as Another User — 403
Acted as Another User — 403
{ "error": "Unauthorized", "code": "workspace/unauthorized" }
actingUserId naming a different user. Only a service/master key may act as someone else.Invalid Path Parameter — 400
Invalid Path Parameter — 400
{ "error": "Invalid invitation id: expected a UUID.", "code": "workspace/invalid-params" }
400 rather than a 500 from the database.
