> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create RRset

> Add the RRSet to the zone specified by zoneName, RRSets can be configured to be either dynamic or static.

Static RRsets
Staticly configured RRSets provide DNS responses as is.

Dynamic RRsets
Dynamic RRSets have picker configuration defined thus it's possible to finely customize DNS response.
Picking rules are defined on the RRSet level as a list of selectors, filters and mutators.
Picker considers different resource records metadata, requestor IP, and other event-feeds like monitoring.
Picker configuration is an ordered list defined by "pickers" attribute.
Requestor IP is determined by EDNS Client Subnet (ECS) if defined, otherwise - by client/recursor IP.
Selector pickers are used in the specified order until the first match, in case of match - all next selectors
are bypassed. Filters or mutators are applied to the match according to the order they are specified.

For example, sort records by proximity to user, shuffle based on weights and return not more than 3:

`"pickers":
[
{ "type": "geodistance" },
{ "type": "weighted_shuffle" },
{ "type": "first_n", "limit": 3 }
]`

geodns filter
A resource record is included in the answer if resource record's metadata matches requestor info.
For each resource record in RRSet, the following metadata is considered (in the order specified):

- `ip` - list of network addresses in CIDR format, e.g. `["192.168.15.150/25", "2003:de:2016::/48"]`;
- `asn` - list of autonomous system numbers, e.g. `[1234, 5678]`;
- `regions` - list of region codes, e.g. `["de-bw", "de-by"]`;
- `countries` - list of country codes, e.g. `["de", "lu", "lt"]`;
- `continents` - list of continent codes, e.g. `["af", "an", "eu", "as", "na", "sa", "oc"]`.

If there is a record (or multiple) with metadata matched IP, it's used as a response. If not - asn,
then country and then continent are checked for a match. If there is no match, then the behaviour
is defined by _strict_ parameter of the filter.

Example: `"pickers": [ { "type": "geodns", "strict": true } ]`

Strict parameter
`strict: true` means that if no records percolate through the geodns filter it returns no answers.
`strict: false` means that if no records percolate through the geodns filter, all records are passed over.

asn selector
Resource records which ASN metadata matches ASN of the requestor are picked by this selector,
and passed to the next non-selector picker, if there is no match - next configured picker starts with all records.

Example: `"pickers": [ {"type": "asn"} ]`

country selector
Resource records which country metadata matches country of the requestor are picked by this selector,
and passed to the next non-selector picker, if there is no match - next configured picker starts with all records.

Example: `"pickers": [ { "type": "country" } ]`

continent selector
Resource records which continent metadata matches continent of the requestor are picked by this selector,
and passed to the next non-selector picker, if there is no match - next configured picker starts with all records.

Example: `"pickers": [ { "type": "continent" } ]`

region selector
Resource records which region metadata matches region of the requestor are picked by this selector,
and passed to the next non-selector picker, if there is no match - next configured picker starts with all records.
e.g. `fr-nor` for France/Normandy.

Example: `"pickers": [ { "type": "region" } ]`

ip selector
Resource records which IP metadata matches IP of the requestor are picked by this selector,
and passed to the next non-selector picker, if there is no match - next configured picker starts with all records.
Maximum 100 subnets are allowed to specify in meta of RR.

Example: `"pickers": [ { "type": "ip" } ]`

default selector
When enabled, records marked as default are selected: `"meta": {"default": true}`.

Example:
`"pickers":
[
{ "type": "geodns", "strict": false },
{ "type": "default" },
{ "type": "first_n", "limit": 2 }
]`

geodistance mutator
The resource records are rearranged in ascending order based on the distance (in meters) from requestor to
the coordinates specified in latlong metadata. Distance is calculated using Haversine formula.
The "nearest" to the user's IP RR goes first. The records without latlong metadata come last.
e.g. for Berlin `[52.520008, 13.404954]`.;

In this configuration the only "nearest" to the requestor record to be returned:
`"pickers": [ { "type": "geodistance" }, { "type": "first_n", "limit": 1 } ]`

`weighted_shuffle` mutator
The resource records are rearranged in random order based on the `weight` metadata.
Default weight (if not specified) is 50.

Example: `"pickers": [ { "type": "weighted_shuffle" } ]`

`first_n` filter
Slices first N (N specified as a limit parameter value) resource records.

Example: `"pickers": [ { "type": "first_n", "limit": 1 } ]` returns only the first resource record.

limit parameter
Can be a positive value for a specific limit. Use zero or leave it blank to indicate no limits.



## OpenAPI

````yaml /api-reference/services_documented/dns_api.yaml post /dns/v2/zones/{zoneName}/{rrsetName}/{rrsetType}
openapi: 3.1.0
info:
  title: Gcore OpenAPI – DNS API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-11T15:10:30.328297+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Analyze
    x-displayName: Analyze
  - name: DNS Locations
    x-displayName: DNS Locations
  - name: Lookup
    x-displayName: Lookup
  - name: Metrics
    x-displayName: Metrics
  - name: NetworkMappings
    x-displayName: NetworkMappings
  - name: Pickers
    x-displayName: Pickers
  - name: DNS Clients
    x-displayName: DNS Clients
  - name: Zones
    x-displayName: Zones
  - name: DNSSEC
    x-displayName: DNSSEC
  - name: RRsets
    x-displayName: RRsets
paths:
  /dns/v2/zones/{zoneName}/{rrsetName}/{rrsetType}:
    post:
      tags:
        - RRsets
      summary: Create RRset
      description: >-
        Add the RRSet to the zone specified by zoneName, RRSets can be
        configured to be either dynamic or static.


        Static RRsets

        Staticly configured RRSets provide DNS responses as is.


        Dynamic RRsets

        Dynamic RRSets have picker configuration defined thus it's possible to
        finely customize DNS response.

        Picking rules are defined on the RRSet level as a list of selectors,
        filters and mutators.

        Picker considers different resource records metadata, requestor IP, and
        other event-feeds like monitoring.

        Picker configuration is an ordered list defined by "pickers" attribute.

        Requestor IP is determined by EDNS Client Subnet (ECS) if defined,
        otherwise - by client/recursor IP.

        Selector pickers are used in the specified order until the first match,
        in case of match - all next selectors

        are bypassed. Filters or mutators are applied to the match according to
        the order they are specified.


        For example, sort records by proximity to user, shuffle based on weights
        and return not more than 3:


        `"pickers":

        [

        { "type": "geodistance" },

        { "type": "weighted_shuffle" },

        { "type": "first_n", "limit": 3 }

        ]`


        geodns filter

        A resource record is included in the answer if resource record's
        metadata matches requestor info.

        For each resource record in RRSet, the following metadata is considered
        (in the order specified):


        - `ip` - list of network addresses in CIDR format, e.g.
        `["192.168.15.150/25", "2003:de:2016::/48"]`;

        - `asn` - list of autonomous system numbers, e.g. `[1234, 5678]`;

        - `regions` - list of region codes, e.g. `["de-bw", "de-by"]`;

        - `countries` - list of country codes, e.g. `["de", "lu", "lt"]`;

        - `continents` - list of continent codes, e.g. `["af", "an", "eu", "as",
        "na", "sa", "oc"]`.


        If there is a record (or multiple) with metadata matched IP, it's used
        as a response. If not - asn,

        then country and then continent are checked for a match. If there is no
        match, then the behaviour

        is defined by _strict_ parameter of the filter.


        Example: `"pickers": [ { "type": "geodns", "strict": true } ]`


        Strict parameter

        `strict: true` means that if no records percolate through the geodns
        filter it returns no answers.

        `strict: false` means that if no records percolate through the geodns
        filter, all records are passed over.


        asn selector

        Resource records which ASN metadata matches ASN of the requestor are
        picked by this selector,

        and passed to the next non-selector picker, if there is no match - next
        configured picker starts with all records.


        Example: `"pickers": [ {"type": "asn"} ]`


        country selector

        Resource records which country metadata matches country of the requestor
        are picked by this selector,

        and passed to the next non-selector picker, if there is no match - next
        configured picker starts with all records.


        Example: `"pickers": [ { "type": "country" } ]`


        continent selector

        Resource records which continent metadata matches continent of the
        requestor are picked by this selector,

        and passed to the next non-selector picker, if there is no match - next
        configured picker starts with all records.


        Example: `"pickers": [ { "type": "continent" } ]`


        region selector

        Resource records which region metadata matches region of the requestor
        are picked by this selector,

        and passed to the next non-selector picker, if there is no match - next
        configured picker starts with all records.

        e.g. `fr-nor` for France/Normandy.


        Example: `"pickers": [ { "type": "region" } ]`


        ip selector

        Resource records which IP metadata matches IP of the requestor are
        picked by this selector,

        and passed to the next non-selector picker, if there is no match - next
        configured picker starts with all records.

        Maximum 100 subnets are allowed to specify in meta of RR.


        Example: `"pickers": [ { "type": "ip" } ]`


        default selector

        When enabled, records marked as default are selected: `"meta":
        {"default": true}`.


        Example:

        `"pickers":

        [

        { "type": "geodns", "strict": false },

        { "type": "default" },

        { "type": "first_n", "limit": 2 }

        ]`


        geodistance mutator

        The resource records are rearranged in ascending order based on the
        distance (in meters) from requestor to

        the coordinates specified in latlong metadata. Distance is calculated
        using Haversine formula.

        The "nearest" to the user's IP RR goes first. The records without
        latlong metadata come last.

        e.g. for Berlin `[52.520008, 13.404954]`.;


        In this configuration the only "nearest" to the requestor record to be
        returned:

        `"pickers": [ { "type": "geodistance" }, { "type": "first_n", "limit": 1
        } ]`


        `weighted_shuffle` mutator

        The resource records are rearranged in random order based on the
        `weight` metadata.

        Default weight (if not specified) is 50.


        Example: `"pickers": [ { "type": "weighted_shuffle" } ]`


        `first_n` filter

        Slices first N (N specified as a limit parameter value) resource
        records.


        Example: `"pickers": [ { "type": "first_n", "limit": 1 } ]` returns only
        the first resource record.


        limit parameter

        Can be a positive value for a specific limit. Use zero or leave it blank
        to indicate no limits.
      operationId: CreateRRSet
      parameters:
        - name: zoneName
          in: path
          required: true
          schema:
            type: string
        - name: rrsetName
          in: path
          required: true
          schema:
            type: string
        - name: rrsetType
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InputRRSet'
        required: false
      responses:
        '200':
          description: OutputRRSet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutputRRSet'
        '400':
          description: Error message response
          headers:
            error:
              schema:
                type: string
          content: {}
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            dns_output_rrset = client.dns.zones.rrsets.create(
                rrset_type="rrsetType",
                zone_name="zoneName",
                rrset_name="rrsetName",
                resource_records=[{
                    "content": [{}]
                }],
            )
            print(dns_output_rrset.filter_set_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/dns\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdnsOutputRrset, err := client.DNS.Zones.Rrsets.New(\n\t\tcontext.TODO(),\n\t\t\"rrsetType\",\n\t\tdns.ZoneRrsetNewParams{\n\t\t\tZoneName:  \"zoneName\",\n\t\t\tRrsetName: \"rrsetName\",\n\t\t\tResourceRecords: []dns.ZoneRrsetNewParamsResourceRecord{{\n\t\t\t\tContent: []any{map[string]any{}},\n\t\t\t}},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", dnsOutputRrset.FilterSetID)\n}\n"
components:
  schemas:
    InputRRSet:
      required:
        - resource_records
      type: object
      properties:
        meta:
          type: object
          additionalProperties:
            type: object
          description: Meta information for rrset
          example: {}
        pickers:
          type: array
          description: Set of pickers
          items:
            $ref: '#/components/schemas/OutputFilter'
        resource_records:
          type: array
          description: List of resource record from rrset
          items:
            $ref: '#/components/schemas/InputResourceRecord'
        ttl:
          type: integer
          format: uint32
    OutputRRSet:
      required:
        - name
        - resource_records
        - type
      type: object
      properties:
        filter_set_id:
          type: integer
          format: uint64
        meta:
          type: object
          additionalProperties:
            type: object
          description: >-
            Meta information for rrset. Map with string key and any valid json
            as value, with valid keys

            1. `failover` (object, beta feature, might be changed in the future)
            can have fields

            1.1. `protocol` (string, required, HTTP, TCP, UDP, ICMP)

            1.2. `port` (int, required, 1-65535)

            1.3. `frequency` (int, required, in seconds 10-3600)

            1.4. `timeout` (int, required, in seconds 1-10),

            1.5. `method` (string, only for protocol=HTTP)

            1.6. `command` (string, bytes to be sent only for protocol=TCP/UDP)

            1.7. `url` (string, only for protocol=HTTP)

            1.8. `tls` (bool, only for protocol=HTTP)

            1.9. `regexp` (string regex to match, only for non-ICMP)

            1.10. `http_status_code` (int, only for protocol=HTTP)

            1.11. `host` (string, only for protocol=HTTP)

            2. `geodns_link` (string) - name of the geodns link to use, if
            previously set, must re-send when updating or

            CDN integration will be removed for this RRSet
          example: {}
        name:
          type: string
          example: sub.example.com
        pickers:
          type: array
          description: Set of pickers
          items:
            $ref: '#/components/schemas/OutputFilter'
        resource_records:
          type: array
          description: List of resource record from rrset
          items:
            $ref: '#/components/schemas/OutputResourceRecord'
        ttl:
          type: integer
          format: uint32
        type:
          type: string
          description: RRSet type
          enum:
            - A
            - AAAA
            - NS
            - CNAME
            - MX
            - TXT
            - SRV
            - SOA
        updated_at:
          $ref: '#/components/schemas/Timestamp'
        warning:
          type: string
          description: >-
            Warning about some possible side effects without strictly
            disallowing operations on rrset

            readonly

            Deprecated: use Warnings instead
        warnings:
          type: array
          description: >-
            Warning about some possible side effects without strictly
            disallowing operations on rrset

            readonly
          items:
            $ref: '#/components/schemas/Warning'
    OutputFilter:
      required:
        - type
      type: object
      properties:
        limit:
          type: integer
          description: >-
            Limits the number of records returned by the filter

            Can be a positive value for a specific limit. Use zero or leave it
            blank to indicate no limits.
          format: int64
        strict:
          type: boolean
          description: >-
            if strict=false, then the filter will return all records if no
            records match the filter
        type:
          type: string
          description: Filter type
          enum:
            - geodns
            - asn
            - country
            - continent
            - region
            - ip
            - geodistance
            - weighted_shuffle
            - default
            - first_n
    InputResourceRecord:
      required:
        - content
      type: object
      properties:
        content:
          type: array
          description: >-
            Content of resource record

            The exact length of the array depends on the type of rrset,

            each individual record parameter must be a separate element of the
            array. For example

            SRV-record: `[100, 1, 5061, "example.com"]`

            CNAME-record: `[ "the.target.domain" ]`

            A-record: `[ "1.2.3.4", "5.6.7.8" ]`

            AAAA-record: `[ "2001:db8::1", "2001:db8::2" ]`

            MX-record: `[ "mail1.example.com", "mail2.example.com" ]`

            SVCB/HTTPS-record: `[ 1, ".", ["alpn", "h3", "h2"], [ "port", 1443
            ], [ "ipv4hint", "10.0.0.1" ], [ "ech",
            "AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA"
            ] ]`
          example:
            - 100
            - 1
            - 5061
            - example.com
          items:
            type: object
        enabled:
          type: boolean
          default: true
        meta:
          type: object
          additionalProperties:
            type: object
          description: |-
            This meta will be used to decide which resource record should pass
            through filters from the filter set
          example:
            asn:
              - 17544
              - 17812
            continents:
              - europe
              - asia
            countries:
              - us
              - gb
              - lu
            ip:
              - 192.168.15.150/25
              - 2003:de:2016::/48
            weight: 30
      description: 'nolint: lll'
    OutputResourceRecord:
      required:
        - content
      type: object
      properties:
        content:
          type: array
          description: >-
            Content of resource record

            The exact length of the array depends on the type of rrset,

            each individual record parameter must be a separate element of the
            array. For example

            SRV-record: `[100, 1, 5061, "example.com"]`

            CNAME-record: `[ "the.target.domain" ]`

            A-record: `[ "1.2.3.4", "5.6.7.8" ]`

            AAAA-record: `[ "2001:db8::1", "2001:db8::2" ]`

            MX-record: `[ "mail1.example.com", "mail2.example.com" ]`

            SVCB/HTTPS-record: `[ 1, ".", ["alpn", "h3", "h2"], [ "port", 1443
            ], [ "ipv4hint", "10.0.0.1" ], [ "ech",
            "AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA"
            ] ]`
          example:
            - 100
            - 1
            - 5061
            - example.com
          items:
            type: object
        enabled:
          type: boolean
          default: true
        id:
          type: integer
          format: uint64
          example: 42
        meta:
          type: object
          additionalProperties:
            type: object
          description: >-
            Meta information for record

            Map with string key and any valid json as value, with valid keys

            1. `asn` (array of int)

            2. `continents` (array of string)

            3. `countries` (array of string)

            4. `latlong` (array of float64, latitude and longitude)

            5. `backup` (bool)

            6. `notes` (string)

            7. `weight` (float)

            8. `ip` (string)

            9. `default` (bool)


            Some keys are reserved for balancing, @see
            https://api.gcore.com/dns/v2/info/meta


            This meta will be used to decide which resource record should pass

            through filters from the filter set
          example:
            continents:
              - europe
              - asia
            countries:
              - us
              - gb
              - lu
            ip:
              - 192.168.15.150/25
              - 2003:de:2016::/48
    Timestamp:
      type: string
      description: Timestamp marshals/unmarshals date and time as timestamp in json
      format: date-time
    Warning:
      type: object
      properties:
        key:
          type: string
        message:
          type: string
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````