---
title: "companyAssignMainContact"
description: "Set up the company's primary contacts"
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-assign-main-contact'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/mutations/company-assign-main-contact.md'
---
# companyAssignMainContact

Set up the company's primary contacts

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

## Required Permissions

* `write_customers`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `companyContactId`

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

  Company contact id

* `companyId`

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

  Company id

## Returns

* `company`

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

  Company information

* `userErrors`

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

  Error message

## Examples

### Set up the company's main contact

Set company main contact based on contact id

**Request:**

```json
{
  "companyContactId": "gid://shopline/CompanyContact/4217281771",
  "companyId": "gid://shopline/Company/6254924101557166237"
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "companyAssignMainContact": {
        "company": {
          "name": "test2",
          "id": "gid://shopline/Company/6254924101557166237",
          "mainContact": {
            "customer": {
              "updatedAt": "2023-12-21T10:34:54.575Z",
              "createdAt": "2023-11-07T10:13:38.117Z",
              "email": "******@example.com",
              "firstName": "S*****",
              "lastName": "T*****",
              "phone": null,
              "state": "ENABLED",
              "displayName": "S***** T*****",
              "id": "gid://shopline/Customer/4217281771",
              "locale": null
            },
            "id": "gid://shopline/CompanyContact/gid://shopline/CompanyContact/4217281771",
            "updatedAt": "2023-12-21T10:34:54.575Z",
            "createdAt": "2023-11-07T10:13:38.117Z"
          }
        },
        "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).

