v2
Log in Sign up

Vultr API (2.0)

Download OpenAPI specification:Download

Introduction

The Vultr API v2 is a set of HTTP endpoints that adhere to RESTful design principles and CRUD actions with predictable URIs. It uses standard HTTP response codes, authentication, and verbs. The API has consistent and well-formed JSON requests and responses with cursor-based pagination to simplify list handling. Error messages are descriptive and easy to understand. All functions of the Vultr customer portal are accessible via the API, enabling you to script complex unattended scenarios with any tool fluent in HTTP.

Requests

Communicate with the API by making an HTTP request at the correct endpoint. The chosen method determines the action taken.

Method Usage
DELETE Use the DELETE method to destroy a resource in your account. If it is not found, the operation will return a 4xx error and an appropriate message.
GET To retrieve information about a resource, use the GET method. The data is returned as a JSON object. GET methods are read-only and do not affect any resources.
PATCH Some resources support partial modification with PATCH, which modifies specific attributes without updating the entire object representation.
POST Issue a POST method to create a new object. Include all needed attributes in the request body encoded as JSON.
PUT Use the PUT method to update information about a resource. PUT will set new values on the item without regard to their current values.

Rate Limit: Vultr safeguards the API against bursts of incoming traffic based on the request's IP address to ensure stability for all users. If your application sends more than 30 requests per second, the API may return HTTP status code 429.

Response Codes

We use standard HTTP response codes to show the success or failure of requests. Response codes in the 2xx range indicate success, while codes in the 4xx range indicate an error, such as an authorization failure or a malformed request. All 4xx errors will return a JSON response object with an error attribute explaining the error. Codes in the 5xx range indicate a server-side problem preventing Vultr from fulfilling your request.

Response Description
200 OK The response contains your requested information.
201 Created Your request was accepted. The resource was created.
202 Accepted Your request was accepted. The resource was created or updated.
204 No Content Your request succeeded, there is no additional information returned.
400 Bad Request Your request was malformed.
401 Unauthorized You did not supply valid authentication credentials.
403 Forbidden You are not allowed to perform that action.
404 Not Found No results were found for your request.
429 Too Many Requests Your request exceeded the API rate limit.
500 Internal Server Error We were unable to perform the request due to server-side problems.

Meta and Pagination

Many API calls will return a meta object with paging information.

Definitions

Term Description
List All items available from your request.
Page A subset of a List. Choose the size of a Page with the per_page parameter.
Total The total attribute indicates the number of items in the full List.
Cursor Use the cursor query parameter to select a next or previous Page.
Next & Prev Use the next and prev attributes of the links meta object as cursor values.

How to use Paging

You can request paging by setting the per_page query parameter.

Paging Example

These examples have abbreviated attributes and sample values. Your actual cursor values will be encoded alphanumeric strings.

To return a Page with the first two Plans in the List:

curl "https://api.vultr.com/v2/plans?per_page=2" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

The API returns an object similar to this:

{
    "plans": [
        {
            "id": "vc2-1c-2gb",
            "vcpu_count": 1,
            "ram": 2048,
            "locations": []
        },
        {
            "id": "vc2-24c-97gb",
            "vcpu_count": 24,
            "ram": 98304,
            "locations": []
        }
    ],
    "meta": {
        "total": 19,
        "links": {
            "next": "WxYzExampleNext",
            "prev": "WxYzExamplePrev"
        }
    }
}

The object contains two plans. The total attribute indicates that 19 plans are available in the List. To navigate forward in the List, use the next value (WxYzExampleNext in this example) as your cursor query parameter.

curl "https://api.vultr.com/v2/plans?per_page=2&cursor=WxYzExampleNext" \
  -X GET
  -H "Authorization: Bearer ${VULTR_API_KEY}"

Likewise, you can use the example prev value WxYzExamplePrev to navigate backward.

Parameters

You can pass information to the API with three different types of parameters.

Path parameters

Some API calls require variable parameters as part of the endpoint path. For example, to retrieve information about a user, supply the user-id in the endpoint.

curl "https://api.vultr.com/v2/users/{user-id}" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

Query parameters

Some API calls allow filtering with query parameters. For example, the /v2/plans endpoint supports a type query parameter. Setting type=vhf instructs the API only to return High Frequency Compute plans in the list. You'll find more specifics about valid filters in the endpoint documentation below.

curl "https://api.vultr.com/v2/plans?type=vhf" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

You can also combine filtering with paging. Use the per_page parameter to retreive a subset of vhf plans.

curl "https://api.vultr.com/v2/plans?type=vhf&per_page=2" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

Request Body

PUT, POST, and PATCH methods may include an object in the request body with a content type of application/json. The documentation for each endpoint below has more information about the expected object.

API Example Conventions

The examples in this documentation use curl, a command-line HTTP client, to demonstrate useage. Linux and macOS computers usually have curl installed by default, and it's available for download on all popular platforms including Windows.

Each example is split across multiple lines with the \ character, which is compatible with a bash terminal. A typical example looks like this:

curl "https://api.vultr.com/v2/domains" \
  -X POST \
  -H "Authorization: Bearer ${VULTR_API_KEY}" \
  -H "Content-Type: application/json" \
  --data '{
    "domain" : "example.com",
    "ip" : "192.0.2.123"
  }'
  • The -X parameter sets the request method. For consistency, we show the method on all examples, even though it's not explicitly required for GET methods.
  • The -H lines set required HTTP headers. These examples are formatted to expand the VULTR_API_KEY environment variable for your convenience.
  • Examples that require a JSON object in the request body pass the required data via the --data parameter.

All values in this guide are examples. Do not rely on the OS or Plan IDs listed in this guide; use the appropriate endpoint to retreive values before creating resources.

Authentication

API Key

The Vultr API v2 uses API keys for authentication. You can manage your API keys in the Vultr customer portal. Please do not share API keys publicly, or embed them in client-side code. It is a good security practice to restrict their use by IP address in the customer portal.

To authenticate a request, send your API Key as a bearer token in the request header.

Authentication Example

curl "https://api.vultr.com/v2/account" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

Unauthenticated API requests will fail. All requests must use HTTPS encryption for security, and calls made with HTTP will fail.

Security Scheme Type HTTP
HTTP Authorization Scheme bearer

Account

Read-only information about your user account and billing information.

Get Account Info

Get your Vultr account, permission, and billing information.

Authorizations:

Responses

Request samples

curl "https://api.vultr.com/v2/account" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

Response samples

Content type
application/json
{
  • "account": {
    }
}

Applications

One-Click and Marketplace Applications are ready-to-run with minimal configuration. We have an extensive documentation library for our Applications.

There are two types of Applications: marketplace and one-click. This is denoted by the type field in the Application object. Applications with type of marketplace can be deployed by using the image_id while Applications with type of one-click should use the id.

List Applications

Get a list of all available Applications.

query Parameters
type
string

Filter the results by type.

Type Description
all All available application types
marketplace Marketplace applications
one-click Vultr One-Click applications
per_page
integer

Number of items requested per page. Default is 100 and Max is 500.

cursor
string

Cursor for paging. See Meta and Pagination.

Responses

Request samples

curl "https://api.vultr.com/v2/applications" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

Response samples

Content type
application/json
{
  • "applications": [
    ],
  • "meta": {
    }
}

Backups

A backup is a scheduled, automatic, point-in-time image of an instance. We do not stop the instance when taking a backup. Booting from a backup is similar to rebooting after a non-graceful restart. Snapshots are physically the same as backups, but snapshots are manual while backups run automatically on a schedule. Backups can be converted into snapshots. See our Automatic Backup FAQ for more information.

List Backups

Get information about Backups in your account.

Authorizations:
query Parameters
instance_id
string

Filter the backup list by Instance id.

per_page
integer

Number of items requested per page. Default is 100 and Max is 500.

cursor
string

Cursor for paging. See Meta and Pagination.

Responses

Request samples

curl "https://api.vultr.com/v2/backups" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

Response samples

Content type
application/json
{
  • "backups": [