# Google Public DNS API

> Google Public DNS returns domain DNS records and email settings as a workflow and API.

Google Public DNS, also called Google DNS, returns DNS records for a domain, including record names, values, types, priorities, and cache times. Get dns records accepts a domain or website link and an optional record type; it also summarizes SPF, DMARC policy, and mail server setup.

- Page: https://fous.com/workflows/google-public-dns
- Handle: `@google-public-dns`
- Category: [Developer tools](https://fous.com/workflows/category/developer-tools)
- Source website: https://dns.google
- Last verified: Sep 29, 2026
- Fous is not affiliated with Google Public DNS.

## Methods

### Get dns records

Operation `get_dns_records`, version 1. 1 credit per call.

Get DNS records for a domain and summarize its SPF, DMARC policy, and mail servers. Returns the requested record type or all supported types; a missing record type yields an empty records list.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `domain` | string | yes | `"google.com"` | Domain name or pasted website link, for example example.com or https://example.com/about. |
| `record_type` | string | no | `"MX"` | Which DNS records to return, for example MX. Defaults to all. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "domain"
  ],
  "properties": {
    "domain": {
      "type": "string",
      "description": "Domain name or pasted website link, for example example.com or https://example.com/about.",
      "examples": [
        "google.com",
        "example.com",
        "https://example.com/about"
      ]
    },
    "record_type": {
      "enum": [
        "all",
        "A",
        "AAAA",
        "MX",
        "TXT",
        "NS",
        "CNAME",
        "SOA",
        "CAA"
      ],
      "type": "string",
      "default": "all",
      "description": "Which DNS records to return, for example MX. Defaults to all.",
      "examples": [
        "MX",
        "TXT"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "domain": "google.com",
      "record_type": "MX"
    },
    {
      "domain": "example.com"
    },
    {
      "domain": "https://example.com/about",
      "record_type": "TXT"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `records` | array |  | DNS records matching the chosen record type. |
| `records[].name` | string | `"google.com"` | Name owning the record. |
| `records[].value` | string | `"smtp.google.com."` | DNS record value. |
| `records[].priority` | integer or null | `10` | MX priority; null for other record types. |
| `records[].page_link` | string | `"https://dns.google/resolve?name=google.com&type=MX"` | Public DNS lookup for this record name and type. |
| `records[].record_type` | string | `"MX"` | DNS record type. |
| `records[].time_to_live_seconds` | integer | `30` | Time this answer may be cached, in seconds. |
| `email_setup` | object |  |  |
| `email_setup.spf_record` | string or null | `"v=spf1 include:_spf.google.com ~all"` | SPF record text, or null if missing. |
| `email_setup.dmarc_policy` | string | `"reject"` | DMARC policy in words or missing. |
| `email_setup.has_mail_servers` | boolean | `true` | Whether usable MX mail servers are configured. |

**Example input**

```json
{
  "domain": "google.com",
  "record_type": "MX"
}
```

**Example output**

```json
{
  "records": [
    {
      "name": "google.com",
      "value": "smtp.google.com.",
      "priority": 10,
      "page_link": "https://dns.google/resolve?name=google.com&type=MX",
      "record_type": "MX",
      "time_to_live_seconds": 30
    }
  ],
  "email_setup": {
    "spf_record": "v=spf1 include:_spf.google.com ~all",
    "dmarc_policy": "reject",
    "has_mail_servers": true
  }
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@google-public-dns",
  "visibility": "public",
  "operation": "get_dns_records",
  "version": 1,
  "input": {
    "domain": "google.com",
    "record_type": "MX"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@google-public-dns\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_dns_records\",\n  \"version\": 1,\n  \"input\": {\n    \"domain\": \"google.com\",\n    \"record_type\": \"MX\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@google-public-dns",
  "visibility": "public",
  "operation": "get_dns_records",
  "version": 1,
  "input": {
    "domain": "google.com",
    "record_type": "MX"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@google-public-dns","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Check which mail servers a domain uses
- Review a domain’s SPF and DMARC settings
- Inspect DNS record values and cache times
- Find records of a specific type for a domain

## FAQ

### Is Fous affiliated with Google Public DNS?

No. Fous is not affiliated with Google Public DNS. This workflow reads the public dns.google website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a Google Public DNS account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from dns.google when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

### Which mail servers are configured for a domain?

Use Get dns records to retrieve MX records and check whether usable mail servers are configured.

### What SPF and DMARC settings does a domain have?

Get dns records summarizes the SPF record text and DMARC policy, noting when either is missing.

### What DNS records does a domain have?

Use Get dns records with a domain; choose a record type or leave it unspecified to request all supported types.

## Related

- [ICANN Lookup API](https://fous.com/workflows/icann-lookup.md): Public domain registration lookup using ICANN registration data.
- [Google Search API](https://fous.com/workflows/google-search.md): Google Search returns public web, image, job, event, related-question, and autocomplete results in Google’s order, with answers and details when available; results may be fewer, omit information, or be empty.
- [Google Maps API](https://fous.com/workflows/google-maps.md): Google Maps returns nearby places, public place details, up to 100 public reviews, and up to three routes; transit options vary by departure time.
- [DuckDuckGo API](https://fous.com/workflows/duckduckgo.md): Private web search and instant answers.
- [Cloudflare Radar API](https://fous.com/workflows/cloudflare-radar.md): Cloudflare Radar provides internet trends, domain popularity and weekly rank history only for top-100 sites, plus recent and ongoing outages with locations when identified.
- [Google Patents API](https://fous.com/workflows/google-patents.md): Google Patents searches public records and provides patent details and company summaries; legal status is estimated, and citations, claims, and company breakdowns have record limits.
- [Google Books API](https://fous.com/workflows/google-books.md): Google Books searches books and provides book details, reader ratings, and local ebook prices when available; newest results sort by publication date.
- [Google Play API](https://fous.com/workflows/google-play.md): Google Play helps people discover Android apps and games, view public listings and search results, read reviews when available by app and region, and see country-specific top charts.
- [All Developer tools workflows](https://fous.com/workflows/category/developer-tools)
