> ## Documentation Index
> Fetch the complete documentation index at: https://plivo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Powerpack

> Manage Powerpacks for intelligent number pooling and traffic distribution

Powerpack APIs let you manage all of the Powerpacks and number pools in your account via an API request. Powerpacks enable intelligent number pooling with features like Sticky Sender and Local Connect for optimized message delivery.

## API Endpoint

```
https://api.plivo.com/v1/Account/{auth_id}/Powerpack/
```

***

## The Powerpack Object

### Attributes

<ParamField body="uuid" type="string">
  Unique identifier for the Powerpack.
</ParamField>

<ParamField body="name" type="string">
  The name of the Powerpack. Must be unique across all Powerpacks in your account.
</ParamField>

<ParamField body="sticky_sender" type="boolean">
  Whether Sticky Sender is enabled. Sticky Sender ensures messages to a particular destination number are always sent from the same source number. Defaults to `true`.
</ParamField>

<ParamField body="local_connect" type="boolean">
  Whether Local Connect is enabled. Local Connect prioritizes local numbers matched on area code and state over other numbers in the pool. Defaults to `true`.
</ParamField>

<ParamField body="application_type" type="string">
  The type of application connected to this Powerpack. Allowed values: `xml`, `phlo`.
</ParamField>

<ParamField body="application_id" type="string">
  The ID of the PHLO or XML application associated with this Powerpack.
</ParamField>

<ParamField body="number_pool" type="string">
  The URL path to the number pool associated with this Powerpack.
</ParamField>

<ParamField body="number_priority" type="array">
  An array of number priority configurations specifying the order in which number types should be used for sending messages, organized by country and service type.
</ParamField>

<ParamField body="created_on" type="string">
  The timestamp when the Powerpack was created, in UTC format.
</ParamField>

### Example Powerpack Object

```json theme={null}
{
  "api_id": "8b583f08-ae57-11eb-8840-0242ac110003",
  "application_id": "",
  "application_type": "",
  "created_on": "2020-09-23T09:31:25.924044Z",
  "local_connect": true,
  "name": "my_powerpack",
  "number_pool": "/v1/Account/MAXXXXXXXXXX/NumberPool/abc123-def456/",
  "number_priority": [
    {
      "country_iso": "US",
      "priority": {
        "priority1": "shortcode",
        "priority2": "tollfree",
        "priority3": "longcode"
      },
      "service_type": "SMS"
    }
  ],
  "sticky_sender": true,
  "uuid": "abc123-def456-ghi789"
}
```

***

## List All Powerpacks

Fetches a list of all Powerpacks in your account.

```
GET https://api.plivo.com/v1/Account/{auth_id}/Powerpack/
```

### Arguments

<ParamField query="limit" type="integer">
  The number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20.
</ParamField>

<ParamField query="offset" type="integer">
  The number of value items by which the results should be offset. Defaults to 0. Read more about [offset-based pagination](/messaging/api/request/pagination).
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/?limit=20&offset=0' \
      -u '<auth_id>:<auth_token>'
  ```

  ```python Python theme={null}
  import plivo

  client = plivo.RestClient('<auth_id>', '<auth_token>')
  response = client.powerpacks.list(offset=0, limit=20)
  print(response)
  ```

  ```javascript Node.js theme={null}
  const plivo = require('plivo');

  const client = new plivo.Client("<auth_id>", "<auth_token>");

  client.powerpacks.list({ limit: 20, offset: 0 })
      .then(result => console.log(result))
      .catch(error => console.log(error));
  ```

  ```ruby Ruby theme={null}
  require 'plivo'

  api = Plivo::RestClient.new("<auth_id>", "<auth_token>")
  response = api.powerpacks.list(offset: 0, limit: 20)
  puts response
  ```
</CodeGroup>

### Response

The response includes a `meta` field with pagination information:

* `limit`: The size of the page returned
* `offset`: The offset for the page returned
* `total_count`: The total number of records matching the filters
* `next`: URL pointing to the next page of results
* `previous`: URL pointing to the previous page of results

```json theme={null}
{
  "api_id": "e44c159e-0a02-11ea-b072-0242ac110007",
  "meta": {
    "limit": 20,
    "next": "/api/v1/account/MAXXXXXXXXXX/Powerpack?offset=20&limit=20",
    "offset": 0,
    "total_count": 53
  },
  "objects": [
    {
      "application_id": "",
      "application_type": "",
      "created_on": "2020-10-09T11:10:59.666461Z",
      "local_connect": true,
      "name": "powerpack_one",
      "number_pool": "/v1/Account/MAXXXXXXXXXX/NumberPool/abc123/",
      "sticky_sender": true,
      "uuid": "abc123-def456"
    },
    {
      "application_id": "",
      "application_type": "",
      "created_on": "2020-10-09T17:03:31.837944Z",
      "local_connect": false,
      "name": "powerpack_two",
      "number_pool": "/v1/Account/MAXXXXXXXXXX/NumberPool/def456/",
      "sticky_sender": false,
      "uuid": "def456-ghi789"
    }
  ]
}
```

***

## Retrieve a Powerpack

Retrieves the details of a specific Powerpack.

```
GET https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/
```

### Arguments

<ParamField path="powerpack_uuid" type="string" required>
  The unique identifier of the Powerpack to retrieve. Specified in the request URL.
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/<powerpack_uuid>/' \
      -u '<auth_id>:<auth_token>'
  ```

  ```python Python theme={null}
  import plivo

  client = plivo.RestClient('<auth_id>', '<auth_token>')
  powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")
  print(powerpack)
  ```

  ```javascript Node.js theme={null}
  const plivo = require('plivo');

  const client = new plivo.Client("<auth_id>", "<auth_token>");

  client.powerpacks.get("<powerpack_uuid>")
      .then(result => console.log(result))
      .catch(error => console.log(error));
  ```

  ```ruby Ruby theme={null}
  require 'plivo'

  api = Plivo::RestClient.new("<auth_id>", "<auth_token>")
  response = api.powerpacks.get(uuid: '<powerpack_uuid>')
  puts response
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "api_id": "8b583f08-ae57-11eb-8840-0242ac110003",
  "application_id": "",
  "application_type": "",
  "created_on": "2020-09-23T09:31:25.924044Z",
  "local_connect": true,
  "name": "my_powerpack",
  "number_pool": "/v1/Account/MAXXXXXXXXXX/NumberPool/abc123-def456/",
  "number_priority": [
    {
      "country_iso": "US",
      "priority": {
        "priority1": "shortcode",
        "priority2": "tollfree",
        "priority3": "longcode"
      },
      "service_type": "SMS"
    }
  ],
  "sticky_sender": true,
  "uuid": "abc123-def456-ghi789"
}
```

***

## Create a Powerpack

Create a new Powerpack for intelligent number pooling and traffic distribution.

```
POST https://api.plivo.com/v1/Account/{auth_id}/Powerpack/
```

### Arguments

<ParamField body="name" type="string" required>
  Must be unique across all Powerpacks in your account.
</ParamField>

<ParamField body="sticky_sender" type="boolean">
  Whether [Sticky Sender](/messaging/concepts/powerpack/#sticky-sender) should be enabled. Sticky Sender ensures messages to a particular destination number are always sent from the same source number. Defaults to `true`.
</ParamField>

<ParamField body="local_connect" type="boolean">
  Whether [Local Connect](/messaging/concepts/powerpack/#local-connect) should be enabled. Local Connect prioritizes local numbers matched on area code and state over other numbers in the pool. Defaults to `true`.
</ParamField>

<ParamField body="application_type" type="string">
  **Conditional** - Must be specified if `application_id` is specified. Allowed values: `xml`, `phlo`.
</ParamField>

<ParamField body="application_id" type="string">
  Must be set to a valid PHLO or XML App ID or `"none"`. If not specified (or set to `"none"`), no application will be associated with phone numbers added to this Powerpack.
</ParamField>

<ParamField body="number_priority" type="array">
  An array of number priority configurations. Each object contains `country_iso`, `service_type`, and `priority` with `priority1`, `priority2`, and `priority3` values.
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/' \
      -H 'Content-Type: application/json' \
      -u '<auth_id>:<auth_token>' \
      -d '{
          "name": "my_powerpack",
          "sticky_sender": true,
          "local_connect": true,
          "number_priority": [{
              "country_iso": "US",
              "priority": {
                  "priority1": "longcode",
                  "priority2": "shortcode",
                  "priority3": "tollfree"
              },
              "service_type": "SMS"
          }]
      }'
  ```

  ```python Python theme={null}
  import plivo

  client = plivo.RestClient('<auth_id>', '<auth_token>')
  number_priorities = [{
      'country_iso': 'US',
      'priority': {
          'priority1': 'shortcode',
          'priority2': 'longcode',
          'priority3': 'tollfree'
      },
      'service_type': 'SMS'
  }]
  powerpack = client.powerpacks.create(
      name="my_powerpack",
      sticky_sender=True,
      number_priority=number_priorities
  )
  print(powerpack)
  ```

  ```javascript Node.js theme={null}
  const plivo = require('plivo');

  const client = new plivo.Client('<auth_id>', '<auth_token>');

  const params = {
      sticky_sender: true,
      local_connect: true,
      number_priority: [{
          service_type: "SMS",
          country_iso: "US",
          priority: {
              priority1: "longcode",
              priority2: "shortcode",
              priority3: "tollfree"
          }
      }]
  };

  client.powerpacks.create("my_powerpack", params)
      .then(result => console.log(result));
  ```

  ```ruby Ruby theme={null}
  require 'plivo'

  api = Plivo::RestClient.new("<auth_id>", "<auth_token>")

  number_priority = [{
      "country_iso" => "US",
      "priority" => {
          "priority1" => "tollfree",
          "priority2" => "longcode",
          "priority3" => "shortcode"
      },
      "service_type" => "SMS"
  }]

  response = api.powerpacks.create(
      'my_powerpack',
      sticky_sender: true,
      local_connect: false,
      number_priority: number_priority
  )
  puts response
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "api_id": "8b583f08-ae57-11eb-8840-0242ac110003",
  "application_id": "",
  "application_type": "",
  "created_on": "2020-09-23T09:31:25.924044Z",
  "local_connect": true,
  "name": "my_powerpack",
  "number_pool": "/v1/Account/MAXXXXXXXXXX/NumberPool/abc123-def456/",
  "number_priority": [
    {
      "country_iso": "US",
      "priority": {
        "priority1": "shortcode",
        "priority2": "tollfree",
        "priority3": "longcode"
      },
      "service_type": "SMS"
    }
  ],
  "sticky_sender": true,
  "uuid": "abc123-def456-ghi789"
}
```

***

## Update a Powerpack

Update a Powerpack's name, sticky\_sender, local\_connect, or the application connected to it.

```
POST https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/
```

### Arguments

<ParamField path="powerpack_uuid" type="string" required>
  The unique identifier of the Powerpack to update. Specified in the request URL.
</ParamField>

<ParamField body="name" type="string">
  Must be unique across all Powerpacks in your account.
</ParamField>

<ParamField body="sticky_sender" type="boolean">
  Whether Sticky Sender should be enabled. Defaults to `true`.
</ParamField>

<ParamField body="local_connect" type="boolean">
  Whether Local Connect should be enabled. Defaults to `true`.
</ParamField>

<ParamField body="application_type" type="string">
  **Conditional** - Must be specified if `application_id` is specified and is not `"none"`. Allowed values: `xml`, `phlo`.
</ParamField>

<ParamField body="application_id" type="string">
  Must be set to a valid PHLO or XML App ID or `"none"`. If not specified (or set to `"none"`), no application will be associated with phone numbers added to this Powerpack.
</ParamField>

<ParamField body="number_priority" type="array">
  An array of number priority configurations to update.
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/<powerpack_uuid>/' \
      -H 'Content-Type: application/json' \
      -u '<auth_id>:<auth_token>' \
      -d '{
          "name": "updated_powerpack_name",
          "sticky_sender": true,
          "local_connect": true,
          "number_priority": [{
              "country_iso": "US",
              "priority": {
                  "priority1": "longcode",
                  "priority2": "shortcode",
                  "priority3": "tollfree"
              },
              "service_type": "SMS"
          }]
      }'
  ```

  ```python Python theme={null}
  import plivo

  client = plivo.RestClient('<auth_id>', '<auth_token>')
  powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")

  number_priorities = [{
      'country_iso': 'US',
      'priority': {
          'priority1': 'longcode',
          'priority2': 'tollfree',
          'priority3': 'shortcode'
      },
      'service_type': 'SMS'
  }]

  response = powerpack.update({
      "name": "updated_powerpack_name",
      "number_priority": number_priorities
  })
  print(response)
  ```

  ```javascript Node.js theme={null}
  const plivo = require('plivo');

  const client = new plivo.Client('<auth_id>', '<auth_token>');

  const params = {
      name: "updated_powerpack_name",
      number_priority: [{
          service_type: "SMS",
          country_iso: "US",
          priority: {
              priority1: "tollfree",
              priority2: "shortcode",
              priority3: "longcode"
          }
      }]
  };

  client.powerpacks.update("<powerpack_uuid>", params)
      .then(result => console.log(result));
  ```

  ```ruby Ruby theme={null}
  require 'plivo'

  api = Plivo::RestClient.new("<auth_id>", "<auth_token>")
  powerpack = api.powerpacks.get("<powerpack_uuid>")

  number_priority = [{
      "country_iso" => "US",
      "priority" => {
          "priority1" => "tollfree",
          "priority2" => "longcode",
          "priority3" => "shortcode"
      },
      "service_type" => "SMS"
  }]

  response = powerpack.update(
      name: 'updated_powerpack_name',
      sticky_sender: true,
      local_connect: false,
      number_priority: number_priority
  )
  puts response
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "api_id": "8b583f08-ae57-11eb-8840-0242ac110003",
  "application_id": "",
  "application_type": "",
  "created_on": "2020-09-23T09:31:25.924044Z",
  "local_connect": true,
  "name": "updated_powerpack_name",
  "number_pool": "/v1/Account/MAXXXXXXXXXX/NumberPool/abc123-def456/",
  "number_priority": [
    {
      "country_iso": "US",
      "priority": {
        "priority1": "longcode",
        "priority2": "shortcode",
        "priority3": "tollfree"
      },
      "service_type": "SMS"
    }
  ],
  "sticky_sender": true,
  "uuid": "abc123-def456-ghi789"
}
```

***

## Delete a Powerpack

Deletes a single Powerpack. This operation cannot be undone.

```
DELETE https://api.plivo.com/v1/Account/{auth_id}/Powerpack/{powerpack_uuid}/
```

### Arguments

<ParamField path="powerpack_uuid" type="string" required>
  The unique identifier of the Powerpack to delete. Specified in the request URL.
</ParamField>

<ParamField body="unrent_numbers" type="boolean">
  If set to `true`, all numbers connected to the Powerpack will be unrented. Defaults to `false`.
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE 'https://api.plivo.com/v1/Account/<auth_id>/Powerpack/<powerpack_uuid>/' \
      -H 'Content-Type: application/json' \
      -u '<auth_id>:<auth_token>' \
      -d '{"unrent_numbers": false}'
  ```

  ```python Python theme={null}
  import plivo

  client = plivo.RestClient('<auth_id>', '<auth_token>')
  powerpack = client.powerpacks.get(uuid="<powerpack_uuid>")
  response = powerpack.delete(unrent_numbers=False)
  print(response)
  ```

  ```javascript Node.js theme={null}
  const plivo = require('plivo');

  const client = new plivo.Client("<auth_id>", "<auth_token>");

  client.powerpacks.get("<powerpack_uuid>")
      .then(powerpack => powerpack.delete())
      .then(result => console.log(result))
      .catch(error => console.log(error));
  ```

  ```ruby Ruby theme={null}
  require 'plivo'

  api = Plivo::RestClient.new("<auth_id>", "<auth_token>")
  powerpack = api.powerpacks.get(uuid: '<powerpack_uuid>')
  response = powerpack.delete(true)
  puts response
  ```
</CodeGroup>

### Response

Returns an empty response with HTTP status code 204 on successful deletion.
