---
title: "companyContactAssignRole"
description: "Assign a role to a B2B customer for a specified company location."
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/mutations/company-contact-assign-role'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/mutations/company-contact-assign-role.md'
---
# companyContactAssignRole

Assign a role to a B2B customer for a specified company location. 

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Arguments

* `input`

  [CompanyContactAssignRoleInput!](https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/inputs/company-contact-assign-role-input.md)

  input param

## Returns

* `userErrors`

  [[BusinessCustomerUserError!]!](https://developer.shopline.com/docs/admin-graph-ql-api/customers/objects/business-customer-user-error.md)

  Error message

## Examples

### Assigns roles to company contacts for a company location.

Assigns roles to company contacts for a company location.

**Request:**

```json
mutation MyMutation {
  companyContactAssignRole(input: {
    companyContactId: "gid://shopline/CompanyContact/******789",
    companyLocationId: "gid://shopline/CompanyLocation/************9046926",
    companyContactRoleId: "gid://shopline/CompanyContactRole/***********20701"
  }) {
    userErrors {
      field
      message
    }
  }
}
```

**Response:**

```json
{
  "data": {
    "data": {
      "companyContactAssignRole": {
        "userErrors": []
      }
    }
  }
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

