---
title: "companyUpdate"
description: "查询公司信息"
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-update'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/mutations/company-update.md'
---
# companyUpdate

查询公司信息

- **Required Scopes:** `write_customers`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Required Permissions

* `write_customers`

接口访问需要令牌，具体如何获取令牌参考：[身份认证](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md)。

## Arguments

* `companyId`

  [ID!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/id.md)

  公司id

* `input`

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

  更新公司输入信息

## Returns

* `company`

  [Company](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/objects/company.md)

  公司信息

* `userErrors`

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

  错误信息

## Examples

### 更新公司信息

更新公司信息需要带入公司的gid

**Request:**

```json
{
  "companyId": "gid://shopline/Company/6254924101557166237",
  "input": {
    "name": "test2"
  }
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "companyUpdate": {
        "userErrors": [],
        "company": {
          "name": "test2",
          "id": "gid://shopline/Company/gid://shopline/Company/6254924101557166237",
          "mainContact": {
            "createdAt": "2023-12-21T09:23:57.777Z",
            "customer": {
              "phone": "0086139****0643",
              "updatedAt": "2023-12-21T09:23:58.372Z",
              "createdAt": "2023-12-21T09:23:57.777Z",
              "displayName": "L*** S****",
              "lastName": "S****",
              "locale": "en",
              "state": "NOT_INVITED",
              "email": "*********@example.com",
              "firstName": "L***",
              "id": "gid://shopline/Customer/gid://shopline/Customer/4600093492"
            },
            "id": "gid://shopline/CompanyContact/gid://shopline/CompanyContact/gid://shopline/CompanyContact/gid://shopline/CompanyContact/4600093492"
          }
        }
      }
    }
  }
}
```

## 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)。

