POSThttps://api.spotinst.io/setup/accountUserMapping?accountId={ACCOUNT_ID}

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.

Parameter Type Description
ACCOUNT_ID * String

The Spotinst accountId update

Example: act-1234cds
Request - Assign role based users

Headers
Copied!
Downloaded!
{
  "Content-Type": "application/json", 
  "Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
  "mappings": [
    {
      "userEmail": "test@spotinst.com",
      "accountId": "act-123abc",
      "role": "editor"
    },
    {
      "userEmail": "test2@spotinst.com",
      "accountId": "act-123abc",
      "permissionStrategy": "ROLE_BASED",
      "role": "viewer"
    }
  ]
}
Request - Assign policy based users

Headers
Copied!
Downloaded!
{
  "Content-Type": "application/json", 
  "Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
  "mappings": [
    {
      "userId": "u-1234",
      "accountId": "act-123abc",
      "permissionStrategy": "POLICY_BASED",
      "policyIds": [
        "pol-c3e30574",
        "pol-c3e30575"
      ]
    },
    {
      "userEmail": "test2@spotinst.com",
      "accountId": "act-123abc",
      "role": "viewer"
    }
  ]
}
Attribute Type Description
mappings * Array<Object>

Mappings objects include user, accountID and role.

mappings.userEmail * String

One of userEmail / userId is required. Email of the user, used as a unique identifier.

Example: test@spotinst.com
mappings.userId * String

One of userEmail / userId is required. identify user by its user ID

mappings.accountId * String

Account for which to provide the specified user with the specified role.

Example: "act-123abc"
mappings.permissionStrategy String

Set the user permissions type, by role or by access policy. Valid values: "ROLE_BASED", "POLICY_BASED"

Default: ROLE_BASED
mappings.role String

Valid values: "viewer", "editor". Required on permissionStrategy = ROLE_BASED

mappings.policyIds Array<String>

Set list of access policies IDs. Required on permissionStrategy = POLICY_BASED

Response

Headers
Copied!
Downloaded!
{ 
  "Content-Type": "application/json" 
} 
Body
Copied!
Downloaded!
{
  "status": {
    "code": 200,
    "message": "OK"
  }
}