Skip to content

Instantly share code, notes, and snippets.

@xxxdepy
Created August 15, 2026 00:48
Show Gist options
  • Select an option

  • Save xxxdepy/7e4a8dc903c26ea6a698ba7d48092946 to your computer and use it in GitHub Desktop.

Select an option

Save xxxdepy/7e4a8dc903c26ea6a698ba7d48092946 to your computer and use it in GitHub Desktop.
Bulk Add DNS Records in Squarespace Domains

Full write-up: https://www.stramaxon.com/2026/08/bulk-add-dns-squarespace.html

Squarespace doesn’t currently provide a practical bulk-add UI for DNS records. If you need to add dozens of records, you can use the same internal endpoint Squarespace’s DNS interface calls from your authenticated browser session.

Steps

  1. Log into Squarespace and open the domain’s DNS settings.
  2. Open DevTools → Network.
  3. Add one DNS record manually.
  4. Find the request to:
POST /api/account/1/domains/{DOMAIN_ID}/dns/v2/dns-bulk-changes
  1. Copy the {DOMAIN_ID} from the request URL.
  2. Get the CSRF token from the request/cookies. In Chrome DevTools it may appear as crumb.
  3. Run this helper in the DevTools Console:
const CSRF_TOKEN = "PASTE_YOUR_TOKEN_HERE";

async function addDnsRecords(records) {
    const res = await fetch(
        "https://account.squarespace.com/api/account/1/domains/{DOMAIN_ID}/dns/v2/dns-bulk-changes",
        {
            headers: {
                "accept": "application/json",
                "content-type": "application/json",
                "x-csrf-token": CSRF_TOKEN
            },
            body: JSON.stringify({
                recordsToAdd: records,
                recordsToRemove: [],
                presetsToAdd: [],
                presetsToRemove: []
            }),
            method: "POST",
            credentials: "include"
        }
    );

    const json = await res.json().catch(() => null);

    console.log({
        status: res.status,
        ok: res.ok,
        response: json
    });

    return json;
}

Then add records in batches:

await addDnsRecords([
    {
        type: "CNAME",
        domainName: "example.com",
        subdomain: "em1234.location",
        ttl: 14400,
        hostname: "example.sendgrid.net",
        priority: ""
    },
    {
        type: "MX",
        domainName: "example.com",
        subdomain: "location",
        ttl: 14400,
        hostname: "mx.sendgrid.net",
        priority: "10"
    }
]);

I recommend using smaller batches, around 10–15 records, and verifying each response before continuing.

I used this approach to add 92 DNS records across 23 locations without entering them individually through the Squarespace UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment