> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.pinnacle.sh/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.pinnacle.sh/_mcp/server.

# Detach Campaign

DELETE https://api.pinnacle.sh/phone-numbers/detach-campaign
Content-Type: application/json

Remove the association between a phone number and its attached campaign.

Reference: https://docs.pinnacle.sh/api-reference/phone-numbers/detach-campaign

## Authentication

- `PINNACLE-API-KEY` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects a detachCampaignSchema.

- `phones` (list of string, required) — List of phone numbers (E.164 format).&#x20; **Limit:** 1 to 10

## Response

### 200

Successfully detached the campaign.

- `phoneNumbers` (list of PhoneNumberCampaignDetachPhoneNumbersItems, required) — List of phone numbers.
- `failed` (list of PhoneNumberCampaignDetachFailedItems, required) — List of numbers that were not failed to be detached.

## Errors

### 400 Bad Request Error

Validation failed. The payload has missing required fields and/or invalid types.&#x20; See [https://zod.dev/error-formatting](https://zod.dev/error-formatting) for more information.

- `description` (string, required) — Human-readable summary of validation failures.
- `errors` (ZodErrorErrors, required) — Structured dictionary of issues containing two main sections: - `errors`: Array of global validation errors not tied to specific fields - `properties`: Object mapping field names to their specific validation errors, where each field contains an `errors` array

### 401 Unauthorized Error

The request lacks valid authentication credentials or the provided credentials are invalid.&#x20; Ensure you're including a valid API key in the request headers and that your account has the necessary permissions to access this endpoint.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

### 403 Forbidden Error

Your subscription does not include access to this feature.&#x20; This occurs when attempting to use functionality that requires a higher subscription tier. Please upgrade your subscription to access this feature.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

### 404 Not Found Error

The requested resource could not be found.&#x20; This may occur if the identifier is incorrect, the resource has been deleted, or you don't have permission to access it.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

### 500 Internal Server Error

An unexpected error occurred on Pinnacle's servers while processing your request.&#x20; If this error persists, please contact support with the request details.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

### 501 Not Implemented Error

The requested functionality is not implemented on the server.&#x20; This typically indicates that the feature or endpoint you attempted to access is unavailable or not yet supported.

- `error` (string, required) — Human-readable description of the error that occurred, corresponding to the HTTP status code.

## Types

### PhoneNumberCampaignDetachPhoneNumbersItems

- `phoneNumber` (string, required) — Phone number (E.164 format).
- `campaign` (PhoneNumberCampaignDetachPhoneNumbersItemsCampaign, required) — Campaign that the phone is now detached from.

### PhoneNumberCampaignDetachFailedItems

- `number` (string, required) — Phone number (E.164 format).
- `error` (string, required) — Error related to why the number was not detached.

### ZodErrorErrors

Structured dictionary of issues containing two main sections: - `errors`: Array of global validation errors not tied to specific fields - `properties`: Object mapping field names to their specific validation errors, where each field contains an `errors` array

### PhoneNumberCampaignDetachPhoneNumbersItemsCampaign

Campaign that the phone is now detached from.

- `id` (string, required) — Id of the campaign. For `TOLL_FREE` campaigns, it will begin with the prefix `tf_`, for example: `tf_1234567890`. For `10DLC` campaigns, it will begin with the prefix `dlc_`, for example: `dlc_1234567890`.
- `name` (string, required) — Campaign's name.
- `type` (enum, required) — Type of messaging profile associated with the phone number.
  - Allowed values: `TOLL_FREE`, `10DLC`

## Examples

**Request**

```json
{
  "phones": [
    "+14155559876",
    "14155550111"
  ]
}
```

**Response**

```json
{
  "phoneNumbers": [
    {
      "phoneNumber": "+14155559876",
      "campaign": {
        "id": "dlc_1234567890",
        "name": "Summer Promo",
        "type": "10DLC"
      }
    }
  ],
  "failed": [
    {
      "number": "+14155550111",
      "error": "Number is not available. Make sure your team owns this number and it is not a sandbox number."
    }
  ]
}
```

**SDK Code**

```python Detached Campaign
import requests

url = "https://api.pinnacle.sh/phone-numbers/detach-campaign"

payload = { "phones": ["+14155559876", "14155550111"] }
headers = {
    "PINNACLE-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Detached Campaign
const url = 'https://api.pinnacle.sh/phone-numbers/detach-campaign';
const options = {
  method: 'DELETE',
  headers: {'PINNACLE-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"phones":["+14155559876","14155550111"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Detached Campaign
package main

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

func main() {

	url := "https://api.pinnacle.sh/phone-numbers/detach-campaign"

	payload := strings.NewReader("{\n  \"phones\": [\n    \"+14155559876\",\n    \"14155550111\"\n  ]\n}")

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

	req.Header.Add("PINNACLE-API-KEY", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Detached Campaign
require 'uri'
require 'net/http'

url = URI("https://api.pinnacle.sh/phone-numbers/detach-campaign")

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

request = Net::HTTP::Delete.new(url)
request["PINNACLE-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"phones\": [\n    \"+14155559876\",\n    \"14155550111\"\n  ]\n}"

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

```java Detached Campaign
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.pinnacle.sh/phone-numbers/detach-campaign")
  .header("PINNACLE-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"phones\": [\n    \"+14155559876\",\n    \"14155550111\"\n  ]\n}")
  .asString();
```

```php Detached Campaign
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.pinnacle.sh/phone-numbers/detach-campaign', [
  'body' => '{
  "phones": [
    "+14155559876",
    "14155550111"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'PINNACLE-API-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Detached Campaign
using RestSharp;

var client = new RestClient("https://api.pinnacle.sh/phone-numbers/detach-campaign");
var request = new RestRequest(Method.DELETE);
request.AddHeader("PINNACLE-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"phones\": [\n    \"+14155559876\",\n    \"14155550111\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Detached Campaign
import Foundation

let headers = [
  "PINNACLE-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["phones": ["+14155559876", "14155550111"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.pinnacle.sh/phone-numbers/detach-campaign")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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