Create a private location

POST /api/synthetics/private_locations

Spaces method and path for this operation:

post /s/{space_id}/api/synthetics/private_locations

Refer to Spaces for more information.

Create a private location backed by a Fleet agent policy.

You must have all privileges for the Synthetics and Uptime feature in the Observability section of the Kibana feature privileges.

[Required authorization] Route required privileges: uptime-read AND private-location-write AND uptime-write.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json

Body

  • agentPolicyId string Required

    The ID of the agent policy associated with the private location. Each agent policy can back only one private location.

    Minimum length is 1, maximum length is 1024.

  • geo object

    Geographic coordinates (WGS84) for the location.

    Additional properties are NOT allowed.

    Hide geo attributes Show geo attributes object
    • lat number Required

      The latitude of the location.

    • lon number Required

      The longitude of the location.

  • label string Required

    A label for the private location. Must be unique.

    Minimum length is 1, maximum length is 1024.

  • spaces array[string]

    An array of space IDs where the private location is available. If it is not provided, the private location is available in all spaces.

    Not more than 100 elements. Maximum length of each is 256.

  • tags array[string]

    An array of tags to categorize the private location.

    Not more than 100 elements. Maximum length of each is 256.

Responses

  • 200 application/json

    A successful response.

    Hide response attributes Show response attributes object
    • agentPolicyId string

      The ID of the agent policy associated with the private location.

    • geo object

      Geographic coordinates (WGS84) for the location.

      Hide geo attributes Show geo attributes object
      • lat number Required

        The latitude of the location.

      • lon number Required

        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.

    • spaces array[string]

      The space IDs where the private location is available.

    • tags array[string]

      An array of tags to categorize the private location.

  • 400

    If the agentPolicyId is already used by an existing private location or if the label already exists, the API returns a 400 Bad Request response with a corresponding error message.

POST /api/synthetics/private_locations
curl \
  -X POST "${KIBANA_URL}/api/synthetics/private_locations" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{"label":"Private Location 1","agentPolicyId":"abcd1234","tags":["private","testing"],"geo":{"lat":40.7128,"lon":-74.006},"spaces":["default"]}'
POST kbn://api/synthetics/private_locations
{"label":"Private Location 1","agentPolicyId":"abcd1234","tags":["private","testing"],"geo":{"lat":40.7128,"lon":-74.006},"spaces":["default"]}
Request example
Run `POST /api/synthetics/private_locations` to create a private location.
{
  "agentPolicyId": "abcd1234",
  "geo": {
    "lat": 40.7128,
    "lon": -74.006
  },
  "label": "Private Location 1",
  "spaces": [
    "default"
  ],
  "tags": [
    "private",
    "testing"
  ]
}
Response examples (200)
{
  "agentPolicyId": "abcd1234",
  "geo": {
    "lat": 40.7128,
    "lon": -74.006
  },
  "id": "abcd1234",
  "label": "Private Location 1",
  "spaces": [
    "default"
  ],
  "tags": [
    "private",
    "testing"
  ]
}