Skip to main content

The LIR Portal "IP Analyser" API

Introduction

The LIR Portal offers an API that allows you to fetch specific information about your Internet number resources. You can get a plain text report or all information in JSON format, containing the following data sets:

  • An overview of all your assignments
  • An overview of available free space in your allocations
  • An overview of all invalid assignments that require your attention

IPv4 data is available in JSON format and plain text. The plain text format is the same as that used by the 'asused' tool. IPv6 data is only available in JSON format and does not display invalid assignments at this time.

When you query the API, data is fetched from the RIPE Database in real time, so it may take some time for results to be returned, especially for larger LIRs. Returned data is cached for five minutes, so if you make a change in the RIPE Database immediately after querying the API, please allow the cache to expire before querying again to see your changes.

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 do this, please follow these steps:

  1. Log in to 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 IP Analyser 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 IP Analyser API is:

https://lirportal.ripe.net/ipanalyser/v1

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

Appending the desired data set:

Data set parameter

IPv4

/ipv4

IPv6

/ipv6

Appending the output format (IPv6 is only available in JSON):

&format=plain
&format=JSON

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 Examples

Overview of all IPv4 resource information in plain text:

curl 'https://lirportal.ripe.net/ipanalyser/v1/ipv4?&format=plain' \
     --header 'ncc-api-authorization: b7f6d966-f33e-4617-b4d7-3b940eded779'

Overview of all IPv6 resource information in JSON format:

curl 'https://lirportal.ripe.net/ipanalyser/v1/ipv6?&format=JSON' \
--header 'ncc-api-authorization: b7f6d966-f33e-4617-b4d7-3b940eded779