---
title: "Generate QR code for user"
method: POST
path: "/workspaces/{workspace_id}/users/{user_id}/qr"
tags: ["qr"]
---

# Generate QR code for user

`POST /workspaces/{workspace_id}/users/{user_id}/qr`

Issues a long-lived WhatsApp QR-code link for a specific user in a partner-managed workspace. If the user already has a connected WhatsApp account, that account is disconnected first and the previous QR link (if any) is revoked. Only one active QR link per user is allowed at any given time; generating a new link invalidates any existing one. The request optionally accepts expires_in_hours (1–168, default 24) to control how long the QR link remains valid. The response includes the workspace_id, user_id, an unguessable qr_link URL, its expires_at timestamp, and flags indicating whether an existing WhatsApp account was disconnected and whether a previously active QR link was revoked. Generating a new QR code link is a destructive action: any currently connected WhatsApp account for this user will be forcibly disconnected.

## Path parameters

- `workspace_id` string, required
- `user_id` integer, required

## Headers

- `X-TL-Partner-Id` string, required

## Request body

- PartnerAPIExpiresRequest — Request payload for configuring the lifetime of a WhatsApp QR link. The optional expires_in_hours field controls how long the issued qr_link remains valid. If omitted, a sensible default (24 hours) is applied by the server.
  - `expires_in_hours` integer — Number of hours until the link expires

## Response `200`

QR code generated

- PartnerAPIQRCodeResponse — Response payload returned when issuing a WhatsApp QR link for a user. Includes the workspace_id and user_id, the unguessable qr_link URL, its expires_at timestamp, and boolean flags showing whether an existing WhatsApp account was disconnected and whether any previously issued QR link for this user was revoked.
  - `workspace_id` string, required — Unique identifier for the workspace
  - `user_id` integer, required — Unique identifier for the user
  - `qr_link` string, required — QR code link for connecting to WhatsApp
  - `expires_at` string, date-time, required — Expiration timestamp of the QR code link
  - `whatsapp_disconnected` boolean, required — Indicates whether an existing WhatsApp account was disconnected for this user
  - `previous_qr_revoked` boolean, required — Indicates whether a previously issued QR link for this user was revoked

## Other responses

- `404` — User not found

---

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