Linode API v4.163.0
The Linode API provides the ability to programmatically manage the full range of Linode products and services.
This reference is designed to assist application developers and system administrators. Each endpoint includes descriptions, request syntax, and examples using standard HTTP requests. Response data is returned in JSON format.
This document was generated from our OpenAPI Specification. See the OpenAPI website for more information.
View our Changelog to see release notes on all changes made to our API.
Some endpoints are publicly accessible without requiring authentication. All endpoints affecting your Account, however, require either a Personal Access Token or OAuth authentication (when using third-party applications).
All scopes for the OAuth security model (defined below) apply to this security model as well.
|Security Scheme Type:||HTTP|
|HTTP Authorization Scheme||bearer|
If you only need to access the Linode API for personal use, we recommend that you create a personal access token. If you’re designing an application that can authenticate with an arbitrary Linode user, then you should use the OAuth 2.0 workflows presented in this section.
For a more detailed example of an OAuth 2.0 implementation, see our guide on How to Create an OAuth App with the Linode Python API Library.
- When creating the client, you’ll supply a
redirect_uri(referred to as the Callback URL in the Cloud Manager).
- The response from this endpoint will give you a
- Clients can be public or private, and are private by default. You can choose to make the client public when it is created.
- A private client is used with applications which can securely store the client secret (that is, the secret returned to you when you first created the client). For example, an application running on a secured server that only the developer has access to would use a private OAuth client. This is also called a confidential client in some OAuth documentation.
- A public client is used with applications where the client secret is not guaranteed to be secure. For example, a native app running on a user’s computer may not be able to keep the client secret safe, as a user could potentially inspect the source of the application. So, native apps or apps that run in a user’s browser should use a public client.
- Public and private clients follow different workflows, as described below.
The OAuth workflow is a series of exchanges between your third-party app and Linode. The workflow is used to authenticate a user before an application can start making API calls on the user’s behalf.
- With respect to the diagram in section 1.2 of RFC 6749, login.linode.com (referred to in this section as the login server) is the Resource Owner and the Authorization Server; api.linode.com (referred to here as the api server) is the Resource Server.
- The OAuth spec refers to the private and public workflows listed below as the authorization code flow and implicit flow.
|PRIVATE WORKFLOW||PUBLIC WORKFLOW|
|1. The user visits the application’s website and is directed to login with Linode.||1. The user visits the application’s website and is directed to login with Linode.|
|2. Your application then redirects the user to Linode’s login server with the client application’s ||2. Your application then redirects the user to Linode’s login server with the client application’s |
|3. The user logs into the login server with their username and password.||3. The user logs into the login server with their username and password.|
|4. The login server redirects the user to the specificed redirect URL with a temporary authorization ||4. The login server redirects the user back to your application with an OAuth |
|5. The application issues a POST request (see additional details below) to the login server with the exchange code, |
|6. The login server responds to the client application with a new OAuth |
|7. The |
The following information expands on steps 5 through 7 of the private workflow:
Once the user has logged into Linode and you have received an exchange code,
you will need to trade that exchange code for an
do this by making an HTTP POST request to the following address:
Make this request as
application/x-www-form-urlencoded or as
multipart/form-data and include the following parameters in the POST body:
|client_id||Your app’s client ID.|
|client_secret||Your app’s client secret.|
|code||The code you just received from the redirect.|
You’ll get a response like this:
Included in the response is an
access_token. With this token, you can proceed to make
authenticated HTTP requests to the API by adding this header to each request:
Authorization: Bearer 03d084436a6c91fbafd5c4b20c82e5056a2e9ce1635920c30dc8d81dc7a6665c
access_token is set to expire in two hours. To refresh access prior to expiration, make another request to the same URL with the following parameters in the POST body:
|grant_type||The grant type you’re using. Use “refresh_token” when refreshing access.|
|client_id||Your app’s client ID.|
|client_secret||Your app’s client secret.|
You’ll get another response with an updated
refresh_token, which can then be used to refresh access again.
|Security Scheme Type||OAuth 2.0|
Requests must be made over HTTPS to ensure transactions are encrypted. Data included in requests must be supplied in json format unless otherwise specified in the command description.
The following request methods are supported:
|GET||Retrieves data about collections and individual resources.|
|POST||For collections, creates a new resource of that type. Also used to perform actions on action endpoints.|
|PUT||Updates an existing resource.|
|DELETE||Deletes a resource. This is a destructive action.|
|HEAD||Returns only the response header information of a GET request|
|OPTIONS||Provides permitted communication options for a command|
Actions will return one of the following HTTP response status codes:
|200 OK||The request was successful.|
|202 Accepted||The request was successful, but processing has not been completed. The response body includes a “warnings” array containing the details of incomplete processes.|
|204 No Content||The server successfully fulfilled the request and there is no additional content to send.|
|299 Deprecated||The request was successful, but involved a deprecated endpoint. The response body includes a “warnings” array containing warning messages.|
|400 Bad Request||You submitted an invalid request (missing parameters, etc.).|
|401 Unauthorized||You failed to authenticate for this resource.|
|403 Forbidden||You are authenticated, but don’t have permission to do this.|
|404 Not Found||The resource you’re requesting does not exist.|
|429 Too Many Requests||You’ve hit a rate limit.|
|500 Internal Server Error||Please open a Support Ticket.|
There are many ways to access response header information for individual command URLs, depending on how you are accessing the Linode API. For example, to view HTTP response headers for the
/regions endpoint when making requests with
curl, use the
--head option as follows:
Responses may include the following headers:
|Access-Control-Allow-Headers||All permissible request headers for this endpoint.||Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter|
|Access-Control-Allow-Methods||Permissible HTTP methods for this endpoint||HEAD, GET, OPTIONS, POST, PUT, DELETE|
|Access-Control-Allow-Origin||Indicates origin access permissions. The wildcard character ||*|
|Access-Control-Expose-Headers||Available headers to include in response to cross-origin requests.||X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status|
|Cache-Control||Controls caching in browsers and shared caches such as CDNs.||private, max-age=60, s-maxage=60|
|Content-Security-Policy||Controls which resources are allowed to load. By default, resources do not load.||default-src ’none'|
|Content-Type||All responses are in json format.||application/json|
|Content-Warning||A message containing instructions for successful requests that were not able to be completed.||Please contact support for assistance.|
|Retry-After||The remaining time in seconds until the current rate limit window resets.||60|
|Strict-Transport-Security||Enforces HTTPS-only access until the returned time in seconds.||max-age=31536000|
|Vary||Optional request headers that affected the response content.||Authorization, X-Filter|
|X-Accepted-OAuth-Scopes||Required scopes for accessing the requested command.||linodes:read_only|
|X-Customer-UUID||A unique identifier for the account owning the the personal access token that was used for the request.||ABCDEF01-3456-789A-BCDEF0123456789A|
|X-OAuth-Scopes||Allowed scopes associated with the personal access token that was used for the request. A value of ||images:read_write linodes:read_only|
|X-RateLimit-Limit||The maximum number of permitted requests during the rate limit window for this endpoint.||800|
|X-RateLimit-Remaining||The remaining number of permitted requests in the current rate limit window.||798|
|X-RateLimit-Reset||The time when the current rate limit window rests in UTC epoch seconds.||1674747739|
|X-Spec-Version||The current API version that handled the request.||4.150.0|
Success is indicated via Standard HTTP status codes.
2xx codes indicate success,
4xx codes indicate a request error, and
5xx errors indicate a server error. A
request error might be an invalid input, a required parameter being omitted,
or a malformed request. A server error means something went wrong processing
your request. If this occurs, please
open a Support Ticket
and let us know. Though errors are logged and we work quickly to resolve issues,
opening a ticket and providing us with reproducable steps and data is always helpful.
errors field is an array of the things that went wrong with your request.
We will try to include as many of the problems in the response as possible,
but it’s conceivable that fixing these errors and resubmitting may result in
new errors coming back once we are able to get further along in the process
of handling your request.
Within each error object, the
field parameter will be included if the error
pertains to a specific field in the JSON you’ve submitted. This will be
omitted if there is no relevant field. The
reason is a human-readable
explanation of the error, and will always be included.
Resource lists are always paginated. The response will look similar to this:
Pages start at 1. You may retrieve a specific page of results by adding
?page=xto your URL (for example,
?page=4). If the value of
2^64/page_size, the last possible page will be returned.
Page sizes default to 100, and can be set to return between 25 and 500. Page size can be set using
Collections are searchable by fields they include, marked in the spec as
x-linode-filterable: true. Filters are passed
X-Filter header and are formatted as JSON objects. Here is a request
call for Linode Types in our “standard” class:
The filter object’s keys are the keys of the object you’re filtering, and the values are accepted values. You can add multiple filters by including more than one key. For example, filtering for “standard” Linode Types that offer one vcpu:
In the above example, both filters are combined with an “and” operation. However, if you wanted either Types with one vcpu or Types in our “standard” class, you can add an operator:
Each filter in the
+or array is its own filter object, and all conditions
in it are combined with an “and” operation as they were in the previous example.
Other operators are also available. Operators are keys of a Filter JSON object. Their value must be of the appropriate type, and they are evaluated as described below:
|+and||array||All conditions must be true.|
|+or||array||One condition must be true.|
|+gt||number||Value must be greater than number.|
|+gte||number||Value must be greater than or equal to number.|
|+lt||number||Value must be less than number.|
|+lte||number||Value must be less than or equal to number.|
|+contains||string||Given string must be in the value.|
|+neq||string||Does not equal the value.|
|+order_by||string||Attribute to order the results by - must be filterable.|
|+order||string||Either “asc” or “desc”. Defaults to “asc”. Requires |
For example, filtering for Linode Types that offer memory equal to or higher than 61440:
You can combine and nest operators to construct arbitrarily-complex queries.
For example, give me all Linode Types
which are either
highmem class, or
have between 12 and 20 vcpus:
All times returned by the API are in UTC, regardless of the timezone configured within your user’s profile (see
timezone property within Profile View).
Rate limits on API requests help maintain the health and stability of the Linode API. Accordingly, every endpoint of the Linode API applies a rate limit on a per user basis as determined by OAuth token for authenticated requests or IP address for public endpoints.
Each rate limit consists of a total number of requests and a time window. For example, if an endpoint has a rate limit of 800 requests per minute, then up to 800 requests over a one minute window are permitted. Subsequent requests to an endpoint after hitting a rate limit return a 429 error. You can successfully remake requests to that endpoint after the rate limit window resets.
With the Linode API, you can generally make up to 1,600 general API requests every two minutes. Additionally, all endpoints have a rate limit of 800 requests per minute unless otherwise specified below.
Note: There may be rate limiting applied at other levels outside of the API, for example, at the load balancer.
Creating Linodes has a dedicated rate limit of 10 requests per 30 seconds. That endpoint is:
Creating Volumes has a dedicated rate limit of 25 requests per minute. That endpoint is:
/stats endpoints have their own dedicated rate limits of 100 requests per minute. These endpoints are:
- View Linode Statistics
- View Linode Statistics (year/month)
- View NodeBalancer Statistics
- List Managed Stats
Object Storage endpoints have a dedicated rate limit of 750 requests per second. The Object Storage endpoints are:
Opening Support Tickets has a dedicated rate limit of 2 requests per minute. That endpoint is:
Accepting Service Transfers has a dedicated rate limit of 2 requests per minute. That endpoint is:
The Linode API includes the following HTTP response headers which are designed to help you avoid hitting rate limits which might disrupt your applications:
- X-RateLimit-Limit: The maximum number of permitted requests during the rate limit window for this endpoint.
- X-RateLimit-Remaining: The remaining number of permitted requests in the current rate limit window.
- X-RateLimit-Reset: The time when the current rate limit window rests in UTC epoch seconds.
- Retry-After: The remaining time in seconds until the current rate limit window resets.
The Linode CLI allows you to easily work with the API using intuitive and simple syntax. It requires a Personal Access Token for authentication, and gives you access to all of the features and functionality of the Linode API that are documented here with CLI examples.
Endpoints that do not have CLI examples are currently unavailable through the CLI, but can be accessed via other methods such as Shell commands and other third-party applications.