---
title: "companyCreate"

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

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

## Type Signature

`CompanyCreatePayload`

## Required Permissions

* `write_customers`

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

## Arguments

* `input`

  [CompanyCreateInput!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/b-2-b/inputs/company-create-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)

  错误信息

## Code Example

```graphql
mutation companyCreate($input: CompanyCreateInput! ) {
	companyCreate(input: $input ) 
		 {
			# CompanyCreatePayload fields
		}
		
	}

```

## Variables

```json
{
  "input": {
    "company": {
      "name": ""
    },
    "companyContact": {
      "email": {},
      "firstName": "",
      "lastName": "",
      "locale": "",
      "phone": ""
    },
    "companyLocation": {
      "billingAddress": "{}",
      "billingSameAsShipping": {},
      "buyerExperienceConfiguration": {
        "editableShippingAddress": false,
        "paymentTermsTemplateId": {}
      },
      "name": "",
      "shippingAddress": {
        "address1": "",
        "address2": "",
        "city": "",
        "countryCode": {},
        "district": "",
        "phone": "",
        "province": "",
        "provinceCode": "",
        "zip": ""
      },
      "taxExemptions": {
        "countryCode": "{}",
        "provinceGCodeList": ""
      },
      "taxRegistrationId": ""
    }
  }
}
```

## Examples

### 创建公司

通过接口创建一个新的公司。

**Request:**

```json
{
  "input": {
    "company": {
      "name": "five company"
    },
    "companyContact": {
      "email": "7678452820@gmail.com",
      "firstName": "Feide55",
      "lastName": "James",
      "phone": "008613980890643",
      "locale": "en"
    },
    "companyLocation": {
      "shippingAddress": {
        "address1": "hot street2",
        "address2": "B1 floor",
        "city": "guangzhou",
        "countryCode": "CN",
        "phone": "008615070041732",
        "zip": "511400"
        },
        "billingAddress": {
        "address1": "hot street2",
        "address2": "B2 floor",
        "city": "guangzhou",
        "countryCode": "CN",
        "phone": "008615070096832",
        "zip": "511400"
        },
      "billingSameAsShipping": false,
      "name": "location 5",
      "taxRegistrationId":"909999999999",
      "taxExemptions": [
            {
            "countryCode":"US",
            "provinceGCodeList":["AL","AK"]
            }
        ]
    }
  }
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "companyCreate": {
        "userErrors": [],
        "company": {
          "name": "five company",
          "id": "gid://shopline/Company/6254924101557166237",
          "mainContact": {
            "createdAt": "2023-12-21T09:23:58.778Z",
            "customer": {
              "createdAt": "2023-12-21T09:23:58.778Z",
              "displayName": "Feide55 James",
              "email": "7678452820@gmail.com",
              "id": "gid://shopline/Customer/4600093492",
              "lastName": "James",
              "phone": "008613980890643",
              "state": "NOT_INVITED",
              "updatedAt": "2023-12-21T09:23:58.778Z",
              "firstName": "Feide55",
              "locale": "en"
            },
            "id": "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)。

