Logo
Search
Docs

Workspace invitations accept

POST https://app.sulus.ai/api/workspace-invitations/accept

Accept an invitation (login or register)

Authentication

Send a bearer token created on your dashboard's Developer page:

Authorization: Bearer <YOUR_API_KEY>

Request body

token string Required

Plain invitation token.

Validation: required|string
name string Optional

Required only when registering a new account.

Validation: required|string|max:255 when unauthenticated
Stored in users.name
password string Optional

Required with password_confirmation when registering.

Validation: required|confirmed|Password::defaults() when unauthenticated
password_confirmation string Optional

Confirmation for password.

Validation: required with password when registering

Errors

StatusMeaningBody
422 Validation failed {"message":"The given data was invalid.","errors":{"email":["The email field is required."]}}
422 Token / email mismatch / existing account must log in {"message":"The given data was invalid.","errors":{"token":["This invitation was sent to a different email address. Please log in with the invited email."]}}
403 Feature workspaces not enabled {"message":"This feature is not enabled for your account. Please contact your administrator.","feature":"workspaces"}

Notes

  • When already authenticated, send only token; response omits top-level token.
  • When registering, response includes Sanctum personal access token under token.
  • Additional token errors: An account with this email already exists. Please log in to accept the invitation.; Registration details are required to accept this invitation.
curl --request POST \
  --url https://app.sulus.ai/api/workspace-invitations/accept \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
  "token": "plain-invite-token-from-email",
  "name": "Sam Rivera",
  "password": "a-secure-password",
  "password_confirmation": "a-secure-password"
}'
import requests

url = "https://app.sulus.ai/api/workspace-invitations/accept"
headers = {"Authorization": "Bearer <YOUR_API_KEY>"}
payload = {
  "token": "plain-invite-token-from-email",
  "name": "Sam Rivera",
  "password": "a-secure-password",
  "password_confirmation": "a-secure-password"
}

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

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	url := "https://app.sulus.ai/api/workspace-invitations/accept"
	payload := strings.NewReader(`{
  "token": "plain-invite-token-from-email",
  "name": "Sam Rivera",
  "password": "a-secure-password",
  "password_confirmation": "a-secure-password"
}`)
	req, _ := http.NewRequest("POST", url, payload)
	req.Header.Add("Authorization", "Bearer <YOUR_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))
}
Response 200
{
    "message": "Invitation accepted.",
    "data": {
        "workspace": {
            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
            "name": "Jane's Workspace"
        },
        "user": {
            "id": 44,
            "name": "Sam Rivera",
            "email": "[email protected]"
        }
    },
    "token": "1|sanctumPlainTextTokenForNewRegistrant"
}