---
title: "Assign Users to Accounts"
method: POST
path: "/setup/accountUserMapping"
tags: ["Accounts"]
---

# Assign Users to Accounts

`POST /setup/accountUserMapping`

Assign users to accounts in bulk. Only accounts under the creator's own organization are allowed. Creator's organization ID is taken from the personal token attached to the API call.

## Parameters

- `#/paths/~1azure~1costs/get/parameters/0` — unresolved $ref

## Request body

- union
  - object
    - `mappings` union[] — Mappings objects include user, accountID and role.
      - union
        - object
          - `userId` string — One of userEmail / userId is required. identify user by its user ID
          - `accountId` string — Account for which to provide the specified user with the specified role.
          - `role` string — Valid values "viewer", "editor". Required on permissionStrategy = ROLE_BASED
        - object
          - `userId` string — One of userEmail / userId is required. identify user by its user ID
          - `accountId` string — Account for which to provide the specified user with the specified role.
          - `permissionStrategy` string — Set the user permissions type, by role or by access policy. Valid values "ROLE_BASED", "POLICY_BASED"
          - `role` string — Valid values "viewer", "editor". Required on permissionStrategy = ROLE_BASED
  - object
    - `mappings` object[] — Mappings objects include user, accountID and role.
      - `userId` string — One of userEmail / userId is required. identify user by its user ID
      - `accountId` string — Account for which to provide the specified user with the specified role.
      - `permissionStrategy` string — Set the user permissions type, by role or by access policy. Valid values "ROLE_BASED", "POLICY_BASED"
      - `policyIds` string[] — Set list of access policies IDs. Required on permissionStrategy = POLICY_BASED
      - `userEmail` string — One of `userEmail` / `userId` is required. Email of the user, used as a unique identifier.
      - `role` string — Valid values `viewer`, `editor`. Required when `permissionStrategy = ROLE_BASED`.

## Response `200`

Assign Users To Accounts Response

- object
  - `request` object — Original request properties
    - `id` string — Unique ID associated with this request
    - `url` string — The URL that was used for the request
    - `method` string — The HTTP **METHOD** used for the request
    - `timestamp` string — When the request was received by Spot
  - `response` object — Response package that includes, status, type and any relevant data.
    - `status` object
      - `code` integer — HTTP status code assigned to this response
      - `message` string — HTTP status message for the respective status code

## Other responses

- `400` — Bad Request

---

[API](https://skmtc.net/spot/apis/spot-by-flexera-api.md) · [All operations](https://skmtc.net/spot/apis/spot-by-flexera-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/spot/spot-by-flexera-api/revisions/72813baf8d47/schema)
