# Packages

### ListPackages (GET /:login/packages) <a href="#listpackages" id="listpackages"></a>

Provides a list of packages available in this datacenter.

#### Inputs <a href="#inputs-38" id="inputs-38"></a>

* The following are all optional inputs:

| **Field**      | **Type** | **Description**                                            |
| -------------- | -------- | ---------------------------------------------------------- |
| name           | String   | The "friendly" name for this package                       |
| memory         | Number   | How much memory will by available (in MiB)                 |
| disk           | Number   | How much disk space will be available (in MiB)             |
| swap           | Number   | How much swap space will be available (in MiB)             |
| lwps           | Number   | Maximum number of light-weight processes (threads) allowed |
| vcpus          | Number   | Number of vCPUs for this package                           |
| version        | String   | The version of this package                                |
| group          | String   | The group this package belongs to                          |
| flexible\_disk | Boolean  | Whether this is a flexible\_disk package                   |

When any values are provided for one or more of the aforementioned inputs, the retrieved packages will match all of them.

When querying, wildcards (i.e. '*') are allowed for string fields. For example, to list all packages with a name that starts with "foo", give "foo*" as the package name.

#### Returns <a href="#returns-38" id="returns-38"></a>

An array of objects, of the form:

| **Field**      | **Type** | **Description**                                                         |
| -------------- | -------- | ----------------------------------------------------------------------- |
| id             | UUID     | Unique id for this package                                              |
| name           | String   | The "friendly" name for this package                                    |
| memory         | Number   | How much memory will by available (in MiB)                              |
| disk           | Number   | How much disk space will be available (in MiB)                          |
| swap           | Number   | How much swap space will be available (in MiB)                          |
| lwps           | Number   | Maximum number of light-weight processes (threads) allowed              |
| vcpus          | Number   | Number of vCPUs for this package                                        |
| version        | String   | The version of this package                                             |
| group          | String   | The group this package belongs to                                       |
| description    | String   | A human-friendly description about this package                         |
| disks          | Array    | The disks this package contains (Allowed when flexible\_disk is `true`) |
| flexible\_disk | Boolean  | Whether this is a flexible\_disk package (bhyve only)                   |
| default        | Boolean  | (deprecated) Whether this is the default package in this datacenter     |

#### Errors <a href="#errors-38" id="errors-38"></a>

For all possible errors, see [CloudAPI HTTP Responses](https://apidocs.joyent.com/cloudapi/#cloudapi-http-responses).

| **Error Code**   | **Description**            |
| ---------------- | -------------------------- |
| ResourceNotFound | If `:login` does not exist |

#### CLI Command <a href="#cli-command-37" id="cli-command-37"></a>

```
triton package list
```

or

```
sdc-listpackages
```

#### Example Request <a href="#example-request-32" id="example-request-32"></a>

```
GET /my/packages HTTP/1.1
Host: api.example.com
Authorization: ...
Accept: application/json
Api-Version: ~8
```

#### Example Response <a href="#example-response-32" id="example-response-32"></a>

```
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 314
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: u0+0E3G28WL4Y4K8p6+pIg==
Date: Thu, 21 Jan 2016 08:33:52 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: b24219e0-c019-11e5-99e1-8339f3270a9f
Response-Time: 1992

[
  {
    "id": "7b17343c-94af-6266-e0e8-893a3b9993d0",
    "name": "sdc_128",
    "memory": 128,
    "disk": 12288,
    "swap": 256,
    "vcpus": 1,
    "lwps": 1000,
    "default": false,
    "version": "1.0.0"
  },
  ...
]
```

### GetPackage (GET /:login/packages/:id) <a href="#getpackage" id="getpackage"></a>

Gets a package by `name` or `id`.

#### Inputs <a href="#inputs-39" id="inputs-39"></a>

* None

#### Returns <a href="#returns-39" id="returns-39"></a>

| **Field**      | **Type** | **Description**                                                         |
| -------------- | -------- | ----------------------------------------------------------------------- |
| id             | UUID     | Unique id for this package                                              |
| name           | String   | The "friendly" name for this package                                    |
| memory         | Number   | How much memory will by available (in MiB)                              |
| disk           | Number   | How much disk space will be available (in MiB)                          |
| swap           | Number   | How much swap space will be available (in MiB)                          |
| lwps           | Number   | Maximum number of light-weight processes (threads) allowed              |
| vcpus          | Number   | Number of vCPUs for this package                                        |
| version        | String   | The version of this package                                             |
| group          | String   | The group this package belongs to                                       |
| description    | String   | A human-friendly description about this package                         |
| disks          | Array    | The disks this package contains (Allowed when flexible\_disk is `true`) |
| flexible\_disk | Boolean  | Whether this is a flexible\_disk package (bhyve only)                   |
| default        | Boolean  | (deprecated) Whether this is the default package in this datacenter     |

#### Errors <a href="#errors-39" id="errors-39"></a>

For all possible errors, see [CloudAPI HTTP Responses](https://apidocs.joyent.com/cloudapi/#cloudapi-http-responses).

| **Error Code**   | **Description**                     |
| ---------------- | ----------------------------------- |
| ResourceNotFound | If `:login` or `:id` does not exist |

#### CLI Command <a href="#cli-command-38" id="cli-command-38"></a>

```
triton package get 7b17343c-94af-6266-e0e8-893a3b9993d0
```

or

```
sdc-getpackage 7b17343c-94af-6266-e0e8-893a3b9993d0
```

#### Example Request <a href="#example-request-33" id="example-request-33"></a>

```
GET /my/packages/7b17343c-94af-6266-e0e8-893a3b9993d0 HTTP/1.1
Host: api.example.com
Authorization: ...
Accept: application/json
Api-Version: ~8
```

#### Example Response <a href="#example-response-33" id="example-response-33"></a>

```
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 156
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Api-Version, Response-Time
Access-Control-Allow-Methods: GET, HEAD
Access-Control-Expose-Headers: Api-Version, Request-Id, Response-Time
Connection: Keep-Alive
Content-MD5: MEUpS89GsEaHBykatBp5rg==
Date: Thu, 21 Jan 2016 08:37:04 GMT
Server: Joyent Triton 8.0.0
Api-Version: 8.0.0
Request-Id: 253dd4c0-c01a-11e5-b5f9-2b49303f7fc4
Response-Time: 1482

{
  "id": "7b17343c-94af-6266-e0e8-893a3b9993d0",
  "name": "sdc_128",
  "memory": 128,
  "disk": 12288,
  "swap": 256,
  "vcpus": 1,
  "lwps": 1000,
  "default": false,
  "version": "1.0.0"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mnx.io/cloudapi/api-details/packages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
