---
updatedAt: 2025-09-15T23:59:50.000Z
agentTools:
  projectIndex: https://developers.hivelocity.net/llms.txt
---

# Deploy a Server via API

Welcome to the Hivelocity API Quickstart Guide! As developers, we know how powerful APIs can be. In fact our entire company's infrastructure runs on a robust set of internal and external APIs. We know how important it is to be able to quickly get up and running with a new API, so this guide will walk you through the process needed to quickly deploy your first [Instant Dedicated Servers](https://developers.hivelocity.net/docs/instant) using the Hivelocity Bare Metal Cloud API.

## API Overview

The Hivelocity API allows you to purchase, deploy, and manage your Bare Metal machines and network resources within any Hivelocity data center in a straightforward, easy to use way using typical HTTP requests.

The endpoints conform to the OpenAPI Spec and we do our best to document them as thoroughly as possible. The docs and supporting tools are designed to allow easy access and modification of your infrastructure with minimal setup.

All API calls are authenticated by your [API Keys](https://developers.hivelocity.net/docs/api-keys) in the `X-API-KEY` header.

## Prereqs

This guide assumes you have completed the necessary steps to deploy a server through our API.  If not, follow the 4 simple steps below:

1. Create an account in the [Portal](https://my.hivelocity.net/sign-up).
2. Retrieve your [API Keys](https://developers.hivelocity.net/docs/api-keys).
3. Add a [Payment Method](https://developers.hivelocity.net/docs/billing).
4. Complete [Account Verification](https://developers.hivelocity.net/docs/account-verification).

> 📘 Having trouble getting started?
>
> If you have trouble completing the prereqs, open a chat or send an email to <sales@hivelocity.net> and our team would be happy to help.

# Deploy a Server

## Step 0: Setting $API\_KEY

This tutorial will be using `curl` commands via the command line.  If you'd like to be able to copy-paste the curl commands in this tutorial, you will have to set your [API Keys](https://developers.hivelocity.net/docs/api-keys) as the `$API_KEY` environment variable.  To set your the environment variable, run the following command after replacing `YOUR_API_KEY_HERE` with your Hivelocity API Key:

```
export API_KEY=YOUR_API_KEY_HERE
```

## Step 1: Choose your server

First, you need to select the [configuration](https://developers.hivelocity.net/docs/bare-metal-servers) you want to deploy and your desired [locations](https://developers.hivelocity.net/docs/locations).   We offer more <Glossary>configurations</Glossary> and more <Glossary>locations</Glossary> than any other bare metal cloud provider in the world, so you have a lot to choose from.

To get a list of available configurations - which we call *<Glossary>products</Glossary>* - and their respective locations - which we call *<Glossary>facilities</Glossary>* - make a `GET` request to the [/inventory/product](https://developers.hivelocity.net/reference/get_stock_resource) endpoint. This will return the available products along with the [facility codes](https://developers.hivelocity.net/docs/facilities#facility-codes)of where the servers are available.  To read more about how to customize this request, see [Facility Inventory](facilities#facility-reference).

```
curl -X 'GET' \
  'https://core.hivelocity.net/api/v2/inventory/product?location=MAIN&group_by=facility' \
  -H 'accept: application/json' \
  -H "X-API-KEY: $API_KEY"
```

From the returned products, choose one with a stock of `available` or `limited` and remember its `product_id`, as well as the location code. We will use them later. For example, you may want to deploy product id `501` into the facility with location code `TPA2.`

## Step 2: Provision a Server

Now that you know the server you want, starting a provision is easy. Just make a `POST` request to the [/bare-metal-devices](https://developers.hivelocity.net/reference/post_bare_metal_device_resource) endpoint with the following data in the request body:

* **productId**: The <Glossary>product</Glossary> ID you selected above
* **locationName:** The <Glossary>facility</Glossary> code you selected above
* **osName:** The name of one of the available [Operating Systems](https://developers.hivelocity.net/docs/operating-systems) options. For this demo we will use `Ubuntu 20.x`.
* **hostname:** A FQDN for your server.  This can be whatever you'd like it to be.
* **<Glossary>period</Glossary>:** Your desired [billing period](https://developers.hivelocity.net/docs/instant#billing). For this demo we will use `hourly`.

More optional deployment options are available such as [SSH Keys](https://developers.hivelocity.net/docs/ssh-keys), [Cloud-init](https://developers.hivelocity.net/docs/user-data) and [Custom iPXE](https://developers.hivelocity.net/docs/custom-ipxe). See the [API reference](https://developers.hivelocity.net/reference/post_device_id_bandwidth_resource) for a full list of options.

> 🚧 Account charges
>
> Running this command will result in charges on your account.  If you do not intend to keep the server for a long period of time, be sure to deploy with the `hourly` period selected in order to minimize charges.

```
curl -X POST \
-H "Content-Type: application/json" \
-H "X-API-KEY: $API_KEY" \
    -d '{ \
        "productId": 501, \
        "locationName": "TPA1", \
        "osName": "Ubuntu 20.x", \
        "hostname": "test.hostname.com", \
        "period": "hourly" \
    }' \
https://core.hivelocity.net/api/v2/bare-metal-devices
```

This will have kicked off the provisioning process and the returned data will include an `orderId`.  Remember this value for the last step.

## **Step 3: Access your Server**

Now that your server provisioning has started, all that is left to do is to wait for it to finish and get your initial login credentials.

> 📘 Provisioning time
>
> Most Linux based operating systems take \~7 minutes to provision. This time can be shorter or longer depening on the location, os, and other factors. Our engineering teams are constantly working to bring provisioning time down to 60 seconds or less.

### Getting provisioning status

To get the status of your device's provisioning you need to check your [Order](https://developers.hivelocity.net/docs/orders) by making a `GET` request to [/order/YOUR\_ORDER\_ID](https://developers.hivelocity.net/reference/get_order_resource) .  Replace `YOUR_ORDER_ID` with the `orderId` value you received from the previous step.

```
curl -X GET \
-H "Content-Type: application/json" \
-H "X-API-KEY: $API_KEY" \
https://core.hivelocity.net/api/v2/order/YOUR_ORDER_ID
```

When the returned `status`  is `complete` your server will be done provisioning.

### Getting your device ID and IP

Now that your provisioning is complete, it's time to retrieve your device and its login information. First, make a `GET` request to  `/device?orderId=YOUR_ORDER_ID` endpoint and replace `YOUR_ORDER_ID` with the `orderId` value you received from the previous step.

```
curl -X GET \
-H "Content-Type: application/json" \
-H "X-API-KEY: $API_KEY" \
https://core.hivelocity.net/api/v2/device?orderId=YOUR_ORDER_ID
```

This will return your new device.  Remember the `id` and `primary_ip`.  You can learn more about [initial credentials](https://developers.hivelocity.net/docs/instant#initial-login-credentials) and [IPs and Subnets](https://developers.hivelocity.net/docs/ips-and-subnets) on their respective pages.

### Getting your initial ssh credentials

Now that you have the device's `id`, you can make a `GET` request to `/device/YOUR_DEVICE_ID/initial-creds` to retrieve the initial login information.

```
curl -X GET \
-H "Content-Type: application/json" \
-H "X-API-KEY: $API_KEY" \
https://core.hivelocity.net/api/v2/device/YOUR_DEVICE_ID/initial-creds
```

This will return the SSH user, password, and port.

### Accessing your server over SSH for the first time

Using the `primary_ip` from above with these credentials, you will be able to access your server.  Here is an example ssh command to access the server:

```
ssh YOUR_USER@YOUR_PRIMARYIP -p YOUR_PORT
```

When prompted to add the server into your list of known hosts, select `yes`, then enter your password when prompted.

## Wrap Up

That's it!  You've now deployed and accessed a server with the Hivelocity Bare Metal Cloud API. If you want more practice, or if you want to start over and try a different product, you may want to [delete your server](https://developers.hivelocity.net/docs/instant#deleting-an-instant-server) that you just created.