Skip to main content

The LIR Portal "My Resources" API

Introduction

The LIR Portal offers an API that allows you to fetch all information available about your Internet number resources in JSON and XML format. These are the data sets that are available:

  • Autonoumous System Numbers (ASNs)
  • IPv4 Allocations
  • IPv4 Assignments
  • IPv4 Legacy Resources
  • IPv6 Allocations
  • IPv6 Assignments

It is also possible to fetch various data sets grouped together, such as all information related to IPv4 in one overview. The output contains various details about your resources such as registration date, status, related ticket number and the link to the relevant RIPE Database object.

Creating an API Access Key

Because the information contained in My Resources is private for your LIR, it is only accessible through the API after creating an access key. In order to this, please follow these steps:

  1. Log into the LIR Portal with a user account that has administrator credentials
  2. Click the API Access Keys link in the Tools section
  3. Create a key for the My Resources API

Please note that the value of the key is displayed only once, when it is created, and the hashed value is stored in the database. You are responsible for maintaining your keys. You can create as many keys as you like and revoke unused keys as needed.

After creating an API Access Key, the management screen will allow you to select a data set and output format. After clicking the "Show me" button, you will get a sample curl request.

Fetching the data sets

Call URL Formatting

The main service URL for the My Resources API is:

https://lirportal.testlab.ripe.net/myresources/v1/resources

The URL is appended by the desired data set, the access key and the output format as follows:

Appending the desired data set:

Data set parameter

Autonomous System Numbers

/asn

IPv4 Allocations

/ipv4/allocations

IPv4 Assignments

/ipv4/assignments

IPv4 Legacy Resources

/ipv4/erxresources

All IPv4 information grouped

/ipv4

IPv6 Allocations

/ipv6/allocations

IPv6 Assignments

/ipv6/assignments

All IPv6 information grouped

/ipv6

All resource information grouped

<leave empty>

 Appending the output format:

&format=JSON
&format=XML

Appending the key:

They key can be passed to the request as a URL parameter or as a request header value. We strongly recommend using the header to pass the API Key, so that the key is not stored in any server logs.

--header 'ncc-api-authorization: <api-key>' 
or
?key=<api-key>

Call URL Example

If you would like to fetch an overview of all your IPv4 Allocations in JSON format, you would use the following curl command:
curl 'https://lirportal.ripe.net/myresources/v1/resources/ipv4/allocations?format=JSON' \
     --header 'ncc-api-authorization: b7f6d966-f33e-4617-b4d7-3b940eded779'

Data Format Samples

JSON:

{
    "ipv4Allocations": [
        {
            "prefix": "193.0.24.0/21",
            "registrationDate": "1993-09-01",
            "size": "2048",
            "status": "ALLOCATED_PA",
            "ticket": {
                "showTicketUrl": "http://www.ripe.net/cgi-bin/rttquery?ticnum=2012030284",
                "ticketNumber": "NCC#2012030284"
            },
            "whoisQueryUrl": "https://apps.db.ripe.net/whois/lookup/ripe/inetnum/193.0.24.0/21.json"
        }
    ],
    "regid": "nl.ripencc-ts"
}

XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<lir-resources regid="nl.ripencc-ts">
    <ipv4-allocations>
        <ipv4-allocation>
            <registration-date>1993-09-01</registration-date>
            <whois-query-url>https://apps.db.ripe.net/whois/lookup/ripe/inetnum/193.0.24.0/21.xml</whois-query-url>
            <ticket show-ticket-url="http://www.ripe.net/cgi-bin/rttquery?ticnum=2012030284" id="NCC#2012030284"/>
            <prefix>193.0.24.0/21</prefix>
            <size>2048</size>
            <status>ALLOCATED_PA</status>
        </ipv4-allocation>
    </ipv4-allocations>
</lir-resources>