---
title: "Upsert Location"
method: PUT
path: "/locations"
tags: ["Locations"]
---

# Upsert Location

`PUT /locations`

Upsert a location, identified using the location's `external_id`.

## Request body

- UpsertLocationRequest
  - `external_id` string, required — The identifier used by an external source to identify the location.
  - `sales_channel` string, required — If a channel with this name is not already associated with the shop, it will be used to create a new channel.
  - `name` string, required — The name of the location.
  - `status` 'active' | 'inactive', required — The status of the location.
  - `address` AddressRequestData
    - `name` string, nullable — The name of the address.
    - `company` string, nullable — The name of the company residing at the address.
    - `address1` string, required — Line 1 of the address.
    - `address2` string, nullable — Line 2 of the address.
    - `city` string, required — The city in which the address is located.
    - `region` string, nullable — The state or region in which the address is located.
    - `postal_code` string, nullable — The postal code associated with the address.
    - `country_code` string, required — The country code associated with the address.

## Response `201`

Success

- LocationWrappedResponse
  - `location` LocationResponse, required
    - `id` integer, required — The unique integer identifier for the location, created by Loop.
    - `external_id` string, nullable — The identifier used by an external source to identify the location.
    - `sales_channel` string, required — The name of the channel.
    - `name` string, required — The name of the location.
    - `status` 'active' | 'inactive', required — The status of the location.
    - `address` AddressResponseData, required
      - `name` string, nullable — The name of the address.
      - `company` string, nullable — The name of the company residing at the address.
      - `address1` string, nullable — Line 1 of the address.
      - `address2` string, nullable — Line 2 of the address.
      - `city` string, nullable — The city in which the address is located.
      - `region` string, nullable — The state or region in which the address is located.
      - `postal_code` string, nullable — The postal code associated with the address.
      - `country_code` string, nullable — The country code associated with the address.

## Other responses

- `401` — Unauthorized
- `422` — Unprocessable Entity

---

[API](https://skmtc.dev/loopreturns/apis/listings-api.md) · [All operations](https://skmtc.dev/loopreturns/apis/listings-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/loopreturns/listings-api/revisions/750e6012dbb8/schema)
