---
title: "Attach an existing user"
method: POST
path: "/workspace/users/attach"
tags: ["Workspace"]
---

# Attach an existing user

`POST /workspace/users/attach`

Attach an existing standalone Publora user to your workspace as a managed
user. Because the target account already exists, this requires the target
user's consent: a valid access token belonging to that user (the
`accessToken` returned when they sign in), passed as `userAccessToken`.
Re-attaching a user who is already in your workspace is idempotent and
does not require a consent token.

**Requires Workspace access - contact serge@publora.com to enable.**

## Request body

- object
  - `email` string, email — The existing user's email. Provide either email or userId (also accepted as `username`).
  - `userId` string — The existing user's ObjectId. Provide either email or userId.
  - `userAccessToken` string — The target user's access token, proving consent. Required unless the user is already in your workspace. Also accepted as `attachToken` in the body or via the `x-publora-user-token` header.

## Response `200`

User attached (or already in your workspace)

- object
  - `user` ManagedUser
    - `_id` string — User ID
    - `username` string — User email
    - `displayName` string
    - `role` 'managed'
    - `dailyPostsLeft` integer
    - `connectionsPageUrl` string, uri, nullable — URL for user to connect their social accounts
    - `connectionsPageTokenExpiresAt` string, date-time, nullable
  - `alreadyInWorkspace` boolean — true if the user was already managed by your workspace (idempotent re-attach)

## Other responses

- `400` — Missing/invalid identifier, mismatched email vs userId, or the owner's own account
- `403` — Workspace access not enabled, the target user's consent token is missing/invalid/mismatched, or attaching would exceed the plan's connection limit
- `404` — No active user matches the identifier
- `409` — The target user is inactive, a workspace owner, in another workspace, or has an active subscription
- `500` — Server error

---

[API](https://skmtc.dev/publora/apis/publora-api.md) · [All operations](https://skmtc.dev/publora/apis/publora-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/publora/publora-api/revisions/a1534a88d80a/schema)
