> ## Documentation Index
> Fetch the complete documentation index at: https://docs.widgetic.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Managed Users

> Keep a record of your platform's customers in Widgetic, and file what they make under them

A managed user is a record in your partner registry, one for each of your platform's customers. **It is not a login, and it does not own anything.** Everything you create through the API still belongs to your administering account. What you can do is **file** a composition, a widget or an upload under a managed user when you create it, [move it to another customer](#moving-content-to-another-managed-user) later, and list only what one customer made, so your customers never see each other's work. A workflow that a customer makes in their own [editor session](https://docs.widgetic.com/docs/partners/ui-components/workflows.md), or that you make with your key and the customer's header, is filed under them by itself, and so is an [A/B test or a translation](https://docs.widgetic.com/docs/partners/ab-tests-and-translations.md) that you make with your key and the customer's header. The [integration guide](https://docs.superhuman.com/d/_do4kTYR8IRR/_sukFQiq2) walks through the same steps in order (section 5).

> [!WARNING]
>
> **Only partners can make and work with managed users.** Every call on this page needs an active [partner API key](https://docs.widgetic.com/docs/api-keys.md#what-makes-a-key-a-partner-key). Any other key is refused: the `/managed-users` calls answer `403`, and a call that names a managed user (a widget, composition, canvas or upload call that sends `managedUserId` or `managedUserExternalId`, or a call that sends an `X-Managed-User` header) finds none and answers `404` with `MANAGED_USER_NOT_FOUND`. A partner key whose account is paused, inactive or in payment arrears is refused with `403` on any call that makes something or starts work (see [Account Status](https://docs.widgetic.com/docs/partners/account-status.md)), and so is one whose partnership has ended: during the 60-day wind-down it can read but not make or change anything, and once the partnership is closed it is refused on every call (see [Ending a Partnership](https://docs.widgetic.com/docs/partners/ending-a-partnership.md)). If you are not a partner, there are no managed users for you to make: see [Partners](https://docs.widgetic.com/docs/partners/overview.md).

## Overview

A managed user is:

* A record with a Widgetic `id` (a UUID), your own `externalId` (unique among your managed users, for example your customer number), a free-form `metadata` object and an `isActive` switch.
* Visible only to you. A record that belongs to another partner answers `404`, never `403`, so nothing about other partners can be learned.
* A label you can put on compositions, widgets and uploads, to list them by customer, and change or take off later. See [Filing Content Under a Managed User](#filing-content-under-a-managed-user) and [Moving Content to Another Managed User](#moving-content-to-another-managed-user). A customer's editor session, and your key with the customer's header, put the same label on the [workflows](https://docs.widgetic.com/docs/partners/ui-components/workflows.md) they make, and your key with the customer's header puts it on the [A/B tests and translations](https://docs.widgetic.com/docs/partners/ab-tests-and-translations.md) you make for them.

A managed user is not:

* **A login.** It has no password and no API key, and you cannot sign in as a managed user. The one thing that acts for a managed user is an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md): a short-lived token your server makes, so that the customer's browser can use Widgetic's editors on what is filed under them and nothing else.
* **An owner.** Compositions, widgets, uploads, workflows, A/B tests, translations, credits, storage and the list of allowed websites belong to your partner's workspace, and an unscoped call with your key can read, change and delete all of them. To restrict a composition, workflow, A/B test or translation call made with your server key so it reaches only one customer's, send `X-Managed-User-Id` or `X-Managed-User-External-Id` on the request (see [Scoping a Composition Call to One Customer](#scoping-a-composition-call-to-one-customer), [Scoping a Workflow Call to One Customer](#scoping-a-workflow-call-to-one-customer) and [Scoping an A/B Test or Translation Call to One Customer](#scoping-an-a/b-test-or-translation-call-to-one-customer)), or mint an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md) for the customer's browser, for what a session has a screen for.
* **A billing unit.** There are no per-customer credits, storage or invoices. You are invoiced once, for the contract. What a customer's editor sessions spent on the AI can be read per customer, so you can bill them for it yourself (see [What a Managed User Spent](#what-a-managed-user-spent)). See [Credits & Billing](https://docs.widgetic.com/docs/partners/credits-billing.md).

The examples on this page are for your server. Keep the key in an environment variable, such as `WIDGETIC_PARTNER_KEY`.

## Creating Managed Users

A partner makes a managed user for each of its platform's customers, with an active partner API key: no other key can. Send the `Idempotency-Key` header, and write the body in camelCase, like every answer. The snake\_case spellings (`external_id`, `manager_id`, `is_active`) are read too, but send one spelling of a field, not both:

```bash theme={"theme":"css-variables"}
curl -sS -X POST "https://api.widgetic.com/v1/managed-users" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "externalId": "your-platform-user-123",
    "metadata": { "firstName": "John", "lastName": "Doe", "email": "john@example.com", "role": "editor" }
  }'
```

```json theme={"theme":"css-variables"}
{
  "success": true,
  "data": {
    "id": "3f0c9a52-8e0a-4a52-9d52-5d8a1f1b7c10",
    "managerId": "<the id of your partner's owner account>",
    "externalId": "your-platform-user-123",
    "metadata": { "firstName": "John", "lastName": "Doe", "email": "john@example.com", "role": "editor" },
    "isActive": true,
    "createdAt": "2026-10-02T20:10:00.000Z",
    "updatedAt": "2026-10-02T20:10:00.000Z"
  }
}
```

* `201` on success. `409` if you already have a managed user with that `externalId`. `400` if `externalId` is missing. `403` if the key is not an active partner API key.
* `managerId` is optional and defaults to you. Leave it out: you can only use your own, and another account's id is refused with `403`.
* Use camelCase keys inside `metadata`. The API converts every key in every answer to camelCase, so `company_name` would come back as `companyName`.

> [!NOTE]
>
> `POST /managed-users` and `PUT /managed-users/{id}` need an `Idempotency-Key` header (see [Idempotency](https://docs.widgetic.com/docs/reference/idempotency.md)). In the `@widgetic/api-sdk-ts` package, send it as `idempotencyKey` in the request object of `createManagedUser` and `updateManagedUser`, and send the same one when you retry.

## Listing Managed Users

`GET /managed-users` returns your managed users, newest first. The query takes:

| Parameter | What it does |
| - | - |
| `page`, `size` | The page by number, and how many rows it holds (`size` at most 100) |
| `sort` | A field and a direction, such as `lastActivityAt:desc` (`asc` or `desc`). The default is `createdAt:desc`. The fields are `createdAt`, `updatedAt`, `externalId` and `lastActivityAt`. Any other field is a `400` |
| `search` | Text that the customer's `externalId`, name or email contains, in upper or lower case. Up to 100 characters are used, and an empty value is no search |
| `cursor` | The `nextCursor` that the page before answered. With a cursor, `page` is ignored. A cursor is made for one `sort` and one `search`: send the same ones, or the call is a `400` |
| `include` | `counts` adds what each customer has made to every row of the page: `counts.widgets` (a widget with several versions counts once), `counts.compositions` (a demo does not count) and `counts.workflows` (an archived one does not count) |

The answer has `data`, a list, and `meta` with `page`, `size`, `hasNextPage`, `hasPreviousPage` and `nextCursor` (`null` on the last page), and `total` for a page you read by number. Every row carries `lastActivityAt`: the last time something was filed under that customer (a widget, an embed, a file, a workflow or a canvas). It is written at most once in a few minutes, so read it as "about when", never as the second. Customers that existed before the field did start at the day it was added.

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/managed-users?page=1&size=20"
```

### Finding a Customer by Your Own Id

To find the managed user you registered with your own id, send it as `externalId`. The list then holds that one managed user, or nothing (`meta.total` is `0`) when none of yours has that id:

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/managed-users?externalId=your-platform-user-123"
```

The match is exact, with the same letters in the same case, and it only narrows your own list: it never reaches another partner's managed users. Send `externalId` once and not empty. A repeated or an empty value is `400`, and is never read as a list of everyone. It combines with `page`, `size` and `sort`.

Page by `cursor` when you have many customers and sort them by `lastActivityAt`: the order changes while you read, and a page number would then show one customer twice and another never. The `nextCursor` names a place in the order, so the next page begins exactly after it:

```bash theme={"theme":"css-variables"}
# The 25 customers who were active most recently, with what each made
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/managed-users?sort=lastActivityAt:desc&size=25&include=counts"

# The next 25, with the nextCursor of the answer above
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/managed-users?sort=lastActivityAt:desc&size=25&include=counts&cursor=$NEXT_CURSOR"
```

### Find the work of one customer

A request for help names a person, not a widget: "user 4821 cannot find their quiz". So Widgetic goes from your own id for the customer to what was made for them:

1. **Find the customer** with your own id: `GET /managed-users?search=4821`. The record has Widgetic's `id`, your `externalId` and `lastActivityAt`.
2. **List what they made.** The calls of [Filing Content Under a Managed User](#filing-content-under-a-managed-user) take `managedUserId` or `managedUserExternalId` in the query (`GET /compositions`, `GET /widgets`, `GET /uploads`), and so does the list of [workflows](https://docs.widgetic.com/docs/partners/ui-components/workflows.md#from-your-server) of your workspace (one of the two, never both). The lists of [A/B tests and translations](https://docs.widgetic.com/docs/partners/ab-tests-and-translations.md#name-the-customer) take the customer's header instead.
3. **Read whose a row is.** In your partner workspace, the rows of the lists that are not filed by customer say whose they are, with `managedUserId` and `managedUserExternalId` (both `null` for what belongs to no customer in particular): the widgets, canvases and compositions of a project, the workflows, the A/B tests, the translations and the uploads. A list in any other workspace is sent as it always was, and an id that is not one of your customers has no label, so a list never shows another partner's customer. An A/B test or a translation that you made with a customer's header carries that customer's label itself. One made without it names the customer of the first of its versions that was filed under one, or of its original composition.

The [dashboard](https://docs.widgetic.com/docs/partners/dashboard.md#end-users) is built on these calls: its **End users** page is the search above, and the page of one end user is the lists of step 2.

## Getting a Specific User

`GET /managed-users/{id}` returns one record:

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/managed-users/$MANAGED_USER_ID"
```

To find a customer by your own id, send `externalId` to `GET /managed-users` (see [Finding a Customer by Your Own Id](#finding-a-customer-by-your-own-id)). You do not need it to file or list a customer's work: the calls below accept your own id for the customer (`managedUserExternalId`) and find the managed user for you.

## Filing Content Under a Managed User

When you create a composition, a widget or an upload for one of your customers, name the managed user in the request. Widgetic records it on the new item, and you can list only that customer's items afterwards.

Name the managed user in one of two ways. Send one, never both (`400`):

| Field | What it is |
| - | - |
| `managedUserId` | Widgetic's `id` for the managed user: the UUID the create call gave you |
| `managedUserExternalId` | Your own id for the customer: the `externalId` you registered. Widgetic finds the managed user for you |

Both are optional. A request that names no managed user creates an item that belongs to your account alone, exactly as before. An empty value (`null` or `""`) counts as naming no one.

### Compositions and widgets

Add the field to the body of `POST /compositions` or `POST /widgets`:

```bash theme={"theme":"css-variables"}
curl -sS -X POST "https://api.widgetic.com/v1/compositions" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "name": "your-platform-user-123 / homepage slider",
    "widgetId": "WIDGET_ID",
    "managedUserExternalId": "your-platform-user-123"
  }'
```

The answer carries `managedUserId`, Widgetic's id for the customer, or `null` for an item that belongs to your account alone. To list one customer's items, send the same field in the query of `GET /compositions` or `GET /widgets`:

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/compositions?managedUserExternalId=your-platform-user-123&page=1&size=20"
```

The filter only narrows the list: you still get nothing but your own account's items, and it combines with the paging and the other filters of the call (`widget_id` on compositions, `canvasId` on widgets). Spell the two fields exactly as shown, in camelCase: `managed_user_id` on these calls is refused with a `400`, not ignored, so a mistyped filter can never hand you every customer's items.

### Uploads

`POST /uploads` is a multipart form, so its fields are snake\_case like the rest of that call: send `managed_user_id` or `managed_user_external_id` as a form field next to `file`. `GET /uploads` takes the same two names in its query, and every upload in an answer says `managed_user_id` (`null` when there is none).

```bash theme={"theme":"css-variables"}
curl -sS -X POST "https://api.widgetic.com/v1/uploads" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -F "file=@logo.png" \
  -F "managed_user_external_id=your-platform-user-123"
```

Your uploads with an API key are kept in your own [storage](https://docs.widgetic.com/docs/partners/storage.md), which is required: without it `POST /uploads` is refused with `409` `PARTNER_STORAGE_REQUIRED`. A file that came through a customer's [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md) is filed under that customer by itself.

A file filed under a managed user carries `managedUserId`, is found with the `managed_user_id` filter of `GET /uploads`, and is counted for that customer in the [storage report](https://docs.widgetic.com/docs/partners/storage.md#what-each-customer-keeps).

### What Widgetic checks

* The managed user must be one of yours. One that does not exist, and one that belongs to another partner, get the same answer, `404` with the code `MANAGED_USER_NOT_FOUND`, so nothing about other partners can be learned. Nothing is created or listed.
* A managed user that has been switched off (see [Updating](#updating-managed-users)) cannot be given anything new: `409 MANAGED_USER_INACTIVE`. Its existing items stay and can still be listed.
* A value that is not a UUID (for `managedUserId`), is not text, or is longer than 255 characters (for `managedUserExternalId`) is refused with `400 MANAGED_USER_REFERENCE_INVALID`. So is a field spelled the other way (`managed_user_id` where the call reads `managedUserId`, or `managedUserId` on `/uploads`): it is refused, never ignored, so an item is never filed under no one, and a list is never unfiltered, without you knowing. Sending both fields is `400 MANAGED_USER_REFERENCE_AMBIGUOUS`.
* The label is set from your request only. A `PUT` or `PATCH` that updates the item does not change it. To move an item to another managed user, or to take the label off, use the calls in [Moving Content to Another Managed User](#moving-content-to-another-managed-user).
* A copy of a composition that you duplicate is filed under the same managed user as the original.
* A workflow is filed under a managed user when a customer's [editor session](https://docs.widgetic.com/docs/partners/ui-components/workflows.md#what-belongs-to-whom) makes it, or when you make it with your key and the customer's header (see [Scoping a Workflow Call to One Customer](#scoping-a-workflow-call-to-one-customer)), and in no other way. A workflow you make or copy without the header is your account's own, not the customer's.
* An A/B test or a translation is filed under a managed user when you make it with your key and the customer's header (see [Scoping an A/B Test or Translation Call to One Customer](#scoping-an-a/b-test-or-translation-call-to-one-customer)), and in no other way. One you make without the header is your account's own, not the customer's.

> [!NOTE]
>
> Filing under a managed user does not change who owns the item: the item belongs to your account and the credits it spends are your account's. What filing decides is what an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md) for that managed user can open, and what a server call carrying `X-Managed-User-Id` or `X-Managed-User-External-Id` may reach.

### Scoping a Composition Call to One Customer

When your backend handles a composition request on behalf of one signed-in customer, send `X-Managed-User-Id` (Widgetic's UUID for the managed user) or `X-Managed-User-External-Id` (your own `externalId` for the customer) on the call—one of the two, never both:

```bash theme={"theme":"css-variables"}
curl -sS "https://api.widgetic.com/v1/compositions/$COMPOSITION_ID/content" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "X-Managed-User-External-Id: your-platform-user-123"
```

In `@widgetic/api-sdk-ts`, pass `xManagedUserId` or `xManagedUserExternalId` in the request object (or set the header once on `new Configuration({ accessToken, headers: { 'X-Managed-User-External-Id': 'your-platform-user-123' } })` for a per-request client):

* `GET /compositions` lists only that customer's compositions, and `POST /compositions` files the new composition under that customer.
* Any call to `/compositions/{id}` or its sub-routes (content, design, entries, database records, duplicate, publish, delete) succeeds only if the composition is filed under that customer; another customer's composition or an unfiled composition returns `404`.
* Calling an account-wide route with either header returns `403` `MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`, and an empty or malformed header returns `400` `MANAGED_USER_SCOPE_INVALID`.
* Only a partner's API key can send either header, because only a partner has managed users. A key that is not a partner's finds no managed user and returns `404` `MANAGED_USER_NOT_FOUND`, and a call that is not made with an API key (a signed-in person, say) returns `403` `MANAGED_USER_SCOPE_NOT_ALLOWED`.

### Scoping a Workflow Call to One Customer

The same two headers work on the calls of [Workflows](https://docs.widgetic.com/docs/partners/ui-components/workflows.md#from-your-server), which are made in your partner workspace, named by its id (`{workspaceId}` below: the `workspaceId` that the answer of an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md) carries):

* `GET /workspaces/{workspaceId}/workflows` lists only that customer's workflows, and `POST /workspaces/{workspaceId}/workflows` files the new workflow under that customer, as does duplicating one of theirs.
* Any call on `/workspaces/{workspaceId}/workflows/{workflowId}` or its sub-routes (save, delete, publish, discard, versions, restore, pause, resume, archive, unarchive, counts) succeeds only if the workflow is filed under that customer. Another customer's workflow, one you made without a header, another account's and one that does not exist all return `404` `RESOURCE_WORKFLOW_NOT_FOUND`.
* The id of any other workspace, a team you belong to included, returns `404` `RESOURCE_WORKSPACE_NOT_FOUND`. A word where the id belongs (`me`, say) returns `403` `MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`.
* A customer you switched off keeps its workflows and you can still read and change them, but making or copying one for it returns `409` `MANAGED_USER_INACTIVE`.

### Scoping an A/B Test or Translation Call to One Customer

The same two headers work on the calls of [A/B Tests and Translations](https://docs.widgetic.com/docs/partners/ab-tests-and-translations.md), which are made in your partner workspace, named by its id as in the workflow calls above:

* `GET /workspaces/{workspaceId}/ab-tests` and `GET /organizations/{orgId}/translations` list only that customer's tests and translations, and `POST` on either files the new one under that customer. Every composition a test compares, and the original of a translation, has to be one of that customer's.
* Any call on one test (`/workspaces/{workspaceId}/ab-tests/{testId}` and its sub-routes) or on one translation (`/translations/{id}` and its sub-routes) succeeds only if it is filed under that customer. Another customer's, one you made without a header, another account's and one that does not exist all return `404`, `RESOURCE_AB_TEST_NOT_FOUND` for a test and `RESOURCE_TRANSLATION_NOT_FOUND` for a translation.
* A customer you switched off keeps its tests and translations and you can still read and change them, but making one for it, or adding a language to a translation, returns `409` `MANAGED_USER_INACTIVE`.
* A customer may hold up to 50 A/B tests and 25 translations: another one returns `422` `BUSINESS_OPERATION_INVALID`.

Both are included in your partner agreement and use no credits. Your customers' browsers cannot make them: an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md#what-a-session-never-does) has no screen for them, so your server makes them, and your page shows what your server reads. The lists of your workspace say whose each one is (see [Find the work of one customer](#find-the-work-of-one-customer)).

## Moving Content to Another Managed User

The label on an item is not fixed. After a composition, a widget, an upload or a workflow was made, you can file it under another managed user, or take the label off so it is your own again. These calls are for your server, with your own partner key.

| | File it under a managed user | Take the label off |
| - | - | - |
| A composition | `PUT /compositions/{id}/managed-user` | `DELETE /compositions/{id}/managed-user` |
| A widget | `PUT /widgets/{id}/managed-user` | `DELETE /widgets/{id}/managed-user` |
| An upload | `PUT /uploads/{id}/managed-user` | `DELETE /uploads/{id}/managed-user` |
| A workflow | `PUT /workspaces/{workspaceId}/workflows/{workflowId}/managed-user` | `DELETE` on the same address |

The `PUT` names the managed user as when you [file content](#filing-content-under-a-managed-user): `managedUserId` or `managedUserExternalId`, one of the two. The body is JSON for all four calls, so it is camelCase even for an upload, whose form fields are snake\_case. The `DELETE` takes no body.

```bash theme={"theme":"css-variables"}
curl -sS -X PUT "https://api.widgetic.com/v1/compositions/$COMPOSITION_ID/managed-user" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "managedUserExternalId": "your-platform-user-456" }'
```

Every call answers the item and the managed user it is filed under now. `managedUserId` is `null` once the label is off:

```json theme={"theme":"css-variables"}
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-0000-4000-8000-000000000001",
    "managedUserId": "3f0c9a52-8e0a-4a52-9d52-5d8a1f1b7c10"
  }
}
```

```bash theme={"theme":"css-variables"}
curl -sS -X DELETE "https://api.widgetic.com/v1/compositions/$COMPOSITION_ID/managed-user" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY"
```

### What Widgetic checks on a move

* **The item must be yours.** Only the account that made a composition, a widget or an upload can move it. One that another account made and one that does not exist get the same `404`, so nothing about other accounts can be learned. A workflow is moved in your partner workspace, and the call names the workspace the same way the other [workflow calls](https://docs.widgetic.com/docs/partners/ui-components/workflows.md#from-your-server) do.
* **The call is not made for one customer.** Send it with your own key and without `X-Managed-User-Id` or `X-Managed-User-External-Id`. A call made for one customer, whether by an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md) or by that header, is refused with `403` `MANAGED_USER_SCOPE_MISMATCH`. Only you, with your own key, decide which customer an item belongs to.
* **The managed user is checked as when you file content.** It must be one of yours (`404` `MANAGED_USER_NOT_FOUND`) and switched on (`409` `MANAGED_USER_INACTIVE`), you name it one way (`400` `MANAGED_USER_REFERENCE_AMBIGUOUS` for both) and in camelCase (`400` `MANAGED_USER_REFERENCE_INVALID`). Taking a label off a switched-off customer's item is allowed.
* **A `PUT` has to name a managed user.** One that names none is `400` `MANAGED_USER_REFERENCE_REQUIRED`. It is never read as taking the label off, so a misspelled field cannot quietly unfile your work. Use the `DELETE` for that.
* **Repeating is safe.** Filing an item under the managed user it already has, or taking the label off an item that has none, answers `200` and changes nothing. These calls need no `Idempotency-Key`.
* **A key you limited needs two scopes.** A key made with only part of the access needs both `partner:write` and `content:write` (see [Limit what a key can do](https://docs.widgetic.com/docs/authentication.md#limit-what-a-key-can-do)): the Content preset alone is refused with `403` `API_KEY_SCOPE_MISSING`.

### What moves, and what a move changes

| Item | What moves with it |
| - | - |
| A composition | Only the label. Its widget and its content are not touched. |
| A widget | The widget and the canvas it sits on, which carries the same label. The compositions made from the widget keep the label each one has. |
| An upload | Only the label. The storage report counts the file for the new customer the next time you ask. |
| A workflow | Only the label. Its draft, its versions, its state (a live workflow stays live) and its counts stay as they were. The compositions it chains do not move: file them under the new customer too, because a customer's editor can chain only that customer's own compositions. |

From the moment of the move, a call or a list for the new customer reaches the item, and one for the previous customer finds `404`. That covers an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md), a call with the customer header and a list filtered by `managedUserId` or `managedUserExternalId`. The reports that group by customer ([what each customer keeps](https://docs.widgetic.com/docs/partners/storage.md#what-each-customer-keeps) and the analytics by customer) read the label when you ask, so they follow it too.

A move does not change who owns the item, which is still your account. It does not rewrite what was spent either: the credits an editor session took are noted for the customer who spent them (see [What a Managed User Spent](#what-a-managed-user-spent)).

Taking a workflow's label off makes it one of your own, and it is refused with `422` `BUSINESS_OPERATION_INVALID` and `reason: "too_many_workflows"` when your own workflows already fill your workspace. Archive or delete some, then ask again.

## Thumbnails of Widgets and Compositions

To draw a tile for each of a customer's widgets and compositions, you do not have to make a picture yourself. Every widget has a thumbnail, a picture of what it looks like, and Widgetic makes it for you: a little after the last build of a widget that has none, Widgetic opens the widget in a browser of its own and saves what it shows. A few minutes after the last build, Widgetic also draws a small line drawing of the widget, which stays clear in a small tile. A composition has no thumbnail of its own. It shows the thumbnail of the widget it is built on, so every composition made from one widget shows the same picture and the same drawing.

| You have | Read the thumbnail from |
| - | - |
| A widget | `thumbnailUrl` (the picture) and `thumbnailSvg` (the line drawing) on the widget, in the answer of `GET /widgets` or `POST /widgets/batch` |
| A composition | The same two fields on the widget that the composition's `widgetId` names |

### A customer's widgets

Ask for the widgets with the customer's id, as in [Compositions and widgets](#compositions-and-widgets). Each widget in the answer carries its thumbnail (shortened here):

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/widgets?managedUserExternalId=your-platform-user-123&page=1&size=20"
```

```json theme={"theme":"css-variables"}
{
  "success": true,
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "Quarterly sales chart",
      "thumbnailUrl": "https://cdn.widgetic.com/widgets/3fa85f64-5717-4562-b3fc-2c963f66afa6/thumbnail.png?t=1795536526532",
      "thumbnailSvg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" …>…</svg>"
    }
  ]
}
```

### A customer's compositions

List the customer's compositions. Each one carries the `widgetId` of its widget:

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/compositions?managedUserExternalId=your-platform-user-123&page=1&size=20"
```

Then read the widgets they are built on. Send each `widgetId` once, up to 50 in a call, to `POST /widgets/batch`. The widget of a composition does not have to be filed under the customer, so ask for it by id:

```bash theme={"theme":"css-variables"}
curl -sS -X POST "https://api.widgetic.com/v1/widgets/batch" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "widgetIds": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"] }'
```

The answer has the widgets in `data.widgets`, each with its `id` and `thumbnailUrl`. Match them to the compositions by `widgetId`:

```typescript theme={"theme":"css-variables"}
import { CompositionsApi, WidgetsApi } from '@widgetic/api-sdk-ts';

const compositions = new CompositionsApi(process.env.WIDGETIC_PARTNER_KEY!);
const widgets = new WidgetsApi(process.env.WIDGETIC_PARTNER_KEY!);

// A tile for each composition of one customer: its name and the thumbnail of its widget
async function tilesFor(externalId: string) {
  const { data: list } = await compositions.getAllCompositions({
    managedUserExternalId: externalId,
    page: 1,
    size: 20
  });

  const widgetIds = [...new Set(list.map((composition) => composition.widgetId))];
  const { data: batch } = await widgets.getWidgetsBatch({ getWidgetsBatchRequest: { widgetIds } });

  const thumbnailOf: Record<string, string | null> = {};
  for (const widget of batch.widgets ?? []) {
    if (widget.id) thumbnailOf[widget.id] = widget.thumbnailUrl ?? null;
  }

  return list.map((composition) => ({
    name: composition.name,
    thumbnailUrl: thumbnailOf[composition.widgetId] ?? null
  }));
}
```

### What to know about a thumbnail

* **It can be `null`.** A widget that was never built has no thumbnail, and one that was just built gets it about a minute later. Draw a tile of your own until `thumbnailUrl` is there, and read the widget again later. A widget made from one of your [presets](#preset-widgets) starts with the preset's thumbnail.
* **The address is a public image.** Use it as the `src` of an `img`. It changes when the picture is replaced, for example when the widget is published, so read it again rather than keeping it, and keep the widget's id instead.
* **`thumbnailSvg` is a drawing for small tiles.** It is a small line drawing of the widget, as SVG text on a 32 by 32 canvas, and it has no colour of its own. Widgetic draws it a few minutes after the widget's last build, so it is `null` until then, and a widget need not have one. Where a picture is too small to read, show it as a mask, 32 pixels wide, in the middle of a tile in a colour of your choice, and show `thumbnailUrl` when it is `null`.
* **Only your own widgets are answered.** In `POST /widgets/batch`, an id that is not one of your widgets comes back in `errors`, like an id that does not exist, and the other widgets still come back. See [Batch Fetch Widgets](https://docs.widgetic.com/docs/api/widgets.md#batch-fetch-widgets).

## Preset Widgets

A preset is a widget of your own that you offer your customers as a ready-made starting point: a rating, a quiz, a poll. You choose which of your widgets are presets and give each one a short key that your code uses. Your server reads the list, your page draws its own picker, and your server makes what the customer picked. A workflow of yours can be offered as a starting point too, as long as every widget it chains is one of these presets: see [Starting points](https://docs.widgetic.com/docs/partners/ui-components/workflows.md#starting-points).

> [!NOTE]
>
> These are your presets, kept in your account. They are not the starter widgets that Widgetic puts on every new Widgetic account when it is made. Those belong to Widgetic and are copied at sign-up.

### Register a preset

A preset is one of the widgets your own account made: a widget you built in the dashboard or with the Widget Creator, the ones `GET /widgets` lists. A widget id that is not in that list (another account's, or one that does not exist) is refused with `404` `PRESET_WIDGET_NOT_FOUND`. Send `PUT /partners/{partnerId}/presets/{key}`:

```bash theme={"theme":"css-variables"}
curl -sS -X PUT "https://api.widgetic.com/v1/partners/$WIDGETIC_PARTNER_ID/presets/rating" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "widgetId": "WIDGET_ID",
    "title": "Star rating",
    "description": "Visitors rate with one to five stars.",
    "position": 1
  }'
```

| Field | What it is |
| - | - |
| `key` (in the address) | The name your code uses: 1 to 64 lowercase letters, digits, hyphens and underscores, starting with a letter or a digit, such as `rating` or `quiz-3` |
| `widgetId` | **Required.** One of your own widgets |
| `title` | What your picker shows, up to 120 characters. Without one, show the widget's own name (`widgetName` in the list) |
| `description` | Up to 500 characters |
| `position` | 0 to 10000, and 0 when left out. The list comes back with the smallest first |

Sending the same key again replaces the preset, so the call is safe to repeat and needs no `Idempotency-Key`. It replaces the whole preset: a `title`, `description` or `position` you leave out goes back to its default. A widget can be a preset under one key only, and an account can have 100 presets.

`DELETE /partners/{partnerId}/presets/{key}` takes a widget off the list and answers `{ "removed": true }`, or `false` (not an error) when there was no such preset. It leaves the widget, its copies and its compositions alone. Deleting the widget removes its preset. A workflow you offer as a [starting point](https://docs.widgetic.com/docs/partners/ui-components/workflows.md#starting-points) can chain only widgets that are presets, so taking a widget off the list makes the starting points that chain it unavailable until you offer the widget again (`unavailableReason` is `widget_not_preset`).

### List the presets

`GET /partners/{partnerId}/presets` returns your presets, ordered by `position` and then by `key`. It is the same list for every customer, so call it from your server whenever your picker opens.

```json theme={"theme":"css-variables"}
{
  "success": true,
  "data": [
    {
      "key": "rating",
      "widgetId": "4b2f9c1e-6d3a-4f08-9a57-1c2e8b7d5a30",
      "title": "Star rating",
      "description": "Visitors rate with one to five stars.",
      "position": 1,
      "widgetName": "Rating",
      "thumbnailUrl": "https://cdn.widgetic.com/widgets/4b2f9c1e-6d3a-4f08-9a57-1c2e8b7d5a30/thumbnail.png?t=1795536526532",
      "createdAt": "2026-10-05T12:00:00.000Z",
      "updatedAt": "2026-10-05T12:00:00.000Z"
    }
  ]
}
```

### Make what the customer picked

There are two ways. The first needs no copy.

* **A composition**, for the Composition Editor. Create it on the preset's widget with `POST /compositions`, naming the customer as in [Filing Content Under a Managed User](#filing-content-under-a-managed-user). The widget stays yours and the composition is the customer's own content. The widget needs a published version before the composition can be shown on a page.
* **A copy to build on**, for the Widget Creator. `POST /managed-users/{id}/presets/{key}/copy` gives the customer a widget of their own on a new canvas, filed under them. It needs an `Idempotency-Key`. The optional `name` (up to 120 characters) names the copy; without it the copy takes the preset's title, then the widget's own name. Make it from your server when a customer picks a preset on your own page, and give the copy's `canvasId` and `widgetId` to the Widget Creator. The creator itself never lists your presets: with no `canvasId` it opens on the customer's latest canvas, or on a blank one (see [Where the creator starts](https://docs.widgetic.com/docs/partners/ui-components/widget-creator.md#where-the-creator-starts)).

```bash theme={"theme":"css-variables"}
curl -sS -X POST "https://api.widgetic.com/v1/managed-users/$MANAGED_USER_ID/presets/rating/copy" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "name": "Our rating" }'
```

```json theme={"theme":"css-variables"}
{
  "success": true,
  "data": {
    "presetKey": "rating",
    "managedUserId": "3f0c9a52-8e0a-4a52-9d52-5d8a1f1b7c10",
    "canvasId": "a1d6e3f2-0b9c-4c7e-8f41-2d5b6c7e8f90",
    "widgetId": "c7e9d1b4-3a2f-4e6d-b8c5-9f0a1b2c3d4e",
    "widgetName": "Our rating",
    "warnings": []
  }
}
```

Mount the [Widget Creator](https://docs.widgetic.com/docs/partners/ui-components/widget-creator.md) on that `canvasId` and `widgetId`, with the customer's [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md).

What a copy is:

* It is a draft widget in your account, filed under that customer, and no other customer's editor can reach it.
* It carries the preset's code, its Content and Design schemas, its content and its thumbnail, and it starts from a fork of the code, so the customer's chat edits begin where yours left off. It does not carry the preset's database, its compositions or its chat history. It is private and a draft, and it is not a preset itself.
* There is no limit on copies. A customer can have as many copies of a preset as you give them, and each one is its own draft. Call again with a new `Idempotency-Key` for another copy; the same key gives you the first answer back.
* A change you make to a preset's widget later reaches the compositions you make from it and the copies you make afterwards. Copies made earlier are not touched.
* Read `warnings`. When the preset's code could not be forked, the copy opens as a preview and its code history starts empty, and `warnings` says so.

An [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md) cannot call any of these routes. They are for your server, so what a customer is offered is decided there.

| Status | Code | Description |
| - | - | - |
| 400 | | A key, title, description or position breaks a limit above, or the body holds a field the call does not know |
| 403 | | The partner id is not one you administer |
| 404 | `PRESET_WIDGET_NOT_FOUND` | The widget does not exist or is not one of yours (the two look the same) |
| 404 | `PRESET_NOT_FOUND` | A copy names a key that no preset has |
| 404 | `MANAGED_USER_NOT_FOUND` | A copy names a managed user that is not one of yours |
| 409 | `PRESET_WIDGET_ALREADY_USED` | The widget is already a preset under another key (`error.details.key` says which) |
| 409 | `PRESET_LIMIT_REACHED` | Your account has 100 presets |
| 409 | `MANAGED_USER_INACTIVE` | A copy is asked for a customer who is switched off |
| 503 | `PRESET_COPY_FAILED` | The copy could not be made and nothing was left behind. Send the same request again with the same `Idempotency-Key` |

## Updating Managed Users

`PUT /managed-users/{id}` changes the `externalId`, the `metadata` and/or `isActive`. It needs an `Idempotency-Key`. The `metadata` is **replaced as a whole**, so send all of it:

```bash theme={"theme":"css-variables"}
curl -sS -X PUT "https://api.widgetic.com/v1/managed-users/$MANAGED_USER_ID" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "metadata": { "firstName": "John", "lastName": "Smith", "role": "admin" } }'
```

To stop a customer from creating anything new, for example when their plan on your platform ends, switch their managed user off. Send a real `true` or `false`, not text:

```bash theme={"theme":"css-variables"}
curl -sS -X PUT "https://api.widgetic.com/v1/managed-users/$MANAGED_USER_ID" \
  -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "isActive": false }'
```

What the managed user already has stays, and can still be listed. Switching a managed user off also ends all of its editor sessions, and they do not come back when you switch it on again: make new ones. Send `"isActive": true` to switch it back on.

## Deleting Managed Users

`DELETE /managed-users/{id}` removes the record and answers `200` with `{"message": "...", "id": "..."}`. It does not delete anything else, but it does remove the label: the compositions, widgets, uploads and workflows that were filed under the managed user stay in your account, with `managedUserId` back to `null`. Its editor sessions end. So when a customer leaves, list their items first (`GET /compositions?managedUserId=...`), delete what you want gone (`DELETE /compositions/{id}`), and only then delete the managed user.

A customer's workflows stay too, and **keep running on every page that shows them**. Pause or delete the ones that should stop before you delete the managed user: a session made for that customer, or your key with their header, lists theirs, and your own sign-in lists every customer's (see [Workflows](https://docs.widgetic.com/docs/partners/ui-components/workflows.md#what-belongs-to-whom)).

The same goes for a customer's A/B tests and translations: they stay in your account, and a test that is running or a translation that is active keeps being shown. Pause or delete them first, with your key and the customer's header (see [A/B Tests and Translations](https://docs.widgetic.com/docs/partners/ab-tests-and-translations.md#what-belongs-to-whom)).

## Managed User Entitlements

Entitlements are read only: Widgetic sets them and you cannot change them through the API.

* `GET /entitlements/managed-users/{managedUserId}` lists the entitlements of one managed user. The answer has `data.managedUserId` and `data.entitlements`.
* `GET /entitlements/partners/{partnerId}` lists what your partner record is entitled to.
* Both accept `feature`, `source` and `includeExpired` as filters.
* Each entitlement has a `feature`, a `value`, a `source` (`subscription`, `contract`, `manual`, `marketplace` or `addon`) and `expiresAt`.

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/entitlements/managed-users/$MANAGED_USER_ID"
```

## What a Managed User Spent

Your account pays for the AI, so your credit ledger does not say which customer used what. For what a customer does in an [editor session](https://docs.widgetic.com/docs/partners/editor-sessions.md), Widgetic keeps a note of each call that took credits, and adds the notes up for one customer over a period:

```bash theme={"theme":"css-variables"}
curl -sS -H "Authorization: Bearer $WIDGETIC_PARTNER_KEY" \
  "https://api.widgetic.com/v1/managed-users/$MANAGED_USER_ID/usage?startDate=2026-10-01&endDate=2026-11-01"
```

The answer has the credits in total and for each operation, with the generations that were refunded counted apart. It covers what editor sessions spent, from the day Widgetic first recorded it; what you spend with your own key is not in it. The period, the answer and the limit you can put on a single session are on [Editor Sessions](https://docs.widgetic.com/docs/partners/editor-sessions.md#credits-and-limits).

## What a Managed User Keeps

The files a customer keeps are counted for them too. `GET /partners/{partnerId}/storage/usage` says how many files and how many bytes each of your managed users has, split into what is in your own [storage](https://docs.widgetic.com/docs/partners/storage.md) and what is with Widgetic, with the heaviest first. A file counts for a customer when it was filed under them (an upload that names the managed user, or one that came through their editor session). The answer is counted when you ask, so it is always current. See [What Each Customer Keeps](https://docs.widgetic.com/docs/partners/storage.md#what-each-customer-keeps) for the answer and an example.

## Keep Your Own Mapping

Widgetic records which managed user a composition, a widget or an upload was filed under, but it does not know your customers' permissions: which of them may open which composition is decided by your platform. Keep a small mapping of your own, and use the filter for listing:

* A customers table: your customer id, and the Widgetic managed-user `id`.
* A widgets table (optional): your customer id, the Widgetic composition `id`, and the Widgetic `widgetId` it is built on. Handy when you show a customer a page of their compositions without calling Widgetic, and when you decide who may open one.
* Put the customer in the composition name as well, for example `your-platform-user-123 / homepage slider`, so a person looking in the Widgetic dashboard can tell whose it is.

```sql theme={"theme":"css-variables"}
-- In your database
CREATE TABLE widgetic_user_mapping (
  platform_user_id VARCHAR PRIMARY KEY,
  widgetic_managed_user_id UUID,
  created_at TIMESTAMP
);
```

## User Metadata Schema

The `metadata` field is flexible, but we recommend including:

```typescript theme={"theme":"css-variables"}
interface ManagedUserMetadata {
  // Identity
  firstName?: string;
  lastName?: string;
  email?: string;
  avatarUrl?: string;

  // Permissions you track on your side
  role?: 'viewer' | 'editor' | 'admin';
  permissions?: string[];

  // Your custom fields
  teamId?: string;
  department?: string;
  plan?: string;

  // Any other JSON-serializable data. Use camelCase keys
  [key: string]: any;
}
```

Widgetic stores this object and gives it back. It does not act on it: a `role` here does not change what anyone can do in Widgetic.

## Best Practices

> [accordion] Use Meaningful External IDs
>
> Use your platform's user ID as the `externalId` for easy correlation:
>
> ```typescript theme={"theme":"css-variables"}
> // The id of the customer in your own system
> const yourUserId = 'user-123';
>
> const externalId = `myplatform_user_${yourUserId}`;
> ```

> [accordion] Handle User Deletion
>
> When a user leaves your platform, list their compositions with `managedUserId`, delete what you want gone, then delete their managed user. Deleting a managed user does not delete anything else, but the items that were filed under it lose the label and become your account's own. That includes the customer's workflows, A/B tests and translations, which keep running until you pause or delete them.

> [accordion] Always Send the Filter From Your Server
>
> List a customer's items with `managedUserId` or `managedUserExternalId` on every call, from your own backend. A call without the filter lists everything on your account, for every customer.

## Error Handling

Common errors when working with managed users. Branch on `error.code` in the answer (see [Errors](https://docs.widgetic.com/api-reference/errors.md)):

| Status | Code | Description |
| - | - | - |
| 400 | | `externalId` is missing, or the `Idempotency-Key` header is missing, or `isActive` is not `true` or `false` |
| 400 | | A query of `GET /managed-users` that the list cannot use: a `sort` field that is not one of the four, or a `cursor` that this list did not make or that was made for another `sort` or `search` (see [Listing Managed Users](#listing-managed-users)) |
| 400 | `MANAGED_USER_REFERENCE_INVALID` | `managedUserId` is not a UUID, a field is not text, `managedUserExternalId` is longer than 255 characters, or a field is spelled the other way |
| 400 | `MANAGED_USER_REFERENCE_AMBIGUOUS` | The request names the managed user twice, with both `managedUserId` and `managedUserExternalId` |
| 400 | `MANAGED_USER_REFERENCE_REQUIRED` | A `PUT` that moves an item names no managed user (use the `DELETE` to take the label off) |
| 403 | | The key is not a partner API key (only partners can make and work with managed users), or `managerId` names another account |
| 403 | `PARTNER_INACTIVE`, `PARTNER_SUSPENDED` or `PARTNER_PAYMENT_ARREARS` | The partner account is not in force, and the call makes something or starts work (see [Account Status](https://docs.widgetic.com/docs/partners/account-status.md)) |
| 403 | `MANAGED_USER_SCOPE_MISMATCH` | A call that moves an item, or takes its label off, was made for one customer: with an editor session or the customer header |
| 403 | `PARTNER_WINDING_DOWN` or `PARTNER_CLOSED` | The partnership has ended: during the wind-down a call that makes or changes something is refused (listing and reading customers still works), and once it is closed every call is (see [Ending a Partnership](https://docs.widgetic.com/docs/partners/ending-a-partnership.md)) |
| 404 | | The managed user does not exist, or belongs to another partner |
| 404 | `MANAGED_USER_NOT_FOUND` | A composition, widget or upload call names a managed user that is not one of yours (the same answer for one that belongs to another partner, and for any key that is not a partner's, which has none) |
| 404 | `RESOURCE_COMPOSITION_NOT_FOUND`, `RESOURCE_WIDGET_NOT_FOUND`, `UPLOAD_NOT_FOUND` or `RESOURCE_WORKFLOW_NOT_FOUND` | A call that moves an item names one that is not yours, or does not exist |
| 409 | | A managed user with this `externalId` already exists |
| 409 | `MANAGED_USER_INACTIVE` | A create call names a managed user that is switched off, or an editor session is asked for one |
| 422 | `BUSINESS_OPERATION_INVALID` | Moving a workflow, or taking its label off, would put it over what the managed user or your own workspace can hold (`details.reason` is `too_many_workflows`) |

## Next Steps

> [card] [Editor Sessions](https://docs.widgetic.com/docs/partners/editor-sessions.md)
>
> Let a customer use Widgetic's editors in your page

> [card] [Credits & Billing](https://docs.widgetic.com/docs/partners/credits-billing.md)
>
> How you pay and how credits work

> [card] [API Reference](https://docs.widgetic.com/api-reference/introduction.md)
>
> Find entitlement endpoints and access levels


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.