Skip to main content

REST API Guide

This API is currently in beta. New API methods will be added soon.

Version 0.1 beta.
If you are viewing the REST API guide as a PDF file, you can always check for the latest version here:


Introduction

The SafeDNS REST API allows you to automate interactions with your SafeDNS account. It provides methods for retrieving filtering policy information, creating and managing Encrypted DNS devices, and more.


Description

API address: https://www.safedns.com/auth/rest_api/v1/


 
Table of available methods
# Type Method Description
1 POST User authorization Authorization of the user. Returns user_id.
2 GET Retrieving a list of filtering policies Returns a list of all policies created by the user.
3 POST Creating an Encrypted DNS record Creates an Encrypted DNS device record.
4 PATCH Editing an Encrypted DNS record name Changes the Encrypted DNS record name.
5 DELETE Deleting an Encrypted DNS record Deletes the Encrypted DNS record.
6 POST Creating several Encrypted DNS records Creates several Encrypted DNS records at once.
7 GET Retrieving a list of Encrypted DNS records Returns a list of all Encrypted DNS records.

Methods

1. User authorization

Authorization of the user.

Request type: POST
URL: https://www.safedns.com/auth/rest_api/v1/login/session/
Request body:

{
  "username": "your_login",
  "password": "your_password"
}

The reply contains the user_id.


2. Retrieving a list of filtering policies

Returns a list of all policies created by the user.

Request type: GET
URL: https://safedns.com/dashboard/rest_api/v1/users/{{user_id}}/profiles/
Where {{user_id}} is the entry retrieved from the Method 1 - User authorization.

The reply contains a list of all policies with their respective IDs (profile_id).


3. Creating an Encrypted DNS record

Creates an Encrypted DNS device record.

Mandatory parameters:

  • user_id - from Method 1 - User authorization.
  • profile_id - from Method 2 - Retrieving a list of filtering policies.

Request type: POST
URL: https://safedns.com/dashboard/rest_api/v1/users/{{user_id}}/doh_device/
Request body:

{
  "name": "ANY_ENCRYPTED_DNS_RECORD_NAME",
  "profile_id": FILTERING_POLICY_ID
}

This method creates a single Encrypted DNS device at a time.


4. Editing an Encrypted DNS record name

Changes the Encrypted DNS record name.

Request type: PATCH
URL: https://safedns.com/dashboard/rest_api/v1/users/{{user_id}}/doh_device/{{id_encrypted_dns}}/
Request body:

{
  "name": "_ENCRYPTED_DNS_RECORD_NAME",
  "profile_id": FILTERING_POLICY_ID
}

5. Deleting an Encrypted DNS record

Deletes the Encrypted DNS record.

Request type: DELETE
URL: https://safedns.com/dashboard/rest_api/v1/users/{{user_id}}/doh_device/{{id_encrypted_dns}}/


6. Creating several Encrypted DNS records

Creates several Encrypted DNS records at once.

Mandatory parameters:

  • user_id - from Method 1 - User authorization.
  • profile_id for each filtering policy you wish to create the record for - from Method 2 - Retrieving a list of filtering policies.

Request type: POST
URL: https://safedns.com/dashboard/rest_api/v1/users/{{user_id}}/doh_device/mass_create/
Request body:

[
  {
    "name": "ANY_ENCRYPTED_DNS_RECORD_NAME_1",
    "profile_id": FILTERING_POLICY_ID
  },
  {
    "name": "ANY_ENCRYPTED_DNS_RECORD_NAME_2",
    "profile_id": FILTERING_POLICY_ID
  },
  {
    "name": "ANY_ENCRYPTED_DNS_RECORD_NAME_3",
    "profile_id": FILTERING_POLICY_ID
  }
]

This method creates multiple Encrypted DNS records in a single request.
Each record can be assigned the same or a different filtering policy.


7. Retrieving a list of Encrypted DNS devices

Returns a list of all Encrypted DNS records.

Request type: GET
URL: https://safedns.com/dashboard/rest_api/v1/users/{{user_id}}/doh_device/csv/