---
type: api
title: Update a private location
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-put-private-location
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-put-private-location
products:
  - Kibana
---

# Update a private location

- Server: `https://{kibana_url}`

## Paths

- `PUT` `/api/synthetics/private_locations/{id}`
- `PUT` `/s/{space_id}/api/synthetics/private_locations/{id}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

#### Path Parameters

- `id` (string)
  The unique identifier of the private location to be updated.

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Update an existing private location's label or agent policy.
You must have `all` privileges for the Synthetics and Uptime feature in the Observability section of the Kibana feature privileges.
When a private location's label is updated, all monitors using this location will also be updated to maintain data consistency.
When a private location's agent policy is changed, the package policies of all monitors using this location are deleted and recreated on the new agent policy. Monitors stop running on the previous agents until agents on the new policy pick them up. The new agent policy must be available in all spaces of the private location and must not be used by another private location.

## Request Body

`application/json`

- `agentPolicyId` (string · min: 1) — optional
  The ID of the Fleet agent policy to move the private location to.
- `label` (string · min: 1) — optional
  A new label for the private location. Must be at least 1 character long.

## Responses

#### `200`

A successful response.

`application/json`

- `agentPolicyId` (string)
  The ID of the agent policy associated with the private location.
- `geo` (object)
  Geographic coordinates (WGS84) for the location.
  - `lat` (number)
    The latitude of the location.
  - `lon` (number)
    The longitude of the location.
- `id` (string)
  The unique identifier of the private location.
- `isInvalid` (boolean)
  Indicates whether the location is invalid. If `true`, the location is invalid, which means the agent policy associated with the location is deleted.
- `label` (string)
  A label for the private location.
- `namespace` (string)
  The namespace of the location, which is the same as the namespace of the agent policy associated with the location.
#### `400`

If the `label` is shorter than 1 character, or the `agentPolicyId` is not available in the current space, does not cover all spaces of the private location, or is already used by another private location, the API will return a 400 Bad Request response with a corresponding error message.

#### `404`

If the private location with the specified ID does not exist, the API will return a 404 Not Found response.

## Code Examples

#### Console

```console
PUT /api/synthetics/private_locations/{id}
{
  "label": "Updated Private Location Name"
}
```

#### curl

```curl
curl -X PUT "https://{kibana_url}/api/synthetics/private_locations/{id}" \
  -H "Content-Type: application/json" \
  -d '{
  "label": "Updated Private Location Name"
}'
```

## Response Examples

#### Put private location response example1

```json
{
  "label": "Updated Private Location Name",
  "id": "test-private-location-id",
  "agentPolicyId": "test-private-location-id",
  "isServiceManaged": false,
  "isInvalid": false,
  "tags": ["private", "testing", "updated"],
  "geo": {
    "lat": 37.7749,
    "lon": -122.4194
  },
  "spaces": ["*"]
}
```

