# Service Configuration Resource

The Configuration Resource represents all of the configuration settings for a Conversation Service, such as the default roles assigned to [Users](/docs/conversations/api/user-resource).

## Configuration Properties

```json
{"type":"object","refName":"conversations.v1.service.service_configuration","modelName":"conversations_v1_service_service_configuration","properties":{"chat_service_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$","nullable":true,"description":"The unique string that we created to identify the Service configuration resource."},"default_conversation_creator_role_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^RL[0-9a-fA-F]{32}$","nullable":true,"description":"The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](/docs/conversations/api/role-resource) for more info about roles."},"default_conversation_role_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^RL[0-9a-fA-F]{32}$","nullable":true,"description":"The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](/docs/conversations/api/role-resource) for more info about roles."},"default_chat_service_role_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^RL[0-9a-fA-F]{32}$","nullable":true,"description":"The service-level role assigned to users when they are added to the service. See [Conversation Role](/docs/conversations/api/role-resource) for more info about roles."},"url":{"type":"string","format":"uri","nullable":true,"description":"An absolute API resource URL for this service configuration."},"links":{"type":"object","format":"uri-map","nullable":true,"description":"Contains an absolute API resource URL to access the push notifications configuration of this service."},"reachability_enabled":{"type":"boolean","nullable":true,"description":"Whether the [Reachability Indicator](/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`."}}}
```

## Fetch a ServiceConfiguration resource

`GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration`

### Path parameters

```json
[{"name":"ChatServiceSid","in":"path","description":"The SID of the Service configuration resource to fetch.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$"},"required":true}]
```

Fetch a Configuration

```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 fetchServiceConfiguration() {
  const configuration = await client.conversations.v1
    .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration()
    .fetch();

  console.log(configuration.chatServiceSid);
}

fetchServiceConfiguration();
```

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

configuration = (
    client.conversations.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration()
    .fetch()
)

print(configuration.chat_service_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.Service;
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 configuration = await ConfigurationResource.FetchAsync(
            pathChatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(configuration.ChatServiceSid);
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.service.Configuration;

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);
        Configuration configuration = Configuration.fetcher("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch();

        System.out.println(configuration.getChatServiceSid());
    }
}
```

```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.ConversationsV1.FetchServiceConfiguration("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.ChatServiceSid != nil {
			fmt.Println(*resp.ChatServiceSid)
		} else {
			fmt.Println(resp.ChatServiceSid)
		}
	}
}
```

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

$configuration = $twilio->conversations->v1
    ->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->configuration()
    ->fetch();

print $configuration->chatServiceSid;
```

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

configuration = @client
                .conversations
                .v1
                .services('ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                .configuration
                .fetch

puts configuration.chat_service_sid
```

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

twilio api:conversations:v1:services:configuration:fetch \
   --chat-service-sid ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X GET "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "default_conversation_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "default_conversation_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "default_chat_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "reachability_enabled": false,
  "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration",
  "links": {
    "notifications": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications",
    "webhooks": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Webhooks"
  }
}
```

## Update a ServiceConfiguration resource

`POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration`

### Path parameters

```json
[{"name":"ChatServiceSid","in":"path","description":"The SID of the Service configuration resource to update.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateServiceConfigurationRequest","properties":{"DefaultConversationCreatorRoleSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^RL[0-9a-fA-F]{32}$","description":"The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](/docs/conversations/api/role-resource) for more info about roles."},"DefaultConversationRoleSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^RL[0-9a-fA-F]{32}$","description":"The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](/docs/conversations/api/role-resource) for more info about roles."},"DefaultChatServiceRoleSid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^RL[0-9a-fA-F]{32}$","description":"The service-level role assigned to users when they are added to the service. See [Conversation Role](/docs/conversations/api/role-resource) for more info about roles."},"ReachabilityEnabled":{"type":"boolean","description":"Whether the [Reachability Indicator](/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`."}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"DefaultConversationCreatorRoleSid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"DefaultConversationRoleSid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"DefaultChatServiceRoleSid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"ReachabilityEnabled\": false\n}","meta":"","code":"{\n  \"DefaultConversationCreatorRoleSid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"DefaultConversationRoleSid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"DefaultChatServiceRoleSid\": \"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\n  \"ReachabilityEnabled\": false\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"DefaultConversationCreatorRoleSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"DefaultConversationRoleSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"DefaultChatServiceRoleSid\"","#7EE787"],[":","#C9D1D9"]," ",["\"RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"ReachabilityEnabled\"","#7EE787"],[":","#C9D1D9"]," ",["false","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Update a Configuration

```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 updateServiceConfiguration() {
  const configuration = await client.conversations.v1
    .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration()
    .update({
      defaultConversationCreatorRoleSid: "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    });

  console.log(configuration.chatServiceSid);
}

updateServiceConfiguration();
```

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

service_configuration = (
    client.conversations.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration()
    .update(
        default_conversation_creator_role_sid="RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    )
)

print(service_configuration.chat_service_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.Service;
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 configuration = await ConfigurationResource.UpdateAsync(
            defaultConversationCreatorRoleSid: "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            pathChatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(configuration.ChatServiceSid);
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.service.Configuration;

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);
        Configuration configuration = Configuration.updater("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                                          .setDefaultConversationCreatorRoleSid("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
                                          .update();

        System.out.println(configuration.getChatServiceSid());
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	conversations "github.com/twilio/twilio-go/rest/conversations/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 := &conversations.UpdateServiceConfigurationParams{}
	params.SetDefaultConversationCreatorRoleSid("RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")

	resp, err := client.ConversationsV1.UpdateServiceConfiguration("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.ChatServiceSid != nil {
			fmt.Println(*resp.ChatServiceSid)
		} else {
			fmt.Println(resp.ChatServiceSid)
		}
	}
}
```

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

$service_configuration = $twilio->conversations->v1
    ->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->configuration()
    ->update([
        "defaultConversationCreatorRoleSid" =>
            "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    ]);

print $service_configuration->chatServiceSid;
```

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

configuration = @client
                .conversations
                .v1
                .services('ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
                .configuration
                .update(
                  default_conversation_creator_role_sid: 'RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
                )

puts configuration.chat_service_sid
```

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

twilio api:conversations:v1:services:configuration:update \
   --chat-service-sid ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
   --default-conversation-creator-role-sid RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X POST "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration" \
--data-urlencode "DefaultConversationCreatorRoleSid=RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "default_conversation_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "default_conversation_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "default_chat_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "reachability_enabled": false,
  "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration",
  "links": {
    "notifications": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications",
    "webhooks": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Webhooks"
  }
}
```
