---
title: "Update a location."
method: PUT
path: "/api/v1/locations/{id}"
tags: ["Locations"]
---

# Update a location.

`PUT /api/v1/locations/{id}`

## Request

- Base URL: `https://api.mapulus.com`
- URL: `https://api.mapulus.com/api/v1/locations/{id}`
- Auth: HTTP bearer

This endpoint updates a location. Locations must also have either a valid `address` or `lat` and `lon`. When adding `custom_attributes`, if the custom_attribute does not already exist on the layer (based on name), you can set the `create_or_update_custom_attributes` in the main body of the JSON or `create_or_update_custom_attribute` in the nested attribute object to create or ignore it. Without this flag, new custom_attributes will return an error. Moving the location to new layers is possible by passing a new `layer_id` in the JSON body.
Example request:

```
curl --location --request PUT 'https://api.mapulus.com/api/v1/locations/<location-id>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-token>' \
--data '{
  "object": "location",
  "lat": -27.4704528,
  "lon": 153.0260341,
  "label": null,
  "title": "Head Office",
  "address": "Brisbane, Australia",
  "external_id": null,
  "travel_contour": true,
  "contour_mode": "driving",
  "contour_metric": "minutes",
  "contour_style": "polygons",
  "contour_minutes": "15",
  "layer_id": "0b942634-814f-42f7-82f5-7f4d06213275",
  "create_or_update_custom_attributes": true,
  "custom_attributes": [
    {
      "object": "custom_attribute",
      "name": "Location Type",
      "value": "Public Store",
      "create_or_update_custom_attribute": false
    }
  ]
}'

## Path parameters

- `id` string, required

## Request body

- object
  - `object` string
  - `lat` number, float, nullable
  - `lon` number, float, nullable
  - `label` string, nullable
  - `title` string, nullable
  - `address` string, nullable
  - `external_id` string, nullable
  - `travel_contour` boolean, nullable
  - `contour_mode` string, nullable
  - `contour_metric` string, nullable
  - `contour_style` string, nullable
  - `contour_minutes` string, nullable
  - `layer_id` string, uuid, required
  - `create_or_update_custom_attributes` boolean
  - `custom_attributes` object[]
    - `object` string, required
    - `name` string, required
    - `value` string, nullable
    - `create_or_update_custom_attribute` boolean

## Response `200`

Success: Updates a single location.

- object
  - `object` string, required
  - `id` string, uuid, required
  - `lat` number, float, nullable, required
  - `lon` number, float, nullable, required
  - `label` string, nullable
  - `title` string, nullable
  - `address` string, nullable
  - `external_id` string, nullable
  - `geocoding_error` boolean, nullable
  - `geocoding_error_type` string, nullable
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `travel_contour` boolean, nullable
  - `contour_mode` string, nullable
  - `contour_metric` string, nullable
  - `contour_style` string, nullable
  - `contour_minutes` string, nullable
  - `map_id` string, uuid, required
  - `layer_id` string, uuid, required
  - `custom_attributes` object[], required
    - `object` string, required
    - `name` string, required
    - `value` string, nullable, required
    - `custom_attribute_id` string, uuid, required
    - `custom_attribute_value_id` string, uuid, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required

## Other responses

- `401`: Unauthorized: Invalid API Key or does not have the correct permission to access resource.
- `404`: RecordNotFound: Location not found.
- `422`: Unprocessable Entity: The server was unable to understand or process the entity. For example an invalid layer_id.

---

[API](https://skmtc.dev/mapulus/apis/mapulus-api.md) · [All operations](https://skmtc.dev/mapulus/apis/mapulus-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mapulus/apis/mapulus-api/revisions/b99766fa053f?raw)
