Need help with govultr?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

161 Stars 33 Forks MIT License 677 Commits 2 Opened issues


Vultr Go API client

Services available


Need anything else?

Contributors list


Build Status PkgGoDev codecov Go Report Card

The official Vultr Go client - GoVultr allows you to interact with the Vultr V2 API.

GoVultr V1 that interacts with Vultr V1 API is now on the v1 branch


go get -u


Vultr uses a PAT (Personal Access token) to interact/authenticate with the APIs. Generate an API Key from the API menu in the Vultr Customer Portal.

To instantiate a GoVultr client, invoke

. You must pass your
to an
library to create the
, which configures the
header with your PAT as the
bearer api-key

The client has three optional parameters:

  • BaseUrl: Change the Vultr default base URL
  • UserAgent: Change the Vultr default UserAgent
  • RateLimit: Set a delay between calls. Vultr limits the rate of back-to-back calls. Use this parameter to avoid rate-limit errors.

Example Client Setup

package main

import ( "context" "os"

"" "" )

func main() { apiKey := os.Getenv("VultrAPIKey")

config := &oauth2.Config{} ctx := context.Background() ts := config.TokenSource(ctx, &oauth2.Token{AccessToken: apiKey}) vultrClient := govultr.NewClient(oauth2.NewClient(ctx, ts))

// Optional changes _ = vultrClient.SetBaseURL("") vultrClient.SetUserAgent("mycool-app") vultrClient.SetRateLimit(500) }

Example Usage

Create a VPS

instanceOptions := &govultr.InstanceCreateReq{
  Label:                "awesome-go-app",
  Hostname:             "",
  Backups:              "enabled",
  EnableIPv6:           BoolToBoolPtr(false),
  OsID:                 362,
  Plan:                 "vc2-1c-2gb",   
  Region:               "ewr",

res, err := vultrClient.Instance.Create(context.Background(), instanceOptions)

if err != nil { fmt.Println(err) }


GoVultr v2 introduces pagination for all list calls. Each list call returns a

struct containing the total amount of items in the list and next/previous links to navigate the paging.
// Meta represents the available pagination information
type Meta struct {
  Total int `json:"total"`
  Links *Links

// Links represent the next/previous cursor in your pagination calls type Links struct { Next string json:"next" Prev string json:"prev" }

Pass a

value to the
struct to adjust the number of items returned per call. The default is 100 items per page and max is 500 items per page.

This example demonstrates how to retrieve all of your instances, with one instance per page.

listOptions := &govultr.ListOptions{PerPage: 1}
for {
    i, meta, err := client.Instance.List(ctx, listOptions)
    if err != nil {
        return nil, err
    for _, v := range i {

if meta.Links.Next == "" {
} else {
    listOptions.Cursor = meta.Links.Next



This project follows SemVer for versioning. For the versions available, see the tags on this repository.


See our documentation for detailed information about API v2.

See our GoDoc documentation for more details about this client's functionality.


Feel free to send pull requests our way! Please see the contributing guidelines.


This project is licensed under the MIT License - see the file for details.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.