Overview
Includes recognition of common services like HTTP, XMPP, SIP, and email protocols with detailed explanations of priority and weight values.
Endpoint
One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.
curl -X POST https://api.apiverve.com/v1/srvparser \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"record": "_http._tcp.example.com. 86400 IN SRV 10 60 80 server.example.com."
}'const res = await fetch('https://api.apiverve.com/v1/srvparser', {
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"record": "_http._tcp.example.com. 86400 IN SRV 10 60 80 server.example.com."
}),
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
console.log(data);import requests
res = requests.post(
"https://api.apiverve.com/v1/srvparser",
headers={"x-api-key": "your_api_key_here"},
json={
"record": "_http._tcp.example.com. 86400 IN SRV 10 60 80 server.example.com."
},
timeout=15,
)
res.raise_for_status()
print(res.json()["data"])package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"record": "_http._tcp.example.com. 86400 IN SRV 10 60 80 server.example.com."
}`)
req, _ := http.NewRequest("POST", "https://api.apiverve.com/v1/srvparser", body)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "your_api_key_here")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.
Authentication
Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.
A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.
Parameters
Sent as JSON in the request body. Premium parameters are accepted on every plan but only take effect on plans that include them.
| Parameter | Type | Description |
|---|---|---|
recordRequired | string | The SRV record string to parse |
Response
Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.
{
"status": "ok",
"error": null,
"data": {
"raw_record": "_http._tcp.example.com. 86400 IN SRV 10 60 80 server.example.com.",
"parsed": {
"name": "_http._tcp.example.com.",
"service": "_http",
"protocol": "tcp",
"domain": "example.com.",
"ttl": 86400,
"class": "IN",
"priority": 10,
"weight": 60,
"port": 80,
"target": "server.example.com"
},
"service_info": {
"name": "HTTP",
"description": "Web service",
"default_port": 80
},
"interpretation": {
"priority_explanation": "Priority level 10 (lower is better)",
"weight_explanation": "Weight 60 for load balancing",
"target_explanation": "Connect to server.example.com:80"
},
"is_valid": true
}
}Response fields
Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.
| Field | Type | Example | Description |
|---|---|---|---|
raw_record | string | "_http._tcp.example.com. 86400 IN SRV 10 60 80 server.example.com." | Original SRV record string provided for parsing |
parsed | object | {...} | |
name | string | "_http._tcp.example.com." | Full SRV record name with trailing dot |
service | string | "_http" | Service identifier (e.g., _http, _xmpp, _sip) |
protocol | string | "tcp" | Protocol type (e.g., tcp, udp, tls) |
domain | string | "example.com." | Domain name with trailing dot |
ttl | number | 86400 | Time-to-live value in seconds |
class | string | "IN" | DNS class (typically IN for Internet) |
priorityPremium | number | 10 | Priority value (lower values preferred) |
weightPremium | number | 60 | Weight for load balancing among same priority |
portPremium | number | 80 | Port number for service connection |
targetPremium | string | "server.example.com" | Target hostname without trailing dot |
service_infoPremium | object | {...} | Information about the recognized service type |
namePremium | string | "HTTP" | Human-readable service name (e.g., HTTP, XMPP) |
descriptionPremium | string | "Web service" | Service description and use case |
default_portPremium | number | 80 | Default port for identified service |
interpretationPremium | object | {...} | Human-readable interpretation of SRV record values |
priority_explanationPremium | string | "Priority level 10 (lower is better)" | Human-readable explanation of priority level |
weight_explanationPremium | string | "Weight 60 for load balancing" | Human-readable explanation of weight value |
target_explanationPremium | string | "Connect to server.example.com:80" | How to connect to target with port |
is_valid | boolean | true | Whether record is validly formatted and parsed |
Errors
Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.
| Status | Meaning | What to do |
|---|---|---|
400 | Input was rejected | Read error; it names the parameter. |
401 | Key missing or invalid | Check the header name and the key value. |
403 | Key valid, but not permitted | A key restriction or IP allow-list; see key scoping. |
429 | Rate limited, or out of credits | Read error to tell them apart; see rate limits. |
Use cases
- Service Discovery
- Parse DNS SRV records for service discovery in distributed systems, microservices, and load-balanced environments
- Network Diagnostics
- Build network diagnostic tools that analyze SRV records for troubleshooting connectivity and service availability issues
- Configuration Analysis
- Analyze service configuration in DNS including priority, weight, port, and target information for optimization
- Record Validation
- Validate SRV record formatting and structure to ensure compliance with RFC 2782 standards and best practices
Other ways to use SRV Record Parser
Set up SRV Record Parser on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.
Related
More in Reference Data: