Skip to content

List zones.

GET /v1/dns/zones

List zones of an user. The type of the results can be selected using the view parameter. Results can be filtered and sorted using the filter and sort parameters, and filtered by zone metadata using metadata filter expressions.

Query Parameters

view string enum

Zone format (defaults to summary)

Example: detail

Possible Values
detail
name_only
offset integer

Offset from beginning of list

Example: 0

Minimum: 0

limit integer

Maximum number of results to return

Example: 20

Minimum: 0

sort object

Sort options: (allowed fields: zone_name, publication_state; allowed sorting: asc, desc).

Example:

{
"publication_state": "asc",
"zone_name": "asc"
}
filter object

Filter options: (allowed fields: publication_state, is_shared, name, zone_type)

Example:

{
"is_shared": true,
"name": "example.com",
"publication_state": "published",
"zone_type": "primary"
}
expand[] array[string]

Sub-resource expansion options. (allowed resources: dns_name_count, rdata_count)

Example:

[
"dns_name_count",
"rdata_count"
]
metadata string

The metadata expression format.

The metadata filter expression is a JSON string, defined by the Expression type. It is used to filter out results based on their metadata.

We support conditions that operate in textual, numeric, or datetime values.

For example, the expression { "op": "exact", "key": "key1", "value": "value1" } will only yield results with a metadata key named key1 that contains the value value1.

For example, the expression { "op": "lt", "key": "key2", "value": 10 } will only yield results with a metadata key named key2 that contains a numeric value less than 10.

Textual conditions

A Textual condition is defined by the TextCondition type:

type TextCondition = {
op: TextOp;
key: string;
value: string;
};

A Textual condition can only be used with the exact or contains operators.

type TextOp = "exact" | "contains";

Numeric and datetime conditions.

Numeric and datetime conditions are defined by the OrdinalCondition type:

type OrdinalCondition = {
op: OrdinalOp;
key: string;
value: Ordinal;
};

Numeric values can be any JSON number value. Datetime must be RFC 3339 date strings.

type Ordinal = number | Datetime;
type Datetime = string;

Numeric and Datetime values can be used with the following equality and comparison operators:

type OrdinalOp = "eq" | "lt" | "le" | "gt" | "ge" | "neq";

And clauses.

Numeric, datetime and textual conditions can be combined using and and or clauses. The AndClause combines one or more Condition, and only yields results where all the conditions are true.

type Condition = OrdinalCondition | TextCondition;
type AndClause = { and: Condition[] };

Example:

{
"and": [
{ "op" : "contains", "key": "key1", "value": "value1" },
{ "op" : "exact" , "key": "key2", "value": "value2" }
]
}

Or clauses.

The OrClause combines one or more Condition, and only yields results if any of the conditions are true.

type OrClause = { or: (AndClause | Condition)[] };

Example:

{
"or": [
{ "op" : "contains", "key": "key1", "value": "value1" },
{ "op" : "exact" , "key": "key2", "value": "value2" }
]
}

Nested clauses.

We support limited nesting. AndClauses can be nested inside of an AndClause.

Example:

{
"or": [
{ "op" : "contains", "key": "key1", "value": "value1" },
{ "and": [
{ "op" : "contains", "key": "key2", "value": "value2" },
{ "op" : "exact" , "key": "key3", "value": "value3" }
] }
]
}

A complete Expression can be formed by a single Condition, and AndClause, or and OrClause, nested or not.

type Expression = AndClause | OrClause | Condition;

Example: {"or":[{"and":[{"op":"contains","key":"key1","value":"value1"},{"op":"exact","key":"key2","value":"value2"}]},{"op":"exact","key":"key3","value":"value3"}]}

Response