# Conversational Intelligence - Operator Resource

The Operator resource represents a [Twilio Pre-built](/docs/conversational-intelligence/api/prebuilt-operator-subresource) or [Custom](/docs/conversational-intelligence/api/custom-operator-subresource) Language Operator. This resource allows you to fetch a specific Operator and list all available Operators on your Account.

You can add these Operators to an Intelligence Service by [creating an Operator attachment](/docs/conversational-intelligence/api/operator-attachment-subresource#create-an-operator-attachment).

## Operator Properties

```json
{"type":"object","refName":"intelligence.v2.operator","modelName":"intelligence_v2_operator","properties":{"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The unique SID identifier of the Account the Operator belongs to."},"sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^LY[0-9a-fA-F]{32}$","nullable":true,"description":"A 34 character string that uniquely identifies this Operator."},"friendly_name":{"type":"string","nullable":true,"description":"A human-readable name of this resource, up to 64 characters."},"description":{"type":"string","nullable":true,"description":"A human-readable description of this resource, longer than the friendly name."},"author":{"type":"string","nullable":true,"description":"The creator of the Operator. Either Twilio or the creating Account."},"operator_type":{"type":"string","nullable":true,"description":"Operator Type for this Operator. References an existing Operator Type resource."},"version":{"type":"integer","default":0,"description":"Numeric Operator version. Incremented with each update on the resource, used to ensure integrity when updating the Operator."},"availability":{"type":"string","enum":["internal","beta","public","deprecated","general-availability","retired"],"description":"Operator availability status. Possible values: internal, beta, public, retired.","refName":"operator_enum_availability","modelName":"operator_enum_availability"},"config":{"nullable":true,"description":"Operator configuration, following the schema defined by the Operator Type. Only available on Custom Operators created by the Account."},"date_created":{"type":"string","format":"date-time","nullable":true,"description":"The date that this Operator was created, given in ISO 8601 format."},"date_updated":{"type":"string","format":"date-time","nullable":true,"description":"The date that this Operator was updated, given in ISO 8601 format."},"url":{"type":"string","format":"uri","nullable":true,"description":"The URL of this resource."}}}
```

## Fetch an Operator

`GET https://intelligence.twilio.com/v2/Operators/{Sid}`

This endpoint retrieves the details of a Twilio Pre-built or Custom Operator using its SID.

### Path parameters

```json
[{"name":"Sid","in":"path","description":"A 34 character string that uniquely identifies this Operator.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^LY[0-9a-fA-F]{32}$"},"required":true}]
```

Fetch an Operator

```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 fetchOperator() {
  const operator = await client.intelligence.v2
    .operators("LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .fetch();

  console.log(operator.accountSid);
}

fetchOperator();
```

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

operator = client.intelligence.v2.operators(
    "LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
).fetch()

print(operator.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Intelligence.V2;
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 _operator =
            await OperatorResource.FetchAsync(pathSid: "LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

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

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

import com.twilio.Twilio;
import com.twilio.rest.intelligence.v2.Operator;

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);
        Operator operator = Operator.fetcher("LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch();

        System.out.println(operator.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.IntelligenceV2.FetchOperator("LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} 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);

$operator = $twilio->intelligence->v2
    ->operators("LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->fetch();

print $operator->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)

operator = @client
           .intelligence
           .v2
           .operators('LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
           .fetch

puts operator.account_sid
```

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

twilio api:intelligence:v2:operators:fetch \
   --sid LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X GET "https://intelligence.twilio.com/v2/Operators/LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "sid": "LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "friendly_name": "My New Operator",
  "description": "New Operator",
  "author": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "operator_type": "operator-type-name",
  "version": 1,
  "availability": "public",
  "config": {
    "configuration": {
      "field": "value"
    }
  },
  "date_created": "2010-08-31T20:36:28Z",
  "date_updated": "2010-08-31T20:36:28Z",
  "url": "https://intelligence.twilio.com/v2/Operators/LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
```

## List Operators

`GET https://intelligence.twilio.com/v2/Operators`

This endpoint lists all available Twilio Pre-built and Custom Operators for an Account, with optional filtering.

### Query parameters

```json
[{"name":"Availability","in":"query","description":"Returns Operators with the provided availability type. Possible values: internal, beta, public, retired.","schema":{"type":"string","enum":["internal","beta","public","deprecated","general-availability","retired"],"description":"Operator availability status. Possible values: internal, beta, public, retired.","refName":"operator_enum_availability","modelName":"operator_enum_availability"},"examples":{"readFull":{"value":"public"},"readEmpty":{"value":"public"}}},{"name":"LanguageCode","in":"query","description":"Returns Operators that support the provided language code.","schema":{"type":"string"},"examples":{"readFull":{"value":"en"},"readEmpty":{"value":"en"}}},{"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","format":"int64","minimum":1,"maximum":1000}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

List multiple Operators

```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 listOperator() {
  const operators = await client.intelligence.v2.operators.list({ limit: 20 });

  operators.forEach((o) => console.log(o.accountSid));
}

listOperator();
```

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

operators = client.intelligence.v2.operators.list(limit=20)

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

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

using System;
using Twilio;
using Twilio.Rest.Intelligence.V2;
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 _operators = await OperatorResource.ReadAsync(limit: 20);

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

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

import com.twilio.Twilio;
import com.twilio.rest.intelligence.v2.Operator;
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<Operator> operators = Operator.reader().limit(20).read();

        for (Operator record : operators) {
            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"
	intelligence "github.com/twilio/twilio-go/rest/intelligence/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 := &intelligence.ListOperatorParams{}
	params.SetLimit(20)

	resp, err := client.IntelligenceV2.ListOperator(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].AccountSid != nil {
				fmt.Println(*resp[record].AccountSid)
			} else {
				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);

$operators = $twilio->intelligence->v2->operators->read([], 20);

foreach ($operators 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)

operators = @client
            .intelligence
            .v2
            .operators
            .list(limit: 20)

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

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

twilio api:intelligence:v2:operators:list
```

```bash
curl -X GET "https://intelligence.twilio.com/v2/Operators?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "operators": [
    {
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "sid": "LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "friendly_name": "My New Operator",
      "description": "New Operator",
      "author": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "operator_type": "operator-type-name",
      "version": 1,
      "availability": "public",
      "config": {
        "configuration": {
          "field": "value"
        }
      },
      "date_created": "2010-08-31T20:36:28Z",
      "date_updated": "2010-08-31T20:36:28Z",
      "url": "https://intelligence.twilio.com/v2/Operators/LYaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    }
  ],
  "meta": {
    "first_page_url": "https://intelligence.twilio.com/v2/Operators?LanguageCode=en&Availability=public&PageSize=50&Page=0",
    "key": "operators",
    "next_page_url": null,
    "page": 0,
    "page_size": 50,
    "previous_page_url": null,
    "url": "https://intelligence.twilio.com/v2/Operators?LanguageCode=en&Availability=public&PageSize=50&Page=0"
  }
}
```
