> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emnify.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emnify.com/_mcp/server.

# Get a DNS firewall profile

GET https://cdn.emnify.net/api/v1/dns_firewall_profile/{dns_firewall_profile_id}

**Required permissions** [Learn more](/developers/api-guidelines/permissions#how-permissions-work)

`DnsFirewallProfile` + `Get`

*Roles:* Administrator

Returns a single DNS firewall profile by ID, including the full profile rule content, file name, and a list of attached service profiles.

Reference: https://docs.emnify.com/developers/api/dns-firewall-profile/dns-firewall-profile-get-by-id

## Authentication

- `Authorization` header (bearer token, required) — An `auth_token` should be provided to authenticate a session. To obtain an `auth_token`, see the [`/api/v1/authenticate` **POST** request](/developers/api/authentication/authenticate).

## Request

### Path parameters

- `dns_firewall_profile_id` (double, required) — The DNS firewall profile ID

## Response

### 200

DNS firewall profile successfully retrieved.

- `id` (integer, optional) — Unique identifier of the DNS firewall profile.
- `name` (string, optional) — Name of the DNS firewall profile.
- `description` (string, optional) — Description of the DNS firewall profile.
- `created` (string, optional) — Timestamp when the profile was created.
- `last_updated` (string, optional) — Timestamp when the profile was last modified.
- `last_uploaded` (string, optional) — Timestamp when the profile rules were last uploaded.
- `profile` (string, optional) — DNS firewall rules in line-oriented text format, one rule per line.
- `profile_file_name` (string, optional)
- `attached_service_profiles` (list of ApiV1DnsFirewallProfileDnsFirewallProfileIdGetResponsesContentApplicationJsonSchemaAttachedServiceProfilesItems, optional)

## Errors

### 401 Unauthorized Error

Missing or invalid Authorization header.

- `error_code` (integer, optional)
- `error_token` (string, optional)
- `message` (string, optional)
- `errors` (list of ApiV1DnsFirewallProfileDnsFirewallProfileIdGetResponsesContentApplicationJsonSchemaErrorsItems, optional) — sub error descriptions

### 403 Forbidden Error

User doesn't have permission to get DNS firewall profile, or the feature isn't enabled for the organization.

- `error_token` (string, required)
- `message` (string, required)
- `error_code` (integer, optional)
- `errors` (list of ApiV1DnsFirewallProfileDnsFirewallProfileIdGetResponsesContentApplicationJsonSchemaErrorsItems, optional) — sub error descriptions

### 404 Not Found Error

DNS firewall profile not found.

- `error_token` (string, required)
- `message` (string, required)
- `error_code` (integer, optional)
- `errors` (list of ApiV1DnsFirewallProfileDnsFirewallProfileIdGetResponsesContentApplicationJsonSchemaErrorsItems, optional) — sub error descriptions

### 422 Unprocessable Entity Error

Unprocessable entity.

- `error_token` (string, required)
- `message` (string, required)
- `error_code` (integer, optional)
- `errors` (list of ApiV1DnsFirewallProfileDnsFirewallProfileIdGetResponsesContentApplicationJsonSchemaErrorsItems, optional) — sub error descriptions

## Types

### ApiV1DnsFirewallProfileDnsFirewallProfileIdGetResponsesContentApplicationJsonSchemaAttachedServiceProfilesItems

- `id` (integer, optional)
- `name` (string, optional)

### ApiV1DnsFirewallProfileDnsFirewallProfileIdGetResponsesContentApplicationJsonSchemaErrorsItems

## Examples

**Response**

```json
{
  "id": 10,
  "name": "corp-dns-policy",
  "description": "Corporate DNS firewall policy",
  "created": "2026-07-07T08:15:00Z",
  "last_updated": "2026-07-07T08:15:00Z",
  "last_uploaded": "2026-07-07T08:15:00Z",
  "profile": "ALLOW example.com\nALLOW *.example.com\nDENY phishing.example.test\n",
  "profile_file_name": "corp-dns-policy.txt",
  "attached_service_profiles": [
    {
      "id": 101,
      "name": "IoT devices EU"
    },
    {
      "id": 102,
      "name": "Routers US"
    }
  ]
}
```

**SDK Code**

```python DNS Firewall Profile
import requests

url = "https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript DNS Firewall Profile
const url = 'https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go DNS Firewall Profile
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby DNS Firewall Profile
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java DNS Firewall Profile
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php DNS Firewall Profile
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp DNS Firewall Profile
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift DNS Firewall Profile
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v1/dns_firewall_profile/1.1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```