Learn how to use OVHcloud APIs and pair them with your applications.
The APIs available on https://api.us.ovhcloud.com/ allow you to purchase, manage, update, and configure OVHcloud products without using a graphical interface such as the Control Panel.
Requirements
-
have an active OVHcloud account and know its credentials
Topics
Instructions
NOTE: OVHcloud is providing you with services for which you are responsible, with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.
This guide is designed to assist you in common tasks as much as possible. Nevertheless, we recommend contacting a specialized service provider and/or the software publisher for the service if you encounter any difficulties.
Simple Use
Sign in to OVHcloud APIs
On the OVHcloud API page, click Explore the OVHcloud API
to view the list of APIs.
To use the APIs on your products, you must sign in to this site using your OVHcloud credentials.
- Click
Authentication
in the upper left. - Select
Login with OVHcloud SSO
.
- Enter your OVHcloud credentials and click
Login
.If you are a sub-user, enter your account ID (in the format XXXX-XXXX-XX/user) and password.
- Click
Authorize
.If your OVHcloud account is protected by two-factor authentication, you will also need to enter the code generated by SMS or OTP mobile application or U2F key.
Explore available APIs
You can see a list of OVHcloud products that can be managed with APIs in the upper-left corner. This list is sorted alphabetically.
For example, to view the Public Cloud APIs, click /cloud in the list.
After you click the product, a list of the product’s APIs appears below. There is also a Filter feature to limit the visible API calls.
Run API
There are four types of APIs available that use what are called HTTP methods:
GET
The GET method is used to retrieve data from a resource.
For example, to retrieve a list of your instances, use the following API:
GET /cloud/project/{serviceName}/instance
POST
The POST method is used to send additional data to the resource.
For example, to create a new instance, use the following API:
POST /cloud/project/{serviceName}/instance
PUT
The PUT method is used to replace the current data in the resource with the data in the query.
For example, to alter an instance in your project, use the following API:
PUT /cloud/project/{serviceName}/instance/{instanceId}
DELETE
The DELETE method is used to delete the called resource.
For example, to delete an instance from your project, use the following API:
DELETE /cloud/project/{serviceName}/instance/{instanceId}
API parameters
After you click the API you want, the REQUEST section allows you to assign variables for its application.
For example, when retrieving a list of instances in a project you must enter the serviceName and can also add information in the region variable.
Once you have set the parameters, you can launch the API by clicking TRY
.
The RESPONSE
tab below will give you the API execution report.
Scrolling down further will show you PHP
and Python
tabs containing the elements to be added to your script according to the language used.
Advanced usage: pair OVHcloud APIs with an application
Create your app keys
Any application that wants to communicate with the OVHcloud API must be declared in advance.
Use the following link: https://api.us.ovhcloud.com/createToken/.
Fill in:
- your OVHcloud Account ID (email address) and password
- a script name and description
- a Validity period
- the Rights you want to allow
*
) into the "path" field.Click the +
button to add additional rights to PUT, POST, and/or DELETE. Click the -
button to remove any of those rights.
Click Create keys
.
Use the following link: https://us.ovhcloud.com/auth/api/createToken.
Log in with your sub-user account ID (in the format XXXX-XXXX-XX/user) and password and click Login
.
Fill in:
- an application name and description
- a Validity period
- the Rights you want to allow
*
) into the "path" field.Click the +
button to add additional rights to PUT, POST, and/or DELETE. Click the -
button to remove any of those rights.
Click Create
.
The next screen will show you a set of three keys:
- the application key, or AK. For example:
- the application secret, or AS, is not to be disclosed. For example:
- the consumer key, or CK, is not to be disclosed. For example:
In this case, the CK key is attached to your account.
The CK token can be used for rights delegation.
First API usage
Once you have obtained your three keys (AK, AS, CK), you can sign API requests. The signature is calculated as follows:
To simplify the development of your applications, OVHcloud provides API wrappers in multiple languages. Using them will help you avoid worrying about signing requests so that you can focus on developing your application.
- Perl: https://api.us.ovhcloud.com/wrappers/OvhApi-perl-1.1.zip
- Python: https://github.com/ovh/python-ovh
- PHP: https://github.com/ovh/php-ovh
- Node.js: https://github.com/ovh/node-ovh
- Swift: https://github.com/ovh/swift-ovh
- C#: https://github.com/ovh/csharp-ovh
Here is an example of how to use the /me
section to manage your OVHcloud account:
List and revoke your keys
To see or revoke your keys, you must use the OVHcloud API.
- List the keys IDs: GET /me/api/application
- Get key details: GET /me/api/application/{applicationId}
- Revoke a key: DELETE /me/api/application/{applicationId}
Go further
For more information and tutorials, please see our other Manage and Operate support guides or explore the guides for other OVHcloud products and services.