# Assistants Resource

Create and configure [**Assistants**](/docs/alpha/ai-assistants) programmatically using the REST API.

## Assistant Properties

<OperationTable type="properties" data={{"type":"object","required":["account_sid","name","owner","model","personality_prompt","customer_ai","id","date_updated","date_created"],"refName":"assistants.v1.service.assistant","modelName":"assistants_v1_service_assistant","properties":{"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","description":"The SID of the [Account](/docs/iam/api/account) that created the Assistant resource."},"customer_ai":{"type":"object","description":"The Personalization and Perception Engine settings."},"id":{"type":"string","pattern":"^aia_asst_.+$","description":"The Assistant ID."},"model":{"type":"string","description":"The default model used by the assistant."},"name":{"type":"string","description":"The name of the assistant."},"owner":{"type":"string","description":"The owner/company of the assistant."},"url":{"type":"string","description":"The url of the assistant resource."},"personality_prompt":{"type":"string","description":"The personality prompt to be used for assistant."},"date_created":{"description":"The date and time in GMT when the Assistant was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.","format":"date-time","type":"string"},"date_updated":{"description":"The date and time in GMT when the Assistant was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.","format":"date-time","type":"string"}}}} />

## Create an Assistant

`POST https://assistants.twilio.com/v1/Assistants`

### Request body parameters

```json
{"schema":{"type":"object","required":["name"],"refName":"assistants.v1.service.create_assistant_request","modelName":"assistants_v1_service_create_assistant_request","properties":{"customer_ai":{"description":"The Personalization and Perception Engine settings.","type":"object","required":["personalization_engine_enabled","perception_engine_enabled"],"refName":"assistants.v1.service.customer_ai","modelName":"assistants_v1_service_customer_ai","properties":{"perception_engine_enabled":{"description":"True if the perception engine is enabled.","type":"boolean"},"personalization_engine_enabled":{"description":"True if the personalization engine is enabled.","type":"boolean"}}},"name":{"description":"The name of the assistant.","type":"string"},"owner":{"description":"The owner/company of the assistant.","type":"string"},"personality_prompt":{"description":"The personality prompt to be used for assistant.","type":"string"},"segment_credential":{"description":"The Segment Credentials to be used for the assistant.","type":"object","refName":"assistants.v1.service.segment_credential","modelName":"assistants_v1_service_segment_credential","properties":{"profile_api_key":{"description":"The profile API key.","type":"string"},"space_id":{"description":"The space ID.","type":"string"},"write_key":{"description":"The write key.","type":"string"}}}}},"encodingType":"application/json","conditionalParameterMap":{}}
```

Create an Assistant

```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 createAssistant() {
  const assistant = await client.assistants.v1.assistants.create({
    name: "Your first Assistant",
    personality_prompt: "You are a helpful assistant.",
  });

  console.log(assistant.accountSid);
}

createAssistant();
```

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

# 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)

assistant = client.assistants.v1.assistants.create(
    assistants_v1_service_create_assistant_request=AssistantList.AssistantsV1ServiceCreateAssistantRequest(
        {
            "name": "Your first Assistant",
            "personality_prompt": "You are a helpful assistant.",
        }
    )
)

print(assistant.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Assistants.V1;
using System.Threading.Tasks;
using System.Collections.Generic;

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 assistant = await AssistantResource.CreateAsync(
            assistantsV1ServiceCreateAssistantRequest: new AssistantResource
                .AssistantsV1ServiceCreateAssistantRequest.Builder()
                .WithName("Your first Assistant")
                .WithPersonalityPrompt("You are a helpful assistant.")
                .Build());

        Console.WriteLine(assistant.AccountSid);
    }
}
```

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

import java.util.HashMap;
import com.twilio.Twilio;
import com.twilio.rest.assistants.v1.Assistant;

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);

        Assistant.AssistantsV1ServiceCreateAssistantRequest assistantsV1ServiceCreateAssistantRequest =
            new Assistant.AssistantsV1ServiceCreateAssistantRequest();
        assistantsV1ServiceCreateAssistantRequest.setName("Your first Assistant");
        assistantsV1ServiceCreateAssistantRequest.setPersonalityPrompt("You are a helpful assistant.");

        Assistant assistant = Assistant.creator(assistantsV1ServiceCreateAssistantRequest).create();

        System.out.println(assistant.getAccountSid());
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	assistants "github.com/twilio/twilio-go/rest/assistants/v1"
	"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 := &assistants.CreateAssistantParams{}
	params.SetAssistantsV1ServiceCreateAssistantRequest(assistants.assistants_v1_service_create_assistant_request{
		Name:              "Your first Assistant",
		PersonalityPrompt: "You are a helpful assistant.",
	})

	resp, err := client.AssistantsV1.CreateAssistant(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(resp.AccountSid)
	}
}
```

```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;
use Twilio\Rest\Assistants\V1\AssistantModels;

// 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);

$assistant = $twilio->assistants->v1->assistants->create(
    AssistantModels::createAssistantsV1ServiceCreateAssistantRequest([
        "name" => "Your first Assistant",
        "personalityPrompt" => "You are a helpful assistant.",
    ])
);

print $assistant->accountSid;
```

```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)

assistant = @client
            .assistants
            .v1
            .assistants
            .create(
              assistants_v1_service_create_assistant_request: {
                'name' => 'Your first Assistant',
                'personality_prompt' => 'You are a helpful assistant.'
              }
            )

puts assistant.account_sid
```

```bash
# This endpoint is not currently supported by the Twilio CLI. You can open an issue to request it on https://github.com/twilio/twilio-cli/issues
  # For an alternative low-code solution, check out https://www.twilio.com/docs/openapi/using-twilio-postman-collections
```

```bash
ASSISTANTS_V1_SERVICE_CREATE_ASSISTANT_REQUEST_OBJ=$(cat << EOF
{
  "name": "Your first Assistant",
  "personality_prompt": "You are a helpful assistant."
}
EOF
)
curl -X POST "https://assistants.twilio.com/v1/Assistants" \
--json "$ASSISTANTS_V1_SERVICE_CREATE_ASSISTANT_REQUEST_OBJ" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "customer_ai": {},
  "date_created": "2009-07-06T20:30:00Z",
  "date_updated": "2009-07-06T20:30:00Z",
  "id": "aia_asst_#",
  "model": "model",
  "name": "Your first Assistant",
  "owner": "owner",
  "personality_prompt": "You are a helpful assistant.",
  "url": "https://www.example.com"
}
```

## Get an Assistant

`GET https://assistants.twilio.com/v1/Assistants/{id}`

### Path parameters

```json
[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}]
```

Get an Assistant

```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 fetchAssistant() {
  const assistant = await client.assistants.v1
    .assistants("aia_asst_00000000-1111-2222-3333-444444444444")
    .fetch();

  console.log(assistant.accountSid);
}

fetchAssistant();
```

```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)

assistant = client.assistants.v1.assistants(
    "aia_asst_00000000-1111-2222-3333-444444444444"
).fetch()

print(assistant.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Assistants.V1;
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 assistant = await AssistantResource.FetchAsync(
            pathId: "aia_asst_00000000-1111-2222-3333-444444444444");

        Console.WriteLine(assistant.AccountSid);
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.assistants.v1.Assistant;

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);
        Assistant assistant = Assistant.fetcher("aia_asst_00000000-1111-2222-3333-444444444444").fetch();

        System.out.println(assistant.getAccountSid());
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"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()

	resp, err := client.AssistantsV1.FetchAssistant("aia_asst_00000000-1111-2222-3333-444444444444")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(resp.AccountSid)
	}
}
```

```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);

$assistant = $twilio->assistants->v1
    ->assistants("aia_asst_00000000-1111-2222-3333-444444444444")
    ->fetch();

print $assistant->accountSid;
```

```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)

assistant = @client
            .assistants
            .v1
            .assistants('aia_asst_00000000-1111-2222-3333-444444444444')
            .fetch

puts assistant.account_sid
```

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

twilio api:assistants:v1:assistants:fetch \
   --id aia_asst_00000000-1111-2222-3333-444444444444
```

```bash
curl -X GET "https://assistants.twilio.com/v1/Assistants/aia_asst_00000000-1111-2222-3333-444444444444" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "customer_ai": {},
  "date_created": "2009-07-06T20:30:00Z",
  "date_updated": "2009-07-06T20:30:00Z",
  "id": "aia_asst_00000000-1111-2222-3333-444444444444",
  "knowledge": [
    {
      "description": "description",
      "id": "aia_know_#",
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "knowledge_source_details": {},
      "name": "name",
      "status": "status",
      "type": "type",
      "url": "https://www.example.com",
      "embedding_model": "embedding_model",
      "date_created": "2009-07-06T20:30:00Z",
      "date_updated": "2009-07-06T20:30:00Z"
    }
  ],
  "model": "model",
  "name": "Miss Christine Morgan",
  "owner": "owner",
  "personality_prompt": "personality_prompt",
  "tools": [
    {
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "description": "description",
      "enabled": false,
      "id": "aia_tool_#",
      "meta": {},
      "name": "name",
      "requires_auth": false,
      "type": "type",
      "url": "https://www.example.com",
      "date_created": "2009-07-06T20:30:00Z",
      "date_updated": "2009-07-06T20:30:00Z"
    }
  ],
  "url": "https://www.example.com"
}
```

## List Assistants

`GET https://assistants.twilio.com/v1/Assistants`

### Query parameters

```json
[{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageSize","in":"query","description":"How many resources to return in each list page. The default is 50, and the maximum is 1000.","schema":{"type":"integer","minimum":1,"maximum":1000}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

List Assistants

```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 listAssistants() {
  const assistants = await client.assistants.v1.assistants.list({ limit: 20 });

  assistants.forEach((a) => console.log(a.accountSid));
}

listAssistants();
```

```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)

assistants = client.assistants.v1.assistants.list(limit=20)

for record in assistants:
    print(record.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Assistants.V1;
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 assistants = await AssistantResource.ReadAsync(limit: 20);

        foreach (var record in assistants) {
            Console.WriteLine(record.AccountSid);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.assistants.v1.Assistant;
import com.twilio.base.ResourceSet;

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);
        ResourceSet<Assistant> assistants = Assistant.reader().limit(20).read();

        for (Assistant record : assistants) {
            System.out.println(record.getAccountSid());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	assistants "github.com/twilio/twilio-go/rest/assistants/v1"
	"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 := &assistants.ListAssistantsParams{}
	params.SetLimit(20)

	resp, err := client.AssistantsV1.ListAssistants(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			fmt.Println(resp[record].AccountSid)
		}
	}
}
```

```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);

$assistants = $twilio->assistants->v1->assistants->read(20);

foreach ($assistants as $record) {
    print $record->accountSid;
}
```

```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)

assistants = @client
             .assistants
             .v1
             .assistants
             .list(limit: 20)

assistants.each do |record|
   puts record.account_sid
end
```

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

twilio api:assistants:v1:assistants:list
```

```bash
curl -X GET "https://assistants.twilio.com/v1/Assistants?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "assistants": [
    {
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "customer_ai": {},
      "id": "aia_asst_#",
      "model": "model",
      "name": "name",
      "owner": "owner",
      "url": "https://www.example.com",
      "personality_prompt": "personality_prompt",
      "date_created": "2009-07-06T20:30:00Z",
      "date_updated": "2009-07-06T20:30:00Z"
    }
  ],
  "meta": {
    "first_page_url": "https://www.example.com",
    "key": "key",
    "next_page_url": "https://www.example.com",
    "page": 42,
    "page_size": 42,
    "previous_page_url": "https://www.example.com",
    "url": "https://www.example.com"
  }
}
```

## Update an Assistant

`PUT https://assistants.twilio.com/v1/Assistants/{id}`

### Path parameters

```json
[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}]
```

### Request body parameters

```json
{"schema":{"type":"object","refName":"assistants.v1.service.update_assistant_request","modelName":"assistants_v1_service_update_assistant_request","properties":{"customer_ai":{"description":"The Personalization and Perception Engine settings.","type":"object","required":["personalization_engine_enabled","perception_engine_enabled"],"refName":"assistants.v1.service.customer_ai","modelName":"assistants_v1_service_customer_ai","properties":{"perception_engine_enabled":{"description":"True if the perception engine is enabled.","type":"boolean"},"personalization_engine_enabled":{"description":"True if the personalization engine is enabled.","type":"boolean"}}},"name":{"description":"The name of the assistant.","type":"string"},"owner":{"description":"The owner/company of the assistant.","type":"string"},"personality_prompt":{"description":"The personality prompt to be used for assistant.","type":"string"},"segment_credential":{"description":"The Segment Credentials to be used for the assistant.","type":"object","refName":"assistants.v1.service.segment_credential","modelName":"assistants_v1_service_segment_credential","properties":{"profile_api_key":{"description":"The profile API key.","type":"string"},"space_id":{"description":"The space ID.","type":"string"},"write_key":{"description":"The write key.","type":"string"}}}}},"encodingType":"application/json","conditionalParameterMap":{}}
```

Update an Assistant

```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 updateAssistant() {
  const assistant = await client.assistants.v1.assistants("aia_tool").update({
    personality_prompt: "You are an unhelpful assistant.",
  });

  console.log(assistant.accountSid);
}

updateAssistant();
```

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

# 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)

assistant = client.assistants.v1.assistants("aia_tool").update(
    assistants_v1_service_update_assistant_request=AssistantList.AssistantsV1ServiceUpdateAssistantRequest(
        {"personality_prompt": "You are an unhelpful assistant."}
    )
)

print(assistant.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Assistants.V1;
using System.Threading.Tasks;
using System.Collections.Generic;

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 assistant = await AssistantResource.UpdateAsync(new UpdateAssistantOptions("aia_tool") {
            AssistantsV1ServiceUpdateAssistantRequest =
                new AssistantResource.AssistantsV1ServiceUpdateAssistantRequest.Builder()
                    .WithPersonalityPrompt("You are an unhelpful assistant.")
                    .Build()
        });

        Console.WriteLine(assistant.AccountSid);
    }
}
```

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

import java.util.HashMap;
import com.twilio.Twilio;
import com.twilio.rest.assistants.v1.Assistant;

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);

        Assistant.AssistantsV1ServiceUpdateAssistantRequest assistantsV1ServiceUpdateAssistantRequest =
            new Assistant.AssistantsV1ServiceUpdateAssistantRequest();
        assistantsV1ServiceUpdateAssistantRequest.setPersonalityPrompt("You are an unhelpful assistant.");

        Assistant assistant = Assistant.updater("aia_tool", assistantsV1ServiceUpdateAssistantRequest).update();

        System.out.println(assistant.getAccountSid());
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	assistants "github.com/twilio/twilio-go/rest/assistants/v1"
	"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 := &assistants.UpdateAssistantParams{}
	params.SetAssistantsV1ServiceUpdateAssistantRequest(assistants.assistants_v1_service_update_assistant_request{
		PersonalityPrompt: "You are an unhelpful assistant.",
	})

	resp, err := client.AssistantsV1.UpdateAssistant("aia_tool",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(resp.AccountSid)
	}
}
```

```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;
use Twilio\Rest\Assistants\V1\AssistantModels;

// 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);

$assistant = $twilio->assistants->v1->assistants("aia_tool")->update(
    AssistantModels::createAssistantsV1ServiceUpdateAssistantRequest([
        "personalityPrompt" => "You are an unhelpful assistant.",
    ])
);

print $assistant->accountSid;
```

```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)

assistant = @client
            .assistants
            .v1
            .assistants('aia_tool')
            .update(
              assistants_v1_service_update_assistant_request: {
                'personality_prompt' => 'You are an unhelpful assistant.'
              }
            )

puts assistant.account_sid
```

```bash
# This endpoint is not currently supported by the Twilio CLI. You can open an issue to request it on https://github.com/twilio/twilio-cli/issues
  # For an alternative low-code solution, check out https://www.twilio.com/docs/openapi/using-twilio-postman-collections
```

```bash
ASSISTANTS_V1_SERVICE_UPDATE_ASSISTANT_REQUEST_OBJ=$(cat << EOF
{
  "personality_prompt": "You are an unhelpful assistant."
}
EOF
)
curl -X PUT "https://assistants.twilio.com/v1/Assistants/aia_tool" \
--json "$ASSISTANTS_V1_SERVICE_UPDATE_ASSISTANT_REQUEST_OBJ" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "customer_ai": {},
  "date_created": "2009-07-06T20:30:00Z",
  "date_updated": "2009-07-06T20:30:00Z",
  "id": "aia_tool",
  "model": "model",
  "name": "Miss Christine Morgan",
  "owner": "owner",
  "personality_prompt": "You are an unhelpful assistant.",
  "url": "https://www.example.com"
}
```

## Delete an Assistant

`DELETE https://assistants.twilio.com/v1/Assistants/{id}`

### Path parameters

```json
[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}]
```

Delete an Assistant

```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 deleteAssistant() {
  await client.assistants.v1
    .assistants("aia_asst_00000000-1111-2222-3333-444444444444")
    .remove();
}

deleteAssistant();
```

```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)

client.assistants.v1.assistants(
    "aia_asst_00000000-1111-2222-3333-444444444444"
).delete()
```

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

using System;
using Twilio;
using Twilio.Rest.Assistants.V1;
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);

        await AssistantResource.DeleteAsync(
            pathId: "aia_asst_00000000-1111-2222-3333-444444444444");
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.assistants.v1.Assistant;

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);
        Assistant.deleter("aia_asst_00000000-1111-2222-3333-444444444444").delete();
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"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()

	err := client.AssistantsV1.DeleteAssistant("aia_asst_00000000-1111-2222-3333-444444444444")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}
}
```

```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);

$twilio->assistants->v1
    ->assistants("aia_asst_00000000-1111-2222-3333-444444444444")
    ->delete();
```

```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)

@client
  .assistants
  .v1
  .assistants('aia_asst_00000000-1111-2222-3333-444444444444')
  .delete
```

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

twilio api:assistants:v1:assistants:remove \
   --id aia_asst_00000000-1111-2222-3333-444444444444
```

```bash
curl -X DELETE "https://assistants.twilio.com/v1/Assistants/aia_asst_00000000-1111-2222-3333-444444444444" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```
