> 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.iot.telia.lt/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.iot.telia.lt/_mcp/server.

# Create DNS config

POST https://iot.telia.lt/api/v1/dns
Content-Type: application/json

Creates a DNS configuration object. The DNS config can be applied to a service profile and all endpoints which use that service profile will have the associated DNS settings applied.
DNS changes are instantly applied to any **new PDP context**.
Connected devices with previously established PDPs will continue to use the previous nameserver config until the next time they reconnect.

Primary and secondary nameservers and IP version (`4` for IPV4 or `6` for IPV6) must be specified with this request.

The system currently falls back to IPV4 for the actually-enforced networking settings of endpoints, therefore **the IPV6 parameter will be ignored** when provided.

Reference: https://docs.iot.telia.lt/developers/api/service-lookups-and-configuration/dns-post

## 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

### Body (application/json)

This endpoint expects an object.

- `primary` (string, required)
- `secondary` (string, required)
- `ip_address_version` (integer, required)

## Response

### 201

Resource Created

## Errors

### 403 Forbidden Error

Your role doesn't include the permission this endpoint requires. Most endpoints return `error_code`, `error_token`, and `message`. Some return only `status_code` and `message`.

- `error_code` (integer, optional)
- `error_token` (string, optional)
- `status_code` (integer, optional)
- `message` (string, optional)

## Examples

### Create Google Public DNS

**Request**

```json
{
  "primary": "8.8.8.8",
  "secondary": "8.8.4.4",
  "ip_address_version": 4
}
```

**Response**

```json
{}
```

**SDK Code**

```python Create Google Public DNS
import requests

url = "https://iot.telia.lt/api/v1/dns"

payload = {
    "primary": "8.8.8.8",
    "secondary": "8.8.4.4",
    "ip_address_version": 4
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create Google Public DNS
const url = 'https://iot.telia.lt/api/v1/dns';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"primary":"8.8.8.8","secondary":"8.8.4.4","ip_address_version":4}'
};

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

```go Create Google Public DNS
package main

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

func main() {

	url := "https://iot.telia.lt/api/v1/dns"

	payload := strings.NewReader("{\n  \"primary\": \"8.8.8.8\",\n  \"secondary\": \"8.8.4.4\",\n  \"ip_address_version\": 4\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Create Google Public DNS
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/dns")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"primary\": \"8.8.8.8\",\n  \"secondary\": \"8.8.4.4\",\n  \"ip_address_version\": 4\n}"

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

```java Create Google Public DNS
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://iot.telia.lt/api/v1/dns")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"primary\": \"8.8.8.8\",\n  \"secondary\": \"8.8.4.4\",\n  \"ip_address_version\": 4\n}")
  .asString();
```

```php Create Google Public DNS
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://iot.telia.lt/api/v1/dns', [
  'body' => '{
  "primary": "8.8.8.8",
  "secondary": "8.8.4.4",
  "ip_address_version": 4
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create Google Public DNS
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/dns");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"primary\": \"8.8.8.8\",\n  \"secondary\": \"8.8.4.4\",\n  \"ip_address_version\": 4\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Google Public DNS
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "primary": "8.8.8.8",
  "secondary": "8.8.4.4",
  "ip_address_version": 4
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/dns")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

### Create OpenDNS config

**Request**

```json
{
  "primary": "208.67.222.222",
  "secondary": "208.67.220.220",
  "ip_address_version": 4
}
```

**Response**

```json
{}
```

**SDK Code**

```python Create OpenDNS config
import requests

url = "https://iot.telia.lt/api/v1/dns"

payload = {
    "primary": "208.67.222.222",
    "secondary": "208.67.220.220",
    "ip_address_version": 4
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create OpenDNS config
const url = 'https://iot.telia.lt/api/v1/dns';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"primary":"208.67.222.222","secondary":"208.67.220.220","ip_address_version":4}'
};

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

```go Create OpenDNS config
package main

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

func main() {

	url := "https://iot.telia.lt/api/v1/dns"

	payload := strings.NewReader("{\n  \"primary\": \"208.67.222.222\",\n  \"secondary\": \"208.67.220.220\",\n  \"ip_address_version\": 4\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Create OpenDNS config
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/dns")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"primary\": \"208.67.222.222\",\n  \"secondary\": \"208.67.220.220\",\n  \"ip_address_version\": 4\n}"

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

```java Create OpenDNS config
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://iot.telia.lt/api/v1/dns")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"primary\": \"208.67.222.222\",\n  \"secondary\": \"208.67.220.220\",\n  \"ip_address_version\": 4\n}")
  .asString();
```

```php Create OpenDNS config
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://iot.telia.lt/api/v1/dns', [
  'body' => '{
  "primary": "208.67.222.222",
  "secondary": "208.67.220.220",
  "ip_address_version": 4
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create OpenDNS config
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/dns");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"primary\": \"208.67.222.222\",\n  \"secondary\": \"208.67.220.220\",\n  \"ip_address_version\": 4\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create OpenDNS config
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "primary": "208.67.222.222",
  "secondary": "208.67.220.220",
  "ip_address_version": 4
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/dns")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

### Create Cloudflare DNS config

**Request**

```json
{
  "primary": "1.1.1.1",
  "secondary": "1.0.0.1",
  "ip_address_version": 4
}
```

**Response**

```json
{}
```

**SDK Code**

```python Create Cloudflare DNS config
import requests

url = "https://iot.telia.lt/api/v1/dns"

payload = {
    "primary": "1.1.1.1",
    "secondary": "1.0.0.1",
    "ip_address_version": 4
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create Cloudflare DNS config
const url = 'https://iot.telia.lt/api/v1/dns';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"primary":"1.1.1.1","secondary":"1.0.0.1","ip_address_version":4}'
};

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

```go Create Cloudflare DNS config
package main

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

func main() {

	url := "https://iot.telia.lt/api/v1/dns"

	payload := strings.NewReader("{\n  \"primary\": \"1.1.1.1\",\n  \"secondary\": \"1.0.0.1\",\n  \"ip_address_version\": 4\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Create Cloudflare DNS config
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/dns")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"primary\": \"1.1.1.1\",\n  \"secondary\": \"1.0.0.1\",\n  \"ip_address_version\": 4\n}"

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

```java Create Cloudflare DNS config
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://iot.telia.lt/api/v1/dns")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"primary\": \"1.1.1.1\",\n  \"secondary\": \"1.0.0.1\",\n  \"ip_address_version\": 4\n}")
  .asString();
```

```php Create Cloudflare DNS config
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://iot.telia.lt/api/v1/dns', [
  'body' => '{
  "primary": "1.1.1.1",
  "secondary": "1.0.0.1",
  "ip_address_version": 4
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create Cloudflare DNS config
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/dns");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"primary\": \"1.1.1.1\",\n  \"secondary\": \"1.0.0.1\",\n  \"ip_address_version\": 4\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Cloudflare DNS config
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "primary": "1.1.1.1",
  "secondary": "1.0.0.1",
  "ip_address_version": 4
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/dns")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```

### Create Comodo DNS config

**Request**

```json
{
  "primary": "8.26.56.26",
  "secondary": "8.20.247.20",
  "ip_address_version": 4
}
```

**Response**

```json
{}
```

**SDK Code**

```python Create Comodo DNS config
import requests

url = "https://iot.telia.lt/api/v1/dns"

payload = {
    "primary": "8.26.56.26",
    "secondary": "8.20.247.20",
    "ip_address_version": 4
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create Comodo DNS config
const url = 'https://iot.telia.lt/api/v1/dns';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"primary":"8.26.56.26","secondary":"8.20.247.20","ip_address_version":4}'
};

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

```go Create Comodo DNS config
package main

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

func main() {

	url := "https://iot.telia.lt/api/v1/dns"

	payload := strings.NewReader("{\n  \"primary\": \"8.26.56.26\",\n  \"secondary\": \"8.20.247.20\",\n  \"ip_address_version\": 4\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Create Comodo DNS config
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/dns")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"primary\": \"8.26.56.26\",\n  \"secondary\": \"8.20.247.20\",\n  \"ip_address_version\": 4\n}"

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

```java Create Comodo DNS config
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://iot.telia.lt/api/v1/dns")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"primary\": \"8.26.56.26\",\n  \"secondary\": \"8.20.247.20\",\n  \"ip_address_version\": 4\n}")
  .asString();
```

```php Create Comodo DNS config
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://iot.telia.lt/api/v1/dns', [
  'body' => '{
  "primary": "8.26.56.26",
  "secondary": "8.20.247.20",
  "ip_address_version": 4
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Create Comodo DNS config
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/dns");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"primary\": \"8.26.56.26\",\n  \"secondary\": \"8.20.247.20\",\n  \"ip_address_version\": 4\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create Comodo DNS config
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "primary": "8.26.56.26",
  "secondary": "8.20.247.20",
  "ip_address_version": 4
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/dns")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```