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

# Provision an embed user

**🔒 Admin only.** Requires administrator privileges — the authenticated principal (API key, embed JWT, or any bearer token) must belong to a user with the admin role.

Creates or updates one embed user from the identity your own system knows. An embed user is otherwise created the first time they generate a session, so this is how an integration puts its own directory into Cube up front: a user provisioned here is immediately addressable — listable, searchable, assignable to groups, and selectable wherever the product offers a choice of users — before they have ever opened the embed.

Idempotent, and the body is the desired state: provisioning an `externalId` that already exists updates it rather than failing. `email`, `userProfile.displayName` and `userProfile.picture` are overwritten when supplied and preserved when omitted; each group lane is REPLACED when supplied, preserved when omitted, and cleared by `[]`. The embed tenant itself is created on demand, so it need not exist yet.

Everything set here is exactly what `generate-session` would have set, and a later session for the same `externalId` re-applies whatever it carries — so provisioning changes when a user exists, never what their session grants them.


## OpenAPI

````yaml /api-reference/api.yaml post /api/v1/embed-tenants/{embedTenantName}/user
openapi: 3.1.0
info:
  title: Cube Platform API
  version: 1.0.0
  description: >-
    Programmatically manage Cube: deployments and everything scoped to them

    (environments, folders, reports, workbooks, notifications, workspace, and
    agents),

    plus account-level users, groups, policies, embedding, and AI settings.
    Data-model

    authoring, dev mode, branches, and uploads live under /build/api/v1 — same
    host and

    token, routed to the build pods.
servers:
  - url: https://{tenant}.cubecloud.dev
    description: Your tenant host. Replace the whole host if you use a custom domain.
    variables:
      tenant:
        default: your-tenant
        description: Your Cube tenant subdomain
security:
  - bearerAuth: []
tags:
  - name: Deployments
  - name: Deployment Creation
  - name: Environments
  - name: Env Variables
  - name: Regions
  - name: Data Model
  - name: Data Model Uploads
  - name: GitHub
  - name: GitHub Connection
  - name: dbt Sync
  - name: Folders
  - name: Reports
  - name: Workbooks
  - name: Notifications
  - name: Workspace
  - name: Users Admin
  - name: User Attributes
  - name: User Attribute Values
  - name: Tenant Settings
  - name: OAuth Integrations
  - name: User OAuth Tokens
  - name: OIDC Token Configs
  - name: App Theme
  - name: Embed
  - name: Embed Tenants
  - name: Dashboard Embed Access
  - name: Usage Analytics
  - name: OpenAPI Spec
paths:
  /api/v1/embed-tenants/{embedTenantName}/user:
    post:
      tags:
        - Embed Tenants
      summary: Provision an embed user
      operationId: provisionEmbedUser
      parameters:
        - in: path
          name: embedTenantName
          required: true
          schema:
            type: string
          description: >-
            Name of the embed tenant (the `embedTenantName` used to generate
            embed sessions).
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProvisionEmbedUserInput'
        description: ProvisionEmbedUserInput
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmbedUser'
          description: ''
components:
  schemas:
    ProvisionEmbedUserInput:
      properties:
        email:
          oneOf:
            - format: email
              type: string
              description: >-
                Email address, shown wherever the user is listed and searchable
                through `GET /embed-tenants/{embedTenantName}/users`. Must be a
                valid address, and is stored lowercased. Omit it and Cube
                derives a synthetic `{externalId}@cubecloud.dev` placeholder
                instead, which is what makes a user hard to recognise in a list.
                Supplying it again later updates the stored address.
            - type: 'null'
        externalId:
          description: >-
            The id your own system knows this user by — the same `externalId`
            you will pass to `generate-session`. Trimmed and lowercased before
            it is stored, so casing never produces a second user.
          minLength: 1
          type: string
        groups:
          oneOf:
            - items:
                type: string
              type: array
              description: >-
                Global, account-wide groups (the `groups` field of
                `generate-session`) that gate data-model access. They must
                already exist. Supplying the field REPLACES the user’s global
                groups; omit it to leave them untouched, pass `[]` to clear
                them.
            - type: 'null'
        tenantGroups:
          oneOf:
            - items:
                type: string
              type: array
              description: >-
                Groups belonging to this embed tenant (the `tenantGroups` field
                of `generate-session`), which scope content sharing and
                organization within the tenant. Create them first via `POST
                /embed-tenants/{embedTenantName}/groups`. Supplying the field
                REPLACES the user’s tenant groups; omit it to leave them
                untouched, pass `[]` to clear them.
            - type: 'null'
        userProfile:
          oneOf:
            - $ref: '#/components/schemas/EmbedUserProfile'
              type: object
              description: >-
                Display name and avatar. `displayName` is the name shown
                wherever the user appears, including on content they author.
                Omitted fields keep their current value.
            - type: 'null'
      required:
        - externalId
      type: object
    EmbedUser:
      properties:
        createdAt:
          oneOf:
            - oneOf:
                - format: date
                  type: string
                - format: date-time
                  type: string
            - type: 'null'
        email:
          oneOf:
            - type: string
            - type: 'null'
        externalId:
          oneOf:
            - type: string
            - type: 'null'
        firstName:
          oneOf:
            - type: string
            - type: 'null'
        id:
          type: integer
        lastLogin:
          oneOf:
            - oneOf:
                - format: date
                  type: string
                - format: date-time
                  type: string
            - type: 'null'
        username:
          type: string
      required:
        - id
        - username
      type: object
    EmbedUserProfile:
      properties:
        displayName:
          oneOf:
            - type: string
            - type: 'null'
        picture:
          oneOf:
            - format: url
              type: string
            - type: 'null'
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Token authentication. Send `Authorization: Bearer <YOUR_TOKEN>`.'

````