LibreAPI: Documentation

LibreAPI is an open-source initiative to allow universal and fast access to Chilean data and services. It’s provided free of charge without limitations, and it’s financed through community donations.

A modified version of the JSend specification by OmnitiLabs is used as a base for all the requests and interactions of API.

We thank user "laurencee9" on GitHub for creating the template used by this documentation.

Warning: LibreAPI only supports HTTPS conections. HTTP connections will be redirected.


RUT

The /rut endpoint provieds tools to work with RUTs.

  • Validate RUTs
  • Format RUTs
  • Fetch the personal or business name associated with a RUT
  • Identify the economic activities associated with a RUT

Fetch name and economic activities

GET /rut/activities

Utilizes a database provided by the Servicio de Impuestos Internos (SII) to determine the name and economic activities associated with a RUT. If no record is found the name field will be an empty string and the activities field will be null.

Parameters

rut: RUT number with verifying digit, with or without separators

Response

{
    "data": {
        "activities": [
            {
                "name": "Otras Actividades Profesionales, Cientificas Y Tecnicas N.C.P.",
                "code": 749009,
                "category": "Segunda",
                "subject_to_vat": false,
                "date": "2018-03-29T00:00:00Z"
            }
        ],
        "name": "Juán Gómez Godoy",
        "rut": "12.345.678-5"
    },
    "status": "success"
}

Calculate the verifying digit

GET /rut/digit

Utilizes the “mod 11 method” to calculate the RUT’s verifying digit.

Parameters

rut: RUT number without verifying digit, with or without separators

Response

{
    "data": {
        "digit": "5",
        "rut": "12.345.678-5"
    },
    "status": "success"
}

Validate a RUT

GET /rut/validate

Utilizes the “mod 11 method” to check the validity of a RUT by calculating it’s verifying digit.

Warning: A valid RUT is not guaranteed to exist (see Fetch name and economic activities).

Parameters

rut: RUT number with verifying digit, with or without separators

Response

{
    "data": {
        "rut": "12.345.678-5",
        "valid": true
    },
    "status": "success"
}

Economy

The /economy endpoint makes available economic indicators, currency conversion rates, and crypto coins values.

  • Check the daily economic indicators report
  • See the conversion rate of international currencies to the peso
  • Fetch current statistics about crypto coins and their conversion rate to the peso

Get data on cryptocurrencies

GET /economy/crypto

Fetches the CoinMarketCap database, and provides statistics on the price changes, value, market cap and volume of crypto coins.

An optional parameter name might be used to filter the results. The currency’s name or symbol can be used.

Parameters

name: Optional. Name or symbol to filter the coins. 

Response

{
    "data": [
        {
            "name": "Bitcoin",
            "symbol": "BTC",
            "market_cap_usd": 737913344755,
            "price_usd": 39685.7,
            "price_clp": 27628390.625999995,
            "supply": 18593937,
            "volume_usd": 84677658651,
            "hourly_change": 2,
            "daily_change": 10.06,
            "weekley_change": 36.57
        },
        {
            "name": "Ethereum",
            "symbol": "ETH",
            "market_cap_usd": 143123923761,
            "price_usd": 1253.73,
            "price_clp": 872821.7514,
            "supply": 114158693,
            "volume_usd": 40524775118,
            "hourly_change": 1.08,
            "daily_change": 5.77,
            "weekley_change": 69.74
        },
        (....)
    ],
    "status": "success"
}

Fetch conversion rates

GET /economy/currencies

Fetches the Central Bank’s (Banco Central) data on current conversion rates of international currencies to peso.

The optional parameter name might be used to fuzzy-search for currencies. Both the currency’s name or ISO 4217 symbol can be used.

Parameters

name: Optional. Name or ISO 4217 symbol of the currency.

Response

{
    "data": [
        {
            "Name": "Baht tailandés",
            "ISO4217": "THB",
            "ExchangeRate": 29.93
        },
        {
            "Name": "Bolívar fuerte venezolano",
            "ISO4217": "VEF",
            "ExchangeRate": 1172055.1331
        },
        (...)
    ],
    "status": "success"
}

Fetch economic indicators

GET /economy/indicators

Generates a report of economic indicators as provided by the Central Bank of Chile (Banco Central). It includes the current conversion rate of the dollar, the value of the copper ounce, and the value of the UF among others.

Parameters

Response

{
    "data": {
        "uf": 29063.76,
        "ivp": 30244.83,
        "dolar": 696.18,
        "euro": 856.2,
        "itcnm": 856.2,
        "ozt_silver": 26.92,
        "ozt_gold": 1903.54,
        "lb_copper": 3.63
    },
    "status": "success"
}

Weather

The /weather provides access to the data from the Chilean Directorate of Meteorology (Dirección Meteorológica de Chile).

  • See the maximum y minimum temperatures of the last two days
  • Fetch data about precipitations on the last two days
  • Get data on precipitations, temperatures, humidity, and pressure from the meteorological stations around Chile.

List meteorological stations

GET /weather/stations

Gets real-time data from the Chilean Directorate of Meteorology (Dirección Meteorológica de Chile) on the status and readings of the meteorological stations around Chile.

An optional parameter name might be used to filter the stations by name, or the parameter code to filter by code. The two filters might not be used at the same time.

Parameters

name: Optional. Name of the station. Can't be used in conjunction with `code`.
code: Optional. Code of the station. Can't be used in conjunction with `name`.

Response

{
    "data": [
        {
            "code": 180017,
            "name": "Putre",
            "operational": true,
            "last_report": "2021-01-07T20:00:00-03:00",
            "temperature": 6.3,
            "humidity": 1,
            "presure_hpas": 669.6,
            "today": {
                "maximum": {
                    "time": "2021-01-07T11:34:00-03:00",
                    "temperature": 10.6
                },
                "minimum": {
                    "time": "2021-01-07T05:55:00-03:00",
                    "temperature": 3.8
                },
                "precipitations": {
                    "sum": 0,
                    "ema": 0
                }
            },
            "yesterday": {
                "maximum": {
                    "time": "2021-01-06T13:31:00-03:00",
                    "temperature": 10.6
                },
                "minimum": {
                    "time": "2021-01-06T06:53:00-03:00",
                    "temperature": 2.5
                },
                "precipitations": {
                    "sum": 0,
                    "ema": 0
                }
            }
        },
        (...)
    ],
    "status": "success"
}

Errors

If an error is encountered during the request, the response code will indicate the general problem, while the body of the response will contain a detailed explanation of the error in the errors field. The status field will be fail if a problem was encountered while parsing the request and error if an error occurred on the server-side.

400 Bad Request
{
    "errors": {
        "rut": "no rut was provided"
    },
    "status": "fail"
}