> For a complete page index, fetch https://docs.synthflow.ai/llms.txt. For full documentation content, fetch https://docs.synthflow.ai/llms-full.txt.

# Number Pooling

> Attach multiple phone numbers to one inbound or outbound agent with the Platform API, and choose the caller ID for each outbound call.

Number pooling lets one agent use several [phone numbers](/phone-numbers) at once. An inbound agent answers calls to any number in its pool. An outbound agent can place each call from a different number in its pool, so you can route traffic by campaign, region, or brand while keeping one agent configuration.

You manage a pool through the [Platform API](/api-reference/platform-api/agents/attach-phone-numbers-to-assistant). Pooled numbers can be numbers bought in Synthflow, [custom numbers](/phone-numbers#custom-numbers), or numbers from your imported Twilio account.

## Attached numbers

[Get agent](/api-reference/platform-api/agents/get-assistant) returns the numbers in the agent's pool in `attached_phone_numbers`:

```json
{
  "attached_phone_numbers": [
    {
      "number": "+16286666348",
      "sid": "PN9c8dba0c87f9173af8054d3ccedb8afd",
      "slug": "16286666348"
    }
  ]
}
```

Use `slug` to detach a number. Use `number` to choose the caller ID for an outbound call.

## Adding numbers

[Attach phone numbers](/api-reference/platform-api/agents/attach-phone-numbers-to-assistant) adds one or more numbers to the agent's pool. Identify them either by phone number in E.164 format or by slug, not both in the same request.

### Request

PUT [https://api.synthflow.ai/v2/assistants/\{model_id}/phone_numbers](https://api.synthflow.ai/v2/assistants/\{model_id}/phone_numbers)

**`attach-phone-numbers-to-assistant_example`**

```curl attach-phone-numbers-to-assistant_example
curl -X PUT https://api.synthflow.ai/v2/assistants/model_id/phone_numbers \
     -H "Authorization: Bearer <token>"
```

**`attach-phone-numbers-to-assistant_example`**

```python attach-phone-numbers-to-assistant_example
import requests

url = "https://api.synthflow.ai/v2/assistants/model_id/phone_numbers"

headers = {"Authorization": "Bearer <token>"}

response = requests.put(url, headers=headers)

print(response.json())
```

**`attach-phone-numbers-to-assistant_example`**

```go attach-phone-numbers-to-assistant_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.synthflow.ai/v2/assistants/model_id/phone_numbers"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`attach-phone-numbers-to-assistant_example`**

```ruby attach-phone-numbers-to-assistant_example
require 'uri'
require 'net/http'

url = URI("https://api.synthflow.ai/v2/assistants/model_id/phone_numbers")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

**`attach-phone-numbers-to-assistant_example`**

```java attach-phone-numbers-to-assistant_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.synthflow.ai/v2/assistants/model_id/phone_numbers")
  .header("Authorization", "Bearer <token>")
  .asString();
```

**`attach-phone-numbers-to-assistant_example`**

```csharp attach-phone-numbers-to-assistant_example
using RestSharp;

var client = new RestClient("https://api.synthflow.ai/v2/assistants/model_id/phone_numbers");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

**`attach-phone-numbers-to-assistant_example`**

```swift attach-phone-numbers-to-assistant_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.synthflow.ai/v2/assistants/model_id/phone_numbers")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

A number can serve only one inbound agent at a time, but it can be in the pool of several outbound agents.

## Removing a number

[Detach phone number](/api-reference/platform-api/agents/detach-phone-number-from-assistant) removes one number from the pool by its slug.

### Request

DELETE [https://api.synthflow.ai/v2/assistants/\{model_id}/phone_numbers/\{phone_number_slug}](https://api.synthflow.ai/v2/assistants/\{model_id}/phone_numbers/\{phone_number_slug})

**`detach-phone-number-from-assistant_example`**

```curl detach-phone-number-from-assistant_example
curl -X DELETE https://api.synthflow.ai/v2/assistants/model_id/phone_numbers/16286666348 \
     -H "Authorization: Bearer <token>"
```

**`detach-phone-number-from-assistant_example`**

```python detach-phone-number-from-assistant_example
import requests

url = "https://api.synthflow.ai/v2/assistants/model_id/phone_numbers/16286666348"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

**`detach-phone-number-from-assistant_example`**

```go detach-phone-number-from-assistant_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.synthflow.ai/v2/assistants/model_id/phone_numbers/16286666348"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`detach-phone-number-from-assistant_example`**

```ruby detach-phone-number-from-assistant_example
require 'uri'
require 'net/http'

url = URI("https://api.synthflow.ai/v2/assistants/model_id/phone_numbers/16286666348")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

**`detach-phone-number-from-assistant_example`**

```java detach-phone-number-from-assistant_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.synthflow.ai/v2/assistants/model_id/phone_numbers/16286666348")
  .header("Authorization", "Bearer <token>")
  .asString();
```

**`detach-phone-number-from-assistant_example`**

```csharp detach-phone-number-from-assistant_example
using RestSharp;

var client = new RestClient("https://api.synthflow.ai/v2/assistants/model_id/phone_numbers/16286666348");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

**`detach-phone-number-from-assistant_example`**

```swift detach-phone-number-from-assistant_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.synthflow.ai/v2/assistants/model_id/phone_numbers/16286666348")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

The number stops routing calls to the agent as soon as the request succeeds. Calls to it no longer reach the agent, and the agent can no longer place calls from it. The number stays in your workspace, ready to attach to another agent.

## Outbound caller ID

[Make a call](/api-reference/platform-api/calls/voice-call) takes an optional `from_phone_number`, which sets the caller ID for that call. It must be a number in the agent's pool.

```json
{
  "model_id": "0ae2859d-c25c-4d56-a9f3-809387b725ce",
  "phone": "+14155550123",
  "name": "John Doe",
  "from_phone_number": "+16286666348"
}
```

Without `from_phone_number`, the call uses the agent's default outbound number. **Call logs** show the number each call was placed from, so you can check which caller ID was used.

## FAQ

#### Does number pooling work for inbound agents?

Yes. Attach several numbers to an inbound agent, and calls to any of them reach that agent.

#### Can I send phone numbers and slugs in the same attach request?

No. Choose one of the two in each request.

#### Does a detached number still reach the agent?

No. Once the detach request succeeds, calls to the number no longer reach the agent. Attach the number again to restore routing.