Linode API - Get Started

Your gateway to everything Linode offers: Automate tasks in the Cloud Manager, create Linodes, manage IP addresses, and open support tickets using an intuitive REST API.

Create a Linode account to try this guide with a $100 credit.
This credit will be applied to any valid services used during your first 60 days.

Get an Access Token

Only authorized users can add Linodes and make changes to your account, and each request must be authenticated with an access token.

The easiest way to get a token is through the Cloud Manager.

Note
If you are building an application which needs to authenticate multiple users (for example, a custom interface to Linode’s infrastructure for your organization), you can set up an OAuth authentication flow to generate tokens for each user.

Create an API Token

  1. Log into the Cloud Manager.

  2. Click on your username at the top of the screen and select My Profile.

  3. Select the API Tokens tab:

  4. Click on Add a Personal Access Token and choose the access rights you want users authenticated with the new token to have.

  5. When you have finished, click Submit to generate an API token string. Copy the token and save it in a secure location. You will not be able to view the token through the Cloud Manager after closing the popup.

Authenticate Requests

  1. This token must be sent as a header on all requests to authenticated endpoints. The header should use the format:

    Authorization: Bearer <token-string>
    
  2. Store the token as a temporary shell variable to simplify repeated requests. Replace <token-string> in this example:

    TOKEN=<token-string>
    

Get Configuration Parameters

Specify the type, region, and image for the new Linode.

  1. Review the list of available images:

    curl https://api.linode.com/v4/images/ | json_pp
    

    Choose one of the images from the resulting list and make a note of the id field.

  2. Repeat this procedure to choose a type:

    curl https://api.linode.com/v4/linode/types/ | json_pp
    
  3. Choose a region:

    curl https://api.linode.com/v4/regions | json_pp
    

Build the Final Query

Replace the values in the command below with your chosen type, region, image, label, and a secure root password.

curl -X POST https://api.linode.com/v4/linode/instances \
-H "Authorization: Bearer $TOKEN" -H "Content-type: application/json" \
-d '{"type": "g5-standard-2", "region": "us-east", "image": "linode/debian9", "root_pass": "root_password", "label": "prod-1"}'

This page was originally published on


Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.