---
title: "companyLocationAssignAddress"
description: "Create location address information"
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-location-assign-address'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/mutations/company-location-assign-address.md'
---
# companyLocationAssignAddress

Create location address information

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

## Type Signature

`CompanyLocationAssignAddressPayload`

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

* `locationId`

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

  The ID of the company location.

* `address`

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

  The input fields to use to update the address.

* `addressTypes`

  [[CompanyAddressType]!](https://developer.shopline.com/docs/admin-graph-ql-api/b-2-b/enums/company-address-type.md)

  The address types on the location to update.

## Returns

* `addresses`

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

  Address information

* `userErrors`

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

  Error message

## Code Example

```graphql
mutation companyLocationAssignAddress($locationId: ID! $address: CompanyAddressInput! $addressTypes: [CompanyAddressType]! ) {
	companyLocationAssignAddress(locationId: $locationId, address: $address, addressTypes: $addressTypes ) 
		 {
			# CompanyLocationAssignAddressPayload fields
		}
		
	}

```

## Variables

```json
{
  "address": {
    "address1": "",
    "address2": {},
    "city": "",
    "countryCode": {},
    "district": "",
    "phone": "",
    "province": "",
    "provinceCode": "",
    "zip": ""
  },
  "addressTypes": {},
  "locationId": {}
}
```

## Examples

### Save company address information

Create company address information based on country code, city name, detailed address, etc

**Request:**

```json
{
  "address": {
    "address1": "长隆",
    "address2": "奥园广场",
    "city": "广州市",
    "countryCode": "CN",
    "phone": "008613878604673",
    "zip": "514000"
  },
  "addressTypes": [
    "BILLING","SHIPPING"
  ],
  "locationId": "gid://shopline/CompanyLocation/6245049488106857931"
}

```

**Response:**

```json
{
  "data": {
    "data": {
      "companyLocationAssignAddress": {
        "addresses": [
          {
            "province": null,
            "address1": "长隆",
            "city": "广州市",
            "createdAt": "2023-12-14T13:54:25.605Z",
            "updatedAt": "2023-12-21T11:23:01.228Z",
            "zip": "514000",
            "address2": "奥园广场",
            "country": null,
            "countryCode": "CN",
            "id": "gid://shopline/CompanyAddress/6245049491713959373"
          },
          {
            "address2": "奥园广场",
            "city": "广州市",
            "country": null,
            "countryCode": "CN",
            "zip": "514000",
            "address1": "长隆",
            "createdAt": "2023-12-14T13:54:25.706Z",
            "id": "gid://shopline/CompanyAddress/6245049493408458190",
            "province": null,
            "updatedAt": "2023-12-21T11:23:00.418Z"
          }
        ],
        "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).

