> ## 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.

# Import Network Mapping

> Import network mapping from YAML file.

Note: A YAML file use spaces as indentation, tabs are not allowed.
Example of input file:

```
  name: mapping_rule_1
  mapping:
      - tags:
          - tag_name_1
        cidr4:
          - 127.0.2.0/24
      - tags:
          - tag_name_2
          - tag_name_3
        cidr4:
          - 128.0.1.0/24
          - 128.0.2.0/24
          - 128.0.3.0/24
        cidr6:
          - ac:20::0/64
---
  name: mapping_rule_2
  mapping:
      - tags:
          - my_network
        cidr4:
          - 129.0.2.0/24
        cidr6:
          - ac:20::0/64
```

Example of request:

```
curl --location --request POST 'https://api.gcore.com/dns/v2/network-mappings/import' \
--header 'Authorization: Bearer ...' \
--header 'Content-Type: text/plain' \
--data-raw 'name: mapping_rule_1
mapping:
    - tags:
        - tag_name_1
      cidr4:
        - 127.0.2.0/24
    - tags:
        - tag_name_2
        - tag_name_3
      cidr4:
        - 128.0.1.0/24
        - 128.0.2.0/24
        - 128.0.3.0/24
      cidr6:
        - aa:10::/64
---
name: mapping_rule_2
mapping:
    - tags:
        - my_network
      cidr4:
        - 129.0.2.0/24
      cidr6:
        - ac:20::0/64'
```



## OpenAPI

````yaml /api-reference/services_documented/dns_api.yaml post /dns/v2/network-mappings/import
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/network-mappings/import:
    post:
      tags:
        - NetworkMappings
      summary: Import Network Mapping
      description: >-
        Import network mapping from YAML file.


        Note: A YAML file use spaces as indentation, tabs are not allowed.

        Example of input file:


        ```
          name: mapping_rule_1
          mapping:
              - tags:
                  - tag_name_1
                cidr4:
                  - 127.0.2.0/24
              - tags:
                  - tag_name_2
                  - tag_name_3
                cidr4:
                  - 128.0.1.0/24
                  - 128.0.2.0/24
                  - 128.0.3.0/24
                cidr6:
                  - ac:20::0/64
        ---
          name: mapping_rule_2
          mapping:
              - tags:
                  - my_network
                cidr4:
                  - 129.0.2.0/24
                cidr6:
                  - ac:20::0/64
        ```


        Example of request:


        ```

        curl --location --request POST
        'https://api.gcore.com/dns/v2/network-mappings/import' \

        --header 'Authorization: Bearer ...' \

        --header 'Content-Type: text/plain' \

        --data-raw 'name: mapping_rule_1

        mapping:
            - tags:
                - tag_name_1
              cidr4:
                - 127.0.2.0/24
            - tags:
                - tag_name_2
                - tag_name_3
              cidr4:
                - 128.0.1.0/24
                - 128.0.2.0/24
                - 128.0.3.0/24
              cidr6:
                - aa:10::/64
        ---

        name: mapping_rule_2

        mapping:
            - tags:
                - my_network
              cidr4:
                - 129.0.2.0/24
              cidr6:
                - ac:20::0/64'
        ```
      operationId: ImportNetworkMapping
      responses:
        '200':
          description: ImportNetworkMappingResponse
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportNetworkMappingResponse'
        '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
            )
            response = client.dns.network_mappings.import_()
            print(response.success)
        - 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/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.DNS.NetworkMappings.Import(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Success)\n}\n"
components:
  schemas:
    ImportNetworkMappingResponse:
      type: object
      properties:
        success:
          type: boolean
  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

````