Skip to main content
POST
/
api
/
members
Add Member
curl --request POST \
  --url https://api.example.com/api/members \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "<string>",
  "permission": "<string>"
}
'
{
  "member": {
    "email": "<string>",
    "permission": "<string>",
    "createdAt": "<string>"
  },
  "error": {}
}

Authentication

This endpoint requires admin authentication. Include your session cookie in the request.

Request Body

email
string
required
Email address of the member to add. Will be normalized (trimmed and lowercased).
permission
string
required
Permission level to assign. Must be one of:
  • admin - Full workspace access, can manage members and settings
  • send - Can view, edit, and send emails
  • edit - Can view and edit drafts, but cannot send
  • view - Read-only access to threads and emails

Response

Returns the created or updated member object from the database.
member
object

Error Responses

error
object

Examples

curl -X POST https://your-domain.com/api/members \
  -H "Cookie: your-session-cookie" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "permission": "send"
  }'

Example Response

{
  "email": "[email protected]",
  "permission": "send",
  "createdAt": "2026-03-01T10:30:00.000Z"
}

Implementation Details

  • Uses INSERT ... ON CONFLICT DO UPDATE pattern - if the member already exists, their permission is updated
  • Email addresses are automatically normalized (trimmed and lowercased)
  • Environment-based admins (from ADMIN_EMAILS) are automatically set to admin permission, overriding the requested permission
  • The member does not need to have logged in or have a user account to be added
  • Source: src/app/api/members/route.ts:55

Permission Hierarchy

Permissions follow a hierarchy where higher levels include all lower level capabilities:
admin (3) > send (2) > edit (1) > view (0)
  • view: Read-only access to all threads and emails
  • edit: View + ability to edit drafts and categorize threads
  • send: Edit + ability to send emails and manage thread status
  • admin: Send + ability to manage workspace members, services, and settings

Build docs developers (and LLMs) love