Delegate and Deallocate INRs From APNIC's Pool

This tutorial assumes that you have an access token. If you do not have an access token, see Authentication for details on how to get one.

Delegate INRs From APNIC’s pool

To delegate INRs from APNIC’s pool to a subaccount, submit a direct-delegation POST request. Prior to submitting the request, contact details need to be provided by preferably setting default entities and Whois maintainers or alternatively setting a Whois template. This information is needed to inform parts of the delegation record created in Whois and RDAP.

(Note: The delegation request will fail if contact details is not provided.)

# Configure the access token.
$ export TOKEN=$access_token

# Configure the API base URL.
$ export BASE_URL=https://registry-testbed.apnic.net/nir-api

# Create an IPv4 direct delegation.
$ curl -s \
   -H "Authorization: Bearer $TOKEN" \
   -H "Content-Type: application/json" \
   -X POST $BASE_URL/direct-delegations/ipv4 \
   --data-binary @- << EOF | jq
{
    "type": "ALLOCATED",
    "networkName": "SUB1-NETNAME",
    "description": "subaccount 1 ipv4 allocation",
    "length": 24,
    "subaccountId": 1
}
EOF
{
  "_links": {
    "api:tasks": {
      "href": "https://registry-testbed.apnic.net/nir-api/tasks/3"
    },
    "curies": [
      {
        "href": "https://registry-testbed.apnic.net/nir-api/docs/overview#{rel}",
        "name": "api",
        "templated": true
      }
    ]
  }
}

To fetch the task object:

$ curl -s \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  $BASE_URL/tasks/3 | jq
{
    "id": 3,
    "taskStatus": "SUCCESSFUL",
    "response": {
        "info": []
    },
    "_links": {
        "self": {
            "href": "https://registry-testbed.apnic.net/nir-api/tasks/3"
        }
    }
}

Deallocate INRs Delegated From APNIC’s pool

To deallocate IPv4 resource delegated from APNIC’s pool:


# Deallocate an IPv4 direct delegation
$ curl -s \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -X POST "$BASE_URL/direct-delegations/ipv4/deallocate?subaccountId=1&resources=103.164.200.0/24"
{
    "_links": {
        "api:tasks": {
            "href": "https://registry-testbed.apnic.net/nir-api/tasks/4"
        },
        "curies": [
            {
                "href": "https://registry-testbed.apnic.net/nir-api/docs/overview#{rel}",
                "name": "api",
                "templated": true
            }
        ]
    }
}

To fetch the task object:

$ curl -s \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  $BASE_URL/tasks/4 | jq
{
    "id": 4,
    "taskStatus": "SUCCESSFUL",
    "response": {
        "info": []
    },
    "_links": {
        "self": {
            "href": "https://registry-testbed.apnic.net/nir-api/tasks/4"
        }
    }
}

Can't find what you're looking for? Please contact the Software team.