# Nodeloc API Examples — Full Reference with Real Response Data ## Registration ```bash curl -s 'https://domain.nodeloc.com/api/auth/register' -X POST \ -H 'Content-Type: application/json' \ -d '{"username":"[REDACTED-NAME]","email":"margaretedwardse316@gmail.com","password":"Reform123!@#"}' ``` Response: ```json { "message": "success.user_created", "user": { "id": 3375, "username": "[REDACTED-NAME]", "email": "margaretedwardse316@gmail.com", "email_verified": false, "is_admin": false, "user_level": "normal", "domain_quota": 2, "invite_code": "b578c9431037ff8a", "total_invites": 0, "successful_invites": 0, "status": "active", "created_at": "2026-07-16T10:39:49.944849748Z" } } ``` ## Login ```bash curl -s 'https://domain.nodeloc.com/api/auth/login' -X POST \ -H 'Content-Type: application/json' \ -d '{"email":"margaretedwardse316@gmail.com","password":"Reform123!@#"}' ``` Response: ```json { "message": "success.login", "token": "eyJhbG... (257 chars)", "user": { "id": 3375, "username": "[REDACTED-NAME]", "email": "margaretedwardse316@gmail.com", "email_verified": false, "is_admin": false, "user_level": "normal", "domain_quota": 2, "invite_code": "b578c9431037ff8a", "status": "active", "last_login_at": "2026-07-16T10:40:12.252949214Z" } } ``` ## Root Domains (TLDs) ```bash curl -s 'https://domain.nodeloc.com/api/public/root-domains' ``` Response: ```json { "root_domains": [ { "id": 1, "domain": "loc.cc", "description": "Loc.cc", "nameservers": "[\"ns1.nodelook.com\",\"ns2.nodelook.com\"]", "use_default_nameservers": true, "is_active": true, "is_hot": true, "is_new": true, "priority": 100, "min_length": 3, "max_length": 63, "registration_count": 3436, "price_per_year": 100, "lifetime_price": 1000, "is_free": false, "min_user_level": "normal" }, { "id": 5, "domain": "rr.kg", "price_per_year": 100, "lifetime_price": 1000, "is_free": false, "min_user_level": "normal" } ] } ``` ## Calculate Price ```bash curl -s 'https://domain.nodeloc.com/api/orders/calculate' -X POST \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{"subdomain":"[REDACTED-NAME]","root_domain_id":1,"years":10}' ``` Response: ```json { "base_price": 1000, "discount_amount": 0, "final_price": 1000, "coupon_applied": false } ``` ## Create Order (with FREEJUL promo) ```bash curl -s 'https://domain.nodeloc.com/api/orders' -X POST \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{"subdomain":"[REDACTED-NAME]","root_domain_id":1,"years":10,"coupon_code":"FREEJUL"}' ``` Response: ```json { "message": "Order created successfully", "order": { "id": 6702, "order_number": "ORD178419901522d1fad9", "full_domain": "[REDACTED-NAME].loc.cc", "years": 10, "is_lifetime": false, "base_price": 1000, "discount_amount": 1000, "final_price": 0, "status": "pending", "created_at": "2026-07-16T10:50:15.863928Z", "expires_at": "2026-07-16T11:05:15.863821Z", "root_domain": { "id": 1, "domain": "loc.cc" } } } ``` ## Pay Free Order ```bash curl -s "https://domain.nodeloc.com/api/payments/6707/complete-free" -X POST \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{}' ``` Response: ```json { "message": "Free order completed successfully", "order_id": 6707 } ``` ## Paid Order Initiate ```bash curl -s "https://domain.nodeloc.com/api/payments/${ORDER_ID}/initiate" -X POST \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{}' # → {"redirect_url":"https://..."} ``` ## List Domains ```bash curl -s 'https://domain.nodeloc.com/api/domains' -H "Authorization: Bearer $TOKEN" ``` Response: ```json { "domains": [ { "id": 4901, "full_domain": "[REDACTED-NAME].loc.cc", "subdomain": "[REDACTED-NAME]", "root_domain_id": 1, "status": "active", "registered_at": "2026-07-16T10:52:26.925642Z", "expires_at": "2036-07-16T10:52:26.925642Z", "nameservers": "[\"ns1.nodelook.com\",\"ns2.nodelook.com\"]", "use_default_nameservers": true, "auto_renew": false, "dns_synced": false, "user_id": 3375 } ] } ``` ## List Orders ```bash curl -s 'https://domain.nodeloc.com/api/orders' -H "Authorization: Bearer $TOKEN" ``` Response: ```json { "orders": [ { "id": 6707, "order_number": "ORD1784199104dba87308", "full_domain": "[REDACTED-NAME].loc.cc", "years": 10, "is_lifetime": false, "base_price": 1000, "discount_amount": 1000, "final_price": 0, "status": "paid", "created_at": "2026-07-16T10:51:44.026417Z", "paid_at": "2026-07-16T10:52:26.925642Z" } ], "page": 1, "page_size": 20, "total": 1 } ``` ## DNS — List Records ```bash curl -s "https://domain.nodeloc.com/api/dns/4901/records" \ -H "Authorization: Bearer $TOKEN" ``` Response: ```json { "records": [ { "id": 6793, "domain_id": 4901, "name": "@", "type": "MX", "content": "mx1.improvmx.com", "ttl": 3600, "priority": 10, "is_active": true, "synced_to_powerdns": false } ] } ``` ## DNS — Add Record Supported types: A, AAAA, CNAME, ALIAS, MX, TXT, NS, SRV, CAA. MX records require `priority` field (integer). ```bash curl -s 'https://domain.nodeloc.com/api/dns/4901/records' -X POST \ -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ -d '{"name":"@","type":"MX","content":"mx1.improvmx.com","priority":10,"ttl":3600}' ``` Response: ```json { "message": "DNS record created successfully", "record": { "id": 6793, "domain_id": 4901, "name": "@", "type": "MX", "content": "mx1.improvmx.com", "ttl": 3600, "priority": 10, "is_active": true, "synced_to_powerdns": false, "created_at": "2026-07-16T12:20:35.043233174Z" } } ``` ## Error Responses ### Email already exists ```json {"error": "error.email_exists"} ``` ### Validation error (wrong field names, missing required fields) ```json {"error": "error.validation"} ``` ### Coupon already used (one per account) ```json {"error": "You have already used this coupon on 0001-01-01T00:00:00Z. This coupon can only be used once per user"} ``` ### Domain already registered ```json {"error": "Domain already registered"} ``` ### Invalid credentials ```json {"error": "error.invalid_credentials"} ``` ### CyberPanel provisioning failed ```json {"error": "CyberPanel provisioning failed: CyberPanel returned HTTP 404..."} ``` ### Password registration disabled (web UI only) The web UI shows "当前禁止密码注册,请使用以下登录方式" but the API still accepts password registration.