# POST /dns/zones/{name}/ttl

First published 14 Oct 2026 (release 0.2.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the dns group.

Set TTLs for multiple records in a DNS zone

- Who may call it: administrator
- Token scope, any of: dns, all
- Answers: 200 OK

Set ttl to a number of seconds, or pass null to clear the per-record TTLs and use the zone's $TTL (dns.ttl). The operation changes only the TTL of individually editable records. The server's own records and any record IDs listed in skip are excluded. A missing ttl or a skip value other than an array or null returns 400.

If any TTL changes, UrbeStack assigns a new zone serial and reloads the DNS server. The 200 response includes the publication outcome.

## As a command

- [urbestack-dns-ttl-set](https://urbestack.com/docs/commands/urbestack-dns-ttl-set.md): Changes only the TTL on individually editable records in a zone.

## Parameters

- `name` (path, DomainName, required)

## Request body

JSON, the type [DnsTtlSet](https://urbestack.com/docs/api/types/DnsTtlSet.md).

- `ttl` (integer, 0 or more or null, required): TTL in seconds to set on every selected record, or null to use the zone's $TTL.
- `skip` (array of integer): IDs of records to leave unchanged, corresponding to the records deselected in the web interface.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X POST "$API/dns/zones/example.com/ttl" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "skip": [
      1
    ],
    "ttl": 1
  }'
```

Response, 200 OK:

```
{
  "changes": [
    {
      "from": 1,
      "id": 1,
      "name": "alice",
      "to": 1,
      "type": "rebuild"
    }
  ],
  "published": true,
  "records": 1,
  "reload": "text",
  "skipped": 1,
  "ttl": 1,
  "unchanged": 1,
  "zone": "text"
}
```

## Errors

- 400: --ttl SECONDS or --default is required
- 400: --ttl and --default do not go together
- 400: --zone is required
- 400: <what> must be a number of seconds from 1 to 604800
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid domain name
- 400: Invalid id
- 400: body is missing required field ttl (seconds, or null for the zone's <TTL>)
- 400: skip is a list of record ids
- 401: Authentication required
- 404: Zone '<name>' not found
