Create Location¶
POST/
DNS Protection API · Locations
Creates a new Location and returns the newly created Location. There is a limit of 50 locations per account.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
Request body¶
Content type: application/json
Request body fields
namestringLocation name.
Must match the pattern
Must match the pattern
^[a-zA-Z0-9\-_ ]+$. Must be 1–100 characters long.idstring (uuid)The unique ID of this location.
isDefaultbooleanIndicates if this is the default location.
descriptionstringThe description of this location.
Must be at most 250 characters long.
Must be at most 250 characters long.
createdAtstring (date-time)The date/time when this location was created.
updatedAtstring (date-time)The date/time when this location was updated.
ipAddressesarray of stringThe IPv4 and/or IPv6 list of addresses for this location. The combined number of items in
Must contain at most 100 items. Items must be unique.
ipAddresses and domainNames must not exceed 100.Must contain at most 100 items. Items must be unique.
domainNamesarray of stringThe list of domain names for this location. The combined number of items in
Must contain at most 100 items. Items must be unique.
ipAddresses and domainNames must not exceed 100.Must contain at most 100 items. Items must be unique.
dohSecureLocationIdstringThe DNS Over HTTPS secure location ID, which is is a globally unique random ID generated for this location.
dohEnabledbooleanIndicates if the DNS Over HTTPS is enabled for this location.
policyIdstring (uuid)The policy ID associated with this location.
dohUrlstringtypestringRepresents the type of a location.
Must be one of:
Must be one of:
standard, sfos, protectedBrowser.labelstringAn optional label for this location.
Must be at most 256 characters long.
Must be at most 256 characters long.
deletedAtstring (date-time)The date/time when this location was soft deleted.
policyWebcatVersionintegerWebcat version of the policy associated with this location.
Request samples¶
curl -X POST "https://api-<data-region>.central.sophos.com/dns-protection/v2/locations" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>" -H "Content-Type: application/json" -d "{
\"name\": \"Headquarters\",
\"id\": \"d4e1aee7-6c4e-4c9e-a8e2-1b1f4f7c4e3e\",
\"isDefault\": false,
\"description\": \"Main office location with secure DNS configuration.\",
\"type\": \"standard\",
\"label\": \"Main HQ\",
\"createdAt\": \"2025-01-01T12:00:00.686+00:00\",
\"updatedAt\": \"2025-08-01T08:30:00.200+00:00\",
\"deletedAt\": \"2025-10-01T08:30:00.200+00:00\",
\"ipAddresses\": [
\"192.168.1.1\",
\"192.168.1.2\"
],
\"domainNames\": [
\"hq.company.com\",
\"internal.company.com\"
],
\"dohSecureLocationId\": \"392oj0e54880r\",
\"dohEnabled\": true,
\"policyId\": \"e4f558e2-9f3a-44e0-a7a3-6b2f7b8b3d5d\",
\"dohUrl\": \"https://392oj0e54880r.secure.dev.dnsprotection.sophos.com/dns-query\",
\"policyWebcatVersion\": 1
}"
import requests
response = requests.post(
"https://api-<data-region>.central.sophos.com/dns-protection/v2/locations",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
json={ 'name': 'Headquarters',
'id': 'd4e1aee7-6c4e-4c9e-a8e2-1b1f4f7c4e3e',
'isDefault': False,
'description': 'Main office location with secure DNS configuration.',
'type': 'standard',
'label': 'Main HQ',
'createdAt': '2025-01-01T12:00:00.686+00:00',
'updatedAt': '2025-08-01T08:30:00.200+00:00',
'deletedAt': '2025-10-01T08:30:00.200+00:00',
'ipAddresses': ['192.168.1.1', '192.168.1.2'],
'domainNames': ['hq.company.com', 'internal.company.com'],
'dohSecureLocationId': '392oj0e54880r',
'dohEnabled': True,
'policyId': 'e4f558e2-9f3a-44e0-a7a3-6b2f7b8b3d5d',
'dohUrl': 'https://392oj0e54880r.secure.dev.dnsprotection.sophos.com/dns-query',
'policyWebcatVersion': 1},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
"Content-Type" = "application/json"
}
$body = '{
"name": "Headquarters",
"id": "d4e1aee7-6c4e-4c9e-a8e2-1b1f4f7c4e3e",
"isDefault": false,
"description": "Main office location with secure DNS configuration.",
"type": "standard",
"label": "Main HQ",
"createdAt": "2025-01-01T12:00:00.686+00:00",
"updatedAt": "2025-08-01T08:30:00.200+00:00",
"deletedAt": "2025-10-01T08:30:00.200+00:00",
"ipAddresses": [
"192.168.1.1",
"192.168.1.2"
],
"domainNames": [
"hq.company.com",
"internal.company.com"
],
"dohSecureLocationId": "392oj0e54880r",
"dohEnabled": true,
"policyId": "e4f558e2-9f3a-44e0-a7a3-6b2f7b8b3d5d",
"dohUrl": "https://392oj0e54880r.secure.dev.dnsprotection.sophos.com/dns-query",
"policyWebcatVersion": 1
}'
Invoke-RestMethod -Method POST -Uri "https://api-<data-region>.central.sophos.com/dns-protection/v2/locations" -Headers $headers -Body $body -ContentType "application/json"
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, err := http.NewRequest("POST", "https://api-<data-region>.central.sophos.com/dns-protection/v2/locations", strings.NewReader(`{
"name": "Headquarters",
"id": "d4e1aee7-6c4e-4c9e-a8e2-1b1f4f7c4e3e",
"isDefault": false,
"description": "Main office location with secure DNS configuration.",
"type": "standard",
"label": "Main HQ",
"createdAt": "2025-01-01T12:00:00.686+00:00",
"updatedAt": "2025-08-01T08:30:00.200+00:00",
"deletedAt": "2025-10-01T08:30:00.200+00:00",
"ipAddresses": [
"192.168.1.1",
"192.168.1.2"
],
"domainNames": [
"hq.company.com",
"internal.company.com"
],
"dohSecureLocationId": "392oj0e54880r",
"dohEnabled": true,
"policyId": "e4f558e2-9f3a-44e0-a7a3-6b2f7b8b3d5d",
"dohUrl": "https://392oj0e54880r.secure.dev.dnsprotection.sophos.com/dns-query",
"policyWebcatVersion": 1
}`))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <access-token>")
req.Header.Set("X-Tenant-ID", "<tenant-id>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
const response = await fetch("https://api-<data-region>.central.sophos.com/dns-protection/v2/locations", {
method: "POST",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Headquarters",
"id": "d4e1aee7-6c4e-4c9e-a8e2-1b1f4f7c4e3e",
"isDefault": false,
"description": "Main office location with secure DNS configuration.",
"type": "standard",
"label": "Main HQ",
"createdAt": "2025-01-01T12:00:00.686+00:00",
"updatedAt": "2025-08-01T08:30:00.200+00:00",
"deletedAt": "2025-10-01T08:30:00.200+00:00",
"ipAddresses": [
"192.168.1.1",
"192.168.1.2"
],
"domainNames": [
"hq.company.com",
"internal.company.com"
],
"dohSecureLocationId": "392oj0e54880r",
"dohEnabled": true,
"policyId": "e4f558e2-9f3a-44e0-a7a3-6b2f7b8b3d5d",
"dohUrl": "https://392oj0e54880r.secure.dev.dnsprotection.sophos.com/dns-query",
"policyWebcatVersion": 1
}),
});
const data = await response.json();
console.log(data);
Responses¶
201 — Created.¶
Response fields
namestringLocation name.
Must match the pattern
Must match the pattern
^[a-zA-Z0-9\-_ ]+$. Must be 1–100 characters long.idstring (uuid)The unique ID of this location.
isDefaultbooleanIndicates if this is the default location.
descriptionstringThe description of this location.
Must be at most 250 characters long.
Must be at most 250 characters long.
createdAtstring (date-time)The date/time when this location was created.
updatedAtstring (date-time)The date/time when this location was updated.
ipAddressesarray of stringThe IPv4 and/or IPv6 list of addresses for this location. The combined number of items in
Must contain at most 100 items. Items must be unique.
ipAddresses and domainNames must not exceed 100.Must contain at most 100 items. Items must be unique.
domainNamesarray of stringThe list of domain names for this location. The combined number of items in
Must contain at most 100 items. Items must be unique.
ipAddresses and domainNames must not exceed 100.Must contain at most 100 items. Items must be unique.
dohSecureLocationIdstringThe DNS Over HTTPS secure location ID, which is is a globally unique random ID generated for this location.
dohEnabledbooleanIndicates if the DNS Over HTTPS is enabled for this location.
policyIdstring (uuid)The policy ID associated with this location.
dohUrlstringtypestringRepresents the type of a location.
Must be one of:
Must be one of:
standard, sfos, protectedBrowser.labelstringAn optional label for this location.
Must be at most 256 characters long.
Must be at most 256 characters long.
deletedAtstring (date-time)The date/time when this location was soft deleted.
policyWebcatVersionintegerWebcat version of the policy associated with this location.
Errors¶
| Status | Meaning |
|---|---|
400 | Bad request. |
401 | Unauthorized. |
403 | Forbidden. |
409 | Conflict. |
500 | Unexpected error. |
All error responses share the same shape — see the error response object.
Response examples¶
201¶
{
"name": "Headquarters",
"id": "d4e1aee7-6c4e-4c9e-a8e2-1b1f4f7c4e3e",
"isDefault": false,
"description": "Main office location with secure DNS configuration.",
"type": "standard",
"label": "Main HQ",
"createdAt": "2025-01-01T12:00:00.686+00:00",
"updatedAt": "2025-08-01T08:30:00.200+00:00",
"deletedAt": "2025-10-01T08:30:00.200+00:00",
"ipAddresses": [
"192.168.1.1",
"192.168.1.2"
],
"domainNames": [
"hq.company.com",
"internal.company.com"
],
"dohSecureLocationId": "392oj0e54880r",
"dohEnabled": true,
"policyId": "e4f558e2-9f3a-44e0-a7a3-6b2f7b8b3d5d",
"dohUrl": "https://392oj0e54880r.secure.dev.dnsprotection.sophos.com/dns-query",
"policyWebcatVersion": 1
}
See the guide for a narrative walkthrough of this API.