Skip to content
Lua OVH module for OVH API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Lightweight wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing.

local OVH = require 'ovh-api'

local client = OVH.client(

-- Print nice welcome message


The easiest way to get the latest stable release is to grab it from `luarocks.

luarocks install ovh-api

Example Usage

Use the API on behalf of a user

1. Create an application

To interact with the APIs, the SDK needs to identify itself using an application_key and an application_secret. To get them, you need to register your application. Depending the API you plan yo use, visit:

Once created, you will obtain an application key (AK) and an application secret (AS).

2. Authorize your application to access a customer account

To allow your application to access a customer account using the API on your behalf, you need a consumer key (CK).

Here is a sample code you can use to allow your application to access a customer's informations:

local OVH = require 'ovh-api'

local client = OVH.client(

local data = client:request_consumerkey({
  { method = 'GET', path = '/*'},
  { method = 'POST', path = '/*'},
  { method = 'PUT', path = '/*'}

print('Your consumer key is: ''\n')
print('Visit '' to validate the consumer key\n')
print('Press enter when validated\n')
print('Welcome '..client:get('/me')['firstname'])

Returned consumerKey should then be kept to avoid re-authenticating your end-user on each use.


To request full and unlimited access to the API, you may use wildcards:

  { method = 'GET', path = '/*'},
  { method = 'POST', path = '/*'},
  { method = 'PUT', path = '/*'},
  { method = 'DELETE', path = '/*'}

List application authorized to access your account

Thanks to the application key / consumer key mechanism, it is possible to finely track applications having access to your data and revoke this access. This examples lists validated applications. It could easily be adapted to manage revocation too.

This example assumes an existing Configuration_ with valid API_KEY, SECRET_KEY and CONSUMER_KEY.

local OVH = require '../ovh'

-- Get configuration from environment variables
local END_POINT    = os.getenv("OVH_END_POINT")
local API_KEY      = os.getenv("OVH_API_KEY")
local SECRET_KEY   = os.getenv("OVH_SECRET_KEY")
local CONSUMER_KEY = os.getenv("OVH_CONSUMER_KEY")

local client = OVH.client(

local credentials = client:get('/me/api/credential', {status='validated'})

local text = 'List of validated credentials: \n'
for _, credentialId in pairs(credentials) do
  local url = '/me/api/credential/'..credentialId
  credential_data = client:get(url)
  credentail_app = client:get(url..'/application')

  local expiration = credential_data.expiration or ''
  local lastUse = credential_data.expiration or ''
  text = text..'Credential ID: '..credentialId..'\n'
    ..'Name: ''\n'
    ..'Description: '..credentail_app.description..'\n'
    ..'Status: '..credentail_app.status..'\n'
    ..'Creation: '..credential_data.creation..'\n'
    ..'Expiration: '..expiration..'\n'
    ..'Last Use: '..lastUse..'\n\n'


Supported APIs

OVH Europe

OVH North America

So you Start Europe

So you Start North America

Kimsufi Europe

Kimsufi North America


You can’t perform that action at this time.