---
title: "company"
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/queries/company'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/queries/company.md'
---
# company

查询公司信息

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

## Arguments

* `id`

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

  公司 ID

## Returns

* `contactCount`

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

  公司联系人数量

* `contactRoles`

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

  公司联系人角色列表

* `contacts`

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

  联系人列表

* `createdAt`

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

  公司创建时间

* `id`

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

  公司id

* `locationCount`

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

  公司下地点数量

* `mainContact`

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

  主要联系人

* `name`

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

  公司名称

* `orderCount`

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

  订单数量

* `totalSpent`

  [MoneyV2](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/objects/money-v2.md)

  公司订单金额

* `updatedAt`

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

  更新时间

## Examples

### 查询公司信息

根据公司id查询公司信息

**Request:**

```json
{
  company(id:"gid://shopline/Company/6254924101557166237") {
    id
    name
    mainContact{
        id
        createdAt
        customer {
            id
            displayName
            email
            firstName
            lastName
            locale
            phone
            createdAt
            updatedAt
            state
        }
      }
    contacts(first:"10") {
      pageInfo{
        startCursor
        endCursor
        hasPreviousPage
        hasNextPage
      }
      nodes{
        id
      }
      edges{
        cursor
        node {
          id
        }
      }
    }
  }
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "company": {
        "mainContact": {
          "createdAt": "2023-11-07T10:13:38.117Z",
          "customer": {
            "createdAt": "2023-11-07T10:13:38.117Z",
            "email": "*********@example.com",
            "firstName": "gqltest04",
            "lastName": "gqltest05",
            "phone": null,
            "state": "ENABLED",
            "updatedAt": "2023-12-21T10:34:54.575Z",
            "displayName": "gqltest04 gqltest05",
            "id": "gid://shopline/Customer/******1771",
            "locale": null
          },
          "id": "gid://shopline/CompanyContact/gid://shopline/CompanyContact/******1771"
        },
        "name": "test2",
        "contacts": {
          "edges": [
            {
              "node": {
                "id": "gid://shopline/CompanyContact/******669"
              },
              "cursor": "-"
            },
            {
              "cursor": "-",
              "node": {
                "id": "gid://shopline/CompanyContact/******148"
              }
            }
          ],
          "nodes": [
            {
              "id": "gid://shopline/CompanyContact/******669"
            },
            {
              "id": "gid://shopline/CompanyContact/******148"
            }
          ],
          "pageInfo": {
            "hasNextPage": false,
            "hasPreviousPage": false,
            "startCursor": "AF52536A1951B28A30AAE8825A2B69B9",
            "endCursor": "E002CE0E792FBA4E98672D39851FDFD6"
          }
        },
        "id": "gid://shopline/Company/************7166237"
      }
    }
  }
}
```

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

