> ## Documentation Index
> Fetch the complete documentation index at: https://docs.commenda.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update location

> Update a location's details

Update a location's address, types, active status, or date range.

## Path parameters

<ParamField path="location_id" type="string" required>
  The unique identifier (UUID) of the location to update.
</ParamField>

## Request body

<ParamField body="address" type="object">
  Updated address. If provided, `country` is required within the address object.

  <Expandable title="Address fields">
    <ParamField body="address_line_1" type="string">
      Street address.
    </ParamField>

    <ParamField body="address_line_2" type="string">
      Additional address details.
    </ParamField>

    <ParamField body="address_line_3" type="string">
      Additional address details.
    </ParamField>

    <ParamField body="city" type="string">
      City or locality.
    </ParamField>

    <ParamField body="state" type="string">
      State or province code (2-3 characters).
    </ParamField>

    <ParamField body="postal_code" type="string">
      ZIP or postal code.
    </ParamField>

    <ParamField body="country" type="string" required>
      ISO 3166-1 alpha-2 country code.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="location_types" type="array">
  Updated array of location types. Minimum 1 type if provided.
</ParamField>

<ParamField body="is_primary" type="boolean">
  Whether this is the primary location.
</ParamField>

<ParamField body="start_date" type="string">
  Updated start date (YYYY-MM-DD).
</ParamField>

<ParamField body="end_date" type="string">
  Updated end date (YYYY-MM-DD).
</ParamField>

<ParamField body="is_active" type="boolean">
  Whether the location is active.
</ParamField>

<ParamField body="notes" type="string">
  Updated notes.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://transaction-tax.api.in.commenda.io/api/v1/locations/b2c3d4e5-f6a7-8901-bcde-f12345678901' \
    --header 'Authorization: Bearer <your_token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "location_types": ["HEADQUARTERS", "REGISTERED_OFFICE", "WAREHOUSE"],
      "notes": "Added warehouse function"
    }'
  ```

  ```json Update types theme={null}
  {
    "location_types": ["HEADQUARTERS", "REGISTERED_OFFICE", "WAREHOUSE"],
    "notes": "Added warehouse function"
  }
  ```

  ```json Close a location theme={null}
  {
    "is_active": false,
    "end_date": "2025-06-30"
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Successfully updated location.",
    "data": {
      "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "corporation_id": "550e8400-e29b-41d4-a716-446655440000",
      "address": {
        "address_line_1": "123 Main Street",
        "city": "San Francisco",
        "state": "CA",
        "postal_code": "94105",
        "country": "US"
      },
      "location_types": ["HEADQUARTERS", "REGISTERED_OFFICE", "WAREHOUSE"],
      "is_primary": true,
      "is_active": true,
      "start_date": "2024-01-01",
      "notes": "Added warehouse function",
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-03-01T09:00:00Z"
    }
  }
  ```

  ```json 404 - Not found theme={null}
  {
    "error": {
      "type": "LOCATION_NOT_FOUND",
      "title": "Location not found.",
      "detail": {
        "description": "The location does not exist or you don't have access."
      },
      "status": 404,
      "instance": "/api/v1/locations/b2c3d4e5-f6a7-8901-bcde-f12345678901"
    }
  }
  ```
</ResponseExample>
