Skip to content
Start here

Get NEL setting

client.Zones.NEL.Get(ctx, query) (*Setting, error)
GET/zones/{zone_id}/settings/nel

Fetches the Network Error Logging (NEL) setting for a zone. NEL allows browsers to report network errors to a configured endpoint. The setting is enabled by default for free and pro zones, and disabled by default for business and enterprise zones unless the NEL product feature is enabled.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Zone Settings Read
ParametersExpand Collapse
query NELGetParams
ZoneID param.Field[string]

Identifier of the zone.

maxLength32
ReturnsExpand Collapse
type Setting struct{…}

A zone-scoped NEL configuration setting.

ID SettingID

Zone setting identifier.

Editable bool

Whether the setting is editable. This is false when the zone’s plan does not include NEL or the NEL product feature is not enabled.

ModifiedOn Time

When the setting was last modified. A zero value (0001-01-01T00:00:00Z) indicates the setting has never been explicitly set and is using the default value.

formatdate-time
Value SettingValue

The NEL configuration value.

Enabled bool

Whether Network Error Logging is enabled for the zone. When enabled, browsers report network errors to Cloudflare’s NEL endpoint.

Get NEL setting

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/zones"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  setting, err := client.Zones.NEL.Get(context.TODO(), zones.NELGetParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", setting.ID)
}
{
  "errors": [],
  "messages": [],
  "result": {
    "editable": false,
    "id": "nel",
    "modified_on": "0001-01-01T00:00:00Z",
    "value": {
      "enabled": false
    }
  },
  "success": true
}
{
  "errors": [],
  "messages": [],
  "result": {
    "editable": true,
    "id": "nel",
    "modified_on": "2024-01-15T10:30:00Z",
    "value": {
      "enabled": true
    }
  },
  "success": true
}
{
  "errors": [
    {
      "code": 1009,
      "message": "auth.not_authorized"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 1010,
      "message": "auth.forbidden"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 1000,
      "message": "internal_error"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": {
    "editable": false,
    "id": "nel",
    "modified_on": "0001-01-01T00:00:00Z",
    "value": {
      "enabled": false
    }
  },
  "success": true
}
{
  "errors": [],
  "messages": [],
  "result": {
    "editable": true,
    "id": "nel",
    "modified_on": "2024-01-15T10:30:00Z",
    "value": {
      "enabled": true
    }
  },
  "success": true
}
{
  "errors": [
    {
      "code": 1009,
      "message": "auth.not_authorized"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 1010,
      "message": "auth.forbidden"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}
{
  "errors": [
    {
      "code": 1000,
      "message": "internal_error"
    }
  ],
  "messages": [],
  "result": null,
  "success": false
}