---
title: "companyContactAssignRole"
description: "为指定公司地点的一个B2B客户分配角色"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/mutations/company-contact-assign-role'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/mutations/company-contact-assign-role.md'
---
# companyContactAssignRole

为指定公司地点的一个B2B客户分配角色

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

## Arguments

* `input`

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

  请求入参

## Returns

* `userErrors`

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

  错误信息

## Examples

### 向一个公司地点为多个客户分配角色

向一个公司地点为多个客户分配角色

**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

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes)。

