User Profiles Mutations

CreateUserProfile

Create a user profile

Parameters

input - UserProfileInput
Data of the user profile

Example

mutation CreateUserProfile($input: UserProfileInput!) {
  CreateUserProfile(input: $input) {
    id
    user_id
    company_id
    active
    label
    prevent_negative_inventory
    selling_price_level_id
    tax_type
    location_id
    account_representative_id
  }
}
{
  "input": {
    "user_id": 42,
    "company_id": 2001,
    "active": true,
    "label": "Admin - Company A",
    "prevent_negative_inventory": true,
    "tax_type": "VAT",
    "permissions": ["manage_orders", "view_reports"]
  }
}

Returned data

{
  "data": {
    "CreateUserProfile": {
      "id": 100010,
      "user_id": 42,
      "company_id": 2001,
      "active": true,
      "label": "Admin - Company A",
      "prevent_negative_inventory": true,
      "tax_type": "VAT"
    }
  }
}

CreateUserProfileFromPartner

Create a user profile from a partner context

Parameters

input - UserProfileInput
Data of the user profile

Example

mutation CreateUserProfileFromPartner($input: UserProfileInput!) {
  CreateUserProfileFromPartner(input: $input) {
    id
    user_id
    company_id
    active
    label
  }
}
{
  "input": {
    "user_id": 42,
    "company_id": 2001,
    "active": true,
    "label": "Partner - Company A"
  }
}

Returned data

{
  "data": {
    "CreateUserProfileFromPartner": {
      "id": 100011,
      "user_id": 42,
      "company_id": 2001,
      "active": true,
      "label": "Partner - Company A"
    }
  }
}

UpdateUserProfile

Update a user profile

Parameters

id - ID
Id of the user profile
input - UserProfileInput
Data of the user profile

Example

mutation UpdateUserProfile($id: ID!, $input: UserProfileInput!) {
  UpdateUserProfile(id: $id, input: $input) {
    id
    user_id
    company_id
    active
    label
    prevent_negative_inventory
    selling_price_level_id
    tax_type
    location_id
    account_representative_id
  }
}
{
  "id": 100010,
  "input": {
    "active": false,
    "label": "Admin - Company A (disabled)",
    "prevent_negative_inventory": false,
    "tax_type": "NONE"
  }
}

Returned data

{
  "data": {
    "UpdateUserProfile": {
      "id": 100010,
      "user_id": 42,
      "company_id": 2001,
      "active": false,
      "label": "Admin - Company A (disabled)",
      "prevent_negative_inventory": false,
      "tax_type": "NONE"
    }
  }
}

DisableUserProfile

Disable a user profile

Parameters

id - ID
Id of the user profile

Example

mutation DisableUserProfile($id: ID!) {
  DisableUserProfile(id: $id) {
    id
    active
  }
}
{
  "id": 100010
}

Returned data

{
  "data": {
    "DisableUserProfile": {
      "id": 100010,
      "active": false
    }
  }
}

EnableUserProfile

Enable a user profile

Parameters

id - ID
Id of the user profile

Example

mutation EnableUserProfile($id: ID!) {
  EnableUserProfile(id: $id) {
    id
    active
  }
}
{
  "id": 100010
}

Returned data

{
  "data": {
    "EnableUserProfile": {
      "id": 100010,
      "active": true
    }
  }
}

GenerateApiToken

Generate an API token for the current user profile

Parameters

None

Example

mutation {
  GenerateApiToken
}

Returned data

{
  "data": {
    "GenerateApiToken": "token-value-example"
  }
}

DeleteApiToken

Delete the current user profile API token

Parameters

None

Example

mutation {
  DeleteApiToken
}

Returned data

{
  "data": {
    "DeleteApiToken": true
  }
}

SwitchUserProfile

Switch current context to another user profile

Parameters

nextId - ID
Target user profile identifier
token - String
Security token

Example

mutation SwitchUserProfile($nextId: ID!, $token: String!) {
  SwitchUserProfile(nextId: $nextId, token: $token) {
    id
    user_id
    company_id
    active
    label
  }
}
{
  "nextId": 100020,
  "token": "SECURE-TOKEN-123"
}

Returned data

{
  "data": {
    "SwitchUserProfile": {
      "id": 100020,
      "user_id": 43,
      "company_id": 2002,
      "active": true,
      "label": "User - Company B"
    }
  }
}

ImpersonateUserProfile

Start impersonating a user profile

Parameters

id - ID
Id of the user profile to impersonate

Example

mutation ImpersonateUserProfile($id: ID!) {
  ImpersonateUserProfile(id: $id)
}
{
  "id": 100020
}

Returned data

{
  "data": {
    "ImpersonateUserProfile": true
  }
}

ImpersonateB2bStoreUserProfile

Start impersonating a B2B store user profile

Parameters

id - ID
Id of the user profile to impersonate

Example

mutation ImpersonateB2bStoreUserProfile($id: ID!) {
  ImpersonateB2bStoreUserProfile(id: $id)
}
{
  "id": 100020
}

Returned data

{
  "data": {
    "ImpersonateB2bStoreUserProfile": "session-token-example"
  }
}

StopImpersonateUserProfile

Stop impersonation and return to the original profile

Parameters

None

Example

mutation {
  StopImpersonateUserProfile
}

Returned data

{
  "data": {
    "StopImpersonateUserProfile": true
  }
}

UserProfileInput data type

id - Int
Identifier (optional)
user_id - Int
Associated user identifier
company_id - Int
Associated company identifier
active - Boolean
If true, the user profile is active
label - String
Display label
permissions - [String]
Permissions granted to the profile
user - Object
User payload (UserInput)

Extended fields

prevent_negative_inventory - Boolean
Prevent negative inventory operations
tax_type - TaxType
Tax type (enum TaxType)
tax_codes - [TaxCodeInput]
List of tax codes linked to this profile (see Tax Codes: Mutations)
selling_price_level - Object
Selling price level payload (see Price Levels: Mutations)
location - Object
Location payload (see Locations: Mutations)
account_representative - Object
Account representative payload (see Account Representatives: Mutations)

TaxType

ValueDescription
exclusiveTax calculated on top of the net price.
inclusiveTax included in the displayed price.