If your domain's DNS is hosted with BinaryLane, you can list, add, change and delete its DNS records with the BinaryLane CLI or API instead of mPanel. This is useful when you point records at new servers, add verification records, or repeat the same change across domains.

The examples use the fictional domain example.com, the documentation addresses 203.0.113.10 and 203.0.113.20, and a fictional record ID. Replace them with your own values.

Keep API tokens secure
Access tokens are like passwords and should be kept secure. API access allows programmatic control of your account, including destructive actions such as deleting servers and data. Commands that only read DNS records still use a token with full account access. See BinaryLane API token permissions.

TABLE OF CONTENTS

Before you begin

To make the same changes without commands, use mPanel's domain management page.

Prepare records before changing nameservers
You can add the domain to BinaryLane DNS and prepare its records before switching nameservers. Adding it here does not register the domain or change its delegation. Check the records directly against a BinaryLane nameserver before changing nameservers at your registrar. Until delegation changes, public DNS queries continue to use the existing DNS provider.

Applies to

  • binarylane-cli 0.21.0
  • BinaryLane API v2

List records and find a record ID

List every record in the domain:

bl domain record list example.com

The output shows each record's ID, name, type and data. The CLI fetches every page of results for you. To narrow the list, filter by type, by name, or both:

bl domain record list example.com --type A --name www

Changing or deleting a record needs its ID, so note the ID of the record you want before continuing.

Add a record

Each record needs a type, a name and data. For the name, use the subdomain on its own (for example www, not www.example.com), @ for the domain itself, or * for a wildcard.

To point www.example.com at a server's IPv4 address:

bl domain record create example.com --type A --name www --data 203.0.113.10

Mail (MX) records also need a priority. To send mail for example.com to a mail server:

bl domain record create example.com --type MX --name @ --data mail.example.com. --priority 10

The MX target must end with a dot, as in mail.example.com.. To create an MX record for a subdomain, use its relative name instead of @, for example --name alerts for mail addressed to alerts.example.com.

Other record types use their own options: SRV records use --priority, --weight and --port, and CAA records use --flags and --tag. Run bl domain record create --help for the full list.

Leave out --ttl. BinaryLane DNS uses a fixed time to live of 3600 seconds (1 hour), which is applied automatically.

Change a record

Give the domain, the record ID and only the values you want to change. Values you leave out keep their current setting. For example, to move www to a new server's address, where 12345678 is the record's ID:

bl domain record update example.com 12345678 --data 203.0.113.20

The record keeps its name and type; only the address changes.

Delete a record

Check the record before deleting it
The CLI deletes the record without a confirmation prompt. Deleting the wrong record can stop a website or email from working, although cached DNS answers can remain after deletion. Run bl domain record get example.com 12345678 first and check that it is the record you intend to remove.

To delete the record:

bl domain record delete example.com 12345678

These steps delete a single record. They do not remove the domain from BinaryLane DNS.

Use the API directly

The API accepts the same values as the CLI. These examples use Bash and curl, with your token in the BINARYLANE_API_TOKEN variable.

List records, filtered to www A records:

curl --request GET \
  "https://api.binarylane.com.au/v2/domains/example.com/records?type=A&name=www" \
  --header "Authorization: Bearer ${BINARYLANE_API_TOKEN}"

API results are returned in pages of 20 records by default. For a domain with more records, add per_page (up to 200) or request further pages with page.

Add an A record:

curl --request POST \
  "https://api.binarylane.com.au/v2/domains/example.com/records" \
  --header "Authorization: Bearer ${BINARYLANE_API_TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{"type": "A", "name": "www", "data": "203.0.113.10"}'

Do not include a ttl value. The response contains the new record, including its id.

Change a record's data only:

curl --request PUT \
  "https://api.binarylane.com.au/v2/domains/example.com/records/12345678" \
  --header "Authorization: Bearer ${BINARYLANE_API_TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{"data": "203.0.113.20"}'

Although this is a PUT request, values you leave out are kept. Sending an empty string ("") clears a text value.

Delete a record, after checking it as described above:

curl --request DELETE \
  "https://api.binarylane.com.au/v2/domains/example.com/records/12345678" \
  --header "Authorization: Bearer ${BINARYLANE_API_TOKEN}"

A successful delete returns 204 No Content with no body.

Confirm the change

First read the record back with bl domain record get example.com 12345678, or list records again after a deletion. This checks the saved configuration, not the answer DNS clients receive.

Then ask a BinaryLane nameserver directly. You can do this before the domain uses BinaryLane nameservers. A saved change may not appear in the nameserver's answer immediately; check again if it still returns the previous value. On Linux or macOS:

dig @ns1.binarylane.com.au www.example.com A +short

On Windows, in PowerShell:

Resolve-DnsName -Name www.example.com -Type A -Server ns1.binarylane.com.au

Other DNS resolvers can keep returning the previous answer until their cached copy expires. Records created here use a 1 hour time to live. When moving from another DNS provider, its previous TTLs and cached delegation also matter; a successful direct query does not mean every public resolver is using BinaryLane yet.

Troubleshooting

  • The domain or record is not found: check the spelling of the domain and the record ID, and that you are using the intended account. Run bl domain list and bl domain record list again.
  • The request is rejected because of the TTL: remove --ttl or the ttl value and try again.
  • The BinaryLane nameserver shows the new record but others do not: wait for cached answers to expire, and check that the domain uses BinaryLane's nameservers.
  • An MX target is rejected: include the trailing dot on the mail server hostname, for example mail.example.com..
  • Authentication fails (401 Unauthorized): check that the token is correct and has not been revoked. Do not print the token to check it. For the CLI, run bl configure again.

BinaryLane DNS does not support DNSSEC. See Can you host my DNS records? What are your nameservers?