> For the complete documentation index, see [llms.txt](https://www.docpartner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.docpartner.dev/en/api/voice-partner/cancel-scheduled-send.md).

# Cancel a Scheduled Send

This request is used to cancel the scheduled sending of a voice message or voice SMS

## URL

<mark style="color:red;">`DELETE`</mark> `https://api.voicepartner.fr/v1/campaign/cancel`

#### **Required Parameters**

<table data-full-width="false"><thead><tr><th width="232">Name</th><th>Value</th></tr></thead><tbody><tr><td><code>apiKey</code></td><td><a href="https://my.voicepartner.fr/app/api">Your API key</a></td></tr><tr><td><code>campaignId</code></td><td>Message ID</td></tr></tbody></table>

#### Requests

{% tabs %}
{% tab title="PHP" %}

```php
<?php

// Enable error display for debugging
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

// The API URL to cancel the campaign
$apiKey = 'YOUR_API_KEY'; // Replace with your actual API key
$campaignId = 'CAMPAIGN_ID'; // Replace with the actual campaign ID

// Build the URL with the API key and campaign ID
$url = "https://api.voicepartner.fr/v1/campaign/cancel/$apiKey/$campaignId";

// Initialize cURL
$curl = curl_init($url);

// Configure cURL options for a DELETE request
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Cache-Control: no-cache'
));

// Execute the cURL request and store the response
$response = curl_exec($curl);

// Check whether an error occurred during the request
if (curl_errno($curl)) {
    echo 'cURL Error: ' . curl_error($curl);
} else {
    // Display the response
    echo 'Response: ' . $response;
}

// Close the cURL session
curl_close($curl);
```

{% endtab %}

{% tab title="VB.net" %}

```vbnet
Imports System.Net.Http

Public Class CancelScheduledSend
    Public Async Function CancelCampaignAsync() As Task
        Using client As New HttpClient()
            Dim apiKey As String = "YOUR_API_KEY"
            Dim campaignId As String = "CAMPAIGN_ID"
            Dim url As String = $"https://api.voicepartner.fr/v1/campaign/cancel/{apiKey}/{campaignId}"

            Try
                Dim response = Await client.DeleteAsync(url)
                Dim responseContent = Await response.Content.ReadAsStringAsync()

                If response.IsSuccessStatusCode Then
                    Console.WriteLine(responseContent)
                Else
                    Console.WriteLine($"Error: {response.StatusCode}")
                    Console.WriteLine($"Content: {responseContent}")
                End If
            Catch ex As Exception
                Console.WriteLine($"Exception: {ex.Message}")
            End Try
        End Using
    End Function
End Class
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# Enable error display for debugging
# In Python, errors are displayed by default when they occur.

# The API URL to cancel the campaign
apiKey = 'YOUR_API_KEY'  # Replace with your actual API key
campaignId = 'CAMPAIGN_ID'  # Replace with the actual campaign ID

# Build the URL with the API key and campaign ID
url = f"https://api.voicepartner.fr/v1/campaign/cancel/{apiKey}/{campaignId}"

# Configure HTTP headers
headers = {
    'Cache-Control': 'no-cache'
}

# Execute the DELETE request
response = requests.delete(url, headers=headers)

# Check whether an error occurred during the request
if response.status_code != 200:
    print(f'cURL Error: {response.status_code}')
else:
    # Display the response
    print(f'Response: {response.text}')
```

{% endtab %}

{% tab title="cURL" %}

```
curl -X DELETE 'https://api.voicepartner.fr/v1/campaign/cancel/YOUR_API_KEY/CAMPAIGN_ID'
```

{% endtab %}

{% tab title="Nodejs" %}

```javascript
const axios = require('axios');

// The API URL to cancel the campaign
const apiKey = 'YOUR_API_KEY';
const campaignId = 'CAMPAIGN_ID';
const url = `https://api.voicepartner.fr/v1/campaign/cancel/${apiKey}/${campaignId}`;

axios.delete(url)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error('Request error:', error);
    });
```

{% endtab %}

{% tab title="JAVA" %}

```java
package com.example.API;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class CancelScheduledSend {
    public static void main(String[] args) {
        // The API URL to cancel the campaign
        String apiKey = "YOUR_API_KEY";
        String campaignId = "CAMPAIGN_ID";
        String url = "https://api.voicepartner.fr/v1/campaign/cancel/" + apiKey + "/" + campaignId;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .DELETE() // This sets the request method to DELETE.
                .build();

        client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
                .thenApply(HttpResponse::body)
                .thenAccept(System.out::println)
                .exceptionally(e -> {
                    System.out.println("Request error: " + e.getMessage());
                    return null;
                })
                .join(); // Wait for the async operation to complete
    }
}
```

{% endtab %}

{% tab title="GO" %}

```go
package main

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

func main() {
	apiKey := "YOUR_API_KEY"
	campaignId := "CAMPAIGN_ID"
	url := fmt.Sprintf("https://api.voicepartner.fr/v1/campaign/cancel/%s/%s", apiKey, campaignId)

	req, err := http.NewRequest("DELETE", url, nil)
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}
	defer resp.Body.Close()

	respBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}

	fmt.Printf("Response: %s\n", string(respBody))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace API.ApiClients
{
    public class CancelScheduledSend
    {
        public static async Task Main()
        {
            var apiKey = "YOUR_API_KEY";
            var campaignId = "CAMPAIGN_ID";
            var url = $"https://api.voicepartner.fr/v1/campaign/cancel/{apiKey}/{campaignId}";

            using (var client = new HttpClient())
            {
                try
                {
                    var response = await client.DeleteAsync(url);
                    var content = await response.Content.ReadAsStringAsync();
                    Console.WriteLine("Response: " + content);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error: " + ex.Message);
                }
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### **Response**

{% tabs %}
{% tab title="json" %}

```json
{
    "success": true,
    "campaignId": "D572M",
    "assignedCredit": "1.8",
    "currency": "EUR"
}
```

{% endtab %}
{% endtabs %}

#### Error Codes

| Response Code | Message                 |
| ------------- | ----------------------- |
| 400           | Bad request             |
| 401           | Action not authorized   |
| 404           | Resource not authorized |
| 200           | Everything went fine!   |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.docpartner.dev/en/api/voice-partner/cancel-scheduled-send.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
