{% extends "layout.html" %} {% block content %}

User Profile & API

{{ session['username'][0].upper() }}

{{ session['username'] }}

{{ session['role'] }} Account

Your Assigned Templates

{% if user_data.assigned_templates %} {% for t in user_data.assigned_templates %} {{ t }} {% endfor %} {% else %} No templates assigned. {% endif %}

Personal API Access Token

Use this token to authenticate your API requests. Keep it secret!

{% if user_data.api_token %}
{{ user_data.api_token }}
{% else %}
{% endif %}

API Examples (Documentation)

1. Get Available Profiles (Templates)

curl -X GET {{ request.host_url }}api/v1/user/templates \
  -H "Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"
// Expected Response:
{
  "status": "success",
  "templates": ["Basic_Profile", "Advanced_Hosting"]
}

2. Check if Zone Exists

curl -X GET {{ request.host_url }}api/v1/user/zone/check/example.com \
  -H "Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}"

3. Create New Master Zone

curl -X POST {{ request.host_url }}api/v1/user/zone/create \
  -H "Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "template_name": "YOUR_TEMPLATE_NAME", // REQUIRED
    "sync": true
  }'

4. Add Record (Forward: A, CNAME, TXT etc)

curl -X POST {{ request.host_url }}api/v1/user/record/add \
  -H "Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "example.com",
    "name": "web",
    "type": "A",
    "value": "1.2.3.4",
    "sync": true
  }'

5. Add Reverse Record (PTR)

curl -X POST {{ request.host_url }}api/v1/user/record/add \
  -H "Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "1.168.192.in-addr.arpa",
    "name": "10",
    "type": "PTR",
    "value": "nas.example.com"
  }'

6. Manual Cluster Sync

curl -X POST {{ request.host_url }}api/v1/user/sync \
  -H "Authorization: Bearer {{ user_data.api_token or 'YOUR_TOKEN' }}" \
  -H "Content-Type: application/json" \
  -d '{"domain": "example.com"}'
{% endblock %}