# Bundle Replace Items Resource

> \[!NOTE]
>
> This page is specifically about the Replace Items subresource of a Bundle. Please refer to [Regulatory Compliance REST APIs](/docs/phone-numbers/regulatory/api) for general knowledge or [FAQ](/docs/phone-numbers/regulatory/faq) page.

With the new Replace Items resource, developers can now update their compliance information when Regulations change while continuing to provision new Phone Numbers before their compliance information is no longer valid. The Replace Items resource replaces a `twilio-approved` Regulatory Bundle's Items with a `twilio-approved` Bundle Copy. By replacing the old items with the newly approved Bundle Copy Items Assigned, you will not have to worry about reassigning any Phone Numbers or other potential dependencies that rely on the Bundle.

## Replace Items Response properties

The field of the Bundle resource response is in JSON. The type SID\<BU> is a unique ID starting with letters BU. For more information about Twilio SIDs, please refer to [Twilio's glossary on SIDs](/docs/glossary/what-is-a-sid).

```json
{"type":"object","refName":"numbers.v2.regulatory_compliance.bundle.replace_items","modelName":"numbers_v2_regulatory_compliance_bundle_replace_items","properties":{"sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^BU[0-9a-fA-F]{32}$","nullable":true,"description":"The unique string that we created to identify the Bundle resource."},"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the [Account](/docs/iam/api/account) that created the Bundle resource."},"regulation_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^RN[0-9a-fA-F]{32}$","nullable":true,"description":"The unique string of a regulation that is associated to the Bundle resource."},"friendly_name":{"type":"string","nullable":true,"description":"The string that you assigned to describe the resource."},"status":{"type":"string","enum":["draft","pending-review","in-review","twilio-rejected","twilio-approved","provisionally-approved"],"description":"The verification status of the Bundle resource.","refName":"replace_items_enum_status","modelName":"replace_items_enum_status"},"valid_until":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until."},"email":{"type":"string","nullable":true,"description":"The email address that will receive updates when the Bundle resource changes status."},"status_callback":{"type":"string","format":"uri","nullable":true,"description":"The URL we call to inform your application of status changes."},"date_created":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."},"date_updated":{"type":"string","format":"date-time","nullable":true,"description":"The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."}}}
```

### Bundle Statuses

The following statuses encompass the Bundle lifecycle.

| ***Status***      | ***Description***                                                                                                                                                       |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *draft*           | The user has created a new Bundle that can be edited with Supporting Documents and End-User objects assigned.                                                           |
| *pending-review*  | When the user has finished the draft of the Bundle and submits to Twilio for review, the status moves from `draft` to `pending-review`.                                 |
| *in-review*       | Twilio has moved the Bundle from `pending-review` to `in-review`. Once Twilio has finished review, the Bundle will go either to `twilio-approved` or `twilio-rejected`. |
| *twilio-rejected* | Twilio has reviewed the Bundle and has determined the Bundle does not meet the regulations.                                                                             |
| *twilio-approved* | Twilio has reviewed the Bundle and has determined the Bundles does meet the regulations.                                                                                |

## Replace Items from Bundle Copy to original Bundle

`POST https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/{BundleSid}/ReplaceItems`

### Path parameters

```json
[{"name":"BundleSid","in":"path","description":"The unique string that identifies the Bundle where the item assignments are going to be replaced.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^BU[0-9a-fA-F]{32}$"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"CreateReplaceItemsRequest","required":["FromBundleSid"],"properties":{"FromBundleSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^BU[0-9a-fA-F]{32}$","description":"The source bundle sid to copy the item assignments from."}}},"examples":{"create":{"value":{"lang":"json","value":"{\n  \"FromBundleSid\": \"BUbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n}","meta":"","code":"{\n  \"FromBundleSid\": \"BUbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"FromBundleSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"BUbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\"","#A5D6FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Replace Items from Bundle Copy to original Bundle

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function createReplaceItems() {
  const replaceItem = await client.numbers.v2.regulatoryCompliance
    .bundles("BUef3a237936fb63163fd852d77c5ba27b")
    .replaceItems.create({
      fromBundleSid: "BU504eddd19f1efa428458f6daed683667",
    });

  console.log(replaceItem.sid);
}

createReplaceItems();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

replace_item = client.numbers.v2.regulatory_compliance.bundles(
    "BUef3a237936fb63163fd852d77c5ba27b"
).replace_items.create(from_bundle_sid="BU504eddd19f1efa428458f6daed683667")

print(replace_item.sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Numbers.V2.RegulatoryCompliance.Bundle;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var replaceItems = await ReplaceItemsResource.CreateAsync(
            fromBundleSid: "BU504eddd19f1efa428458f6daed683667",
            pathBundleSid: "BUef3a237936fb63163fd852d77c5ba27b");

        Console.WriteLine(replaceItems.Sid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.numbers.v2.regulatorycompliance.bundle.ReplaceItems;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ReplaceItems replaceItems =
            ReplaceItems.creator("BUef3a237936fb63163fd852d77c5ba27b", "BU504eddd19f1efa428458f6daed683667").create();

        System.out.println(replaceItems.getSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	numbers "github.com/twilio/twilio-go/rest/numbers/v2"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &numbers.CreateReplaceItemsParams{}
	params.SetFromBundleSid("BU504eddd19f1efa428458f6daed683667")

	resp, err := client.NumbersV2.CreateReplaceItems("BUef3a237936fb63163fd852d77c5ba27b",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.Sid != nil {
			fmt.Println(*resp.Sid)
		} else {
			fmt.Println(resp.Sid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$replace_item = $twilio->numbers->v2->regulatoryCompliance
    ->bundles("BUef3a237936fb63163fd852d77c5ba27b")
    ->replaceItems->create(
        "BU504eddd19f1efa428458f6daed683667" // FromBundleSid
    );

print $replace_item->sid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

replace_item = @client
               .numbers
               .v2
               .regulatory_compliance
               .bundles('BUef3a237936fb63163fd852d77c5ba27b')
               .replace_items
               .create(from_bundle_sid: 'BU504eddd19f1efa428458f6daed683667')

puts replace_item.sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:numbers:v2:regulatory-compliance:bundles:replace-items:create \
   --bundle-sid BUef3a237936fb63163fd852d77c5ba27b \
   --from-bundle-sid BU504eddd19f1efa428458f6daed683667
```

```bash
curl -X POST "https://numbers.twilio.com/v2/RegulatoryCompliance/Bundles/BUef3a237936fb63163fd852d77c5ba27b/ReplaceItems" \
--data-urlencode "FromBundleSid=BU504eddd19f1efa428458f6daed683667" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "regulation_sid": "RNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "friendly_name": "friendly_name",
  "status": "draft",
  "valid_until": "2015-07-30T20:00:00Z",
  "email": "email",
  "status_callback": "http://www.example.com",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z"
}
```

Only the create operation is available for the Replace Items resource as the operation is a one-time event. To perform the even again, a new Bundle Copy will need to be created and approved before the Replace Items operation event can be triggered. There is no `GET` or `DELETE` available for this resource.
