> 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/voice-message/rename-audio-file.md).

# Rename an Audio File

Rename an already existing audio file

## URL

<mark style="color:green;">`POST`</mark> `https://api.voicepartner.fr/v1/audio-file/rename`

{% hint style="warning" %}
Limit: 5 requests per minute
{% endhint %}

#### **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>tokenAudio</code></td><td>Identifier of the audio file</td></tr><tr><td><code>emailForNotification</code></td><td>The end-of-campaign notification will be sent to this email address</td></tr><tr><td><code>phoneNumbers</code></td><td><p>Recipients' mobile phone numbers.<br>To send multiple messages, the numbers must be separated by commas.<br>They can be:</p><ul><li>in national format (06xxxxxxxx) or international format (+336xxxxxxxx), for French numbers.</li></ul></td></tr></tbody></table>

#### **Optional Parameters**

<table><thead><tr><th width="262">Name</th><th>Value</th></tr></thead><tbody><tr><td><code>sender</code></td><td>Mobile phone number that can be called back. This number must first be validated on the <a href="https://my.voicepartner.fr">my.voicepartner.fr</a> platform.</td></tr><tr><td><code>scheduledDate</code></td><td>Send date of the message, in <code>YYYY-mm-dd H:m:00</code> format (e.g. <code>2021-02-02 14:15:00</code>). Only set this if you want the drops to be sent later.</td></tr><tr><td><code>notifyUrl</code></td><td>Callback URL for the campaign status, sent as GET</td></tr></tbody></table>

#### Requests

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

```php
<?php

// The API URL you want to send the request to
$url = 'https://api.voicepartner.fr/v1/audio-file/rename';

// The data you want to send as JSON
$data = array(
    'apiKey' => 'YOUR_API_KEY',
    'tokenAudio' => 'AUDIO_FILE_TOKEN',
    'filename' => 'File name'
);

// Encode the data as JSON
$data_json = json_encode($data);

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

// Configure cURL options to send JSON
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_json)
));

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

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

// Display the response
echo $response;
```

{% endtab %}

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

```vbnet
Imports System.Net.Http
Imports System.Text
Imports Newtonsoft.Json

Public Class RenameAudioFile
    Private ReadOnly _url As String = "https://api.voicepartner.fr/v1/audio-file/rename"
    Private ReadOnly _apiKey As String = "YOUR_API_KEY"
    Private ReadOnly _tokenAudio As String = "YOUR_TOKEN_AUDIO"
    Private ReadOnly _filename As String = "YOUR_FILE_NAME"

    Public Async Function RenameAudioFile() As Task
        Dim httpClient As New HttpClient()

        Dim data As New With {
            .apiKey = _apiKey,
            .tokenAudio = _tokenAudio,
            .filename = _filename
        }

        Dim jsonContent As String = JsonConvert.SerializeObject(data)
        Using content As New StringContent(jsonContent, Encoding.UTF8, "application/json")
            Try
                Dim response As HttpResponseMessage = Await httpClient.PostAsync(_url, content)
                If response.IsSuccessStatusCode Then
                    Dim responseContent As String = Await response.Content.ReadAsStringAsync()
                    Console.WriteLine(responseContent)
                Else
                    Console.WriteLine("Error: " & response.StatusCode)
                End If
            Catch ex As Exception
                Console.WriteLine("Request error: " & ex.Message)
            End Try
        End Using
    End Function

End Class
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

# The API URL you want to send the request to
url = 'https://api.voicepartner.fr/v1/audio-file/rename'

# The data you want to send as JSON
data = {
    'apiKey': 'YOUR_API_KEY',
    'tokenAudio': 'AUDIO_FILE_TOKEN',
    'filename': 'File name'
}

# Encode the data as JSON
data_json = json.dumps(data)

# Send the POST request with the JSON data
headers = {
    'Content-Type': 'application/json'
}
response = requests.post(url, data=data_json, headers=headers)

# Display the response
print(response.text)
```

{% endtab %}

{% tab title="cURL" %}

```
curl -Method Post -Uri "https://api.voicepartner.fr/v1/audio-file/rename" -Headers @{"Content-Type"="application/json"} -Body '{"apiKey": "YOUR_API_KEY", "tokenAudio": "AUDIO_FILE_TOKEN", "filename": "File name"}'
```

{% endtab %}

{% tab title="Nodejs" %}

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

// The API URL to rename an audio file
const url = 'https://api.voicepartner.fr/v1/audio-file/rename';

// The data to send as JSON
const data = {
    apiKey: 'YOUR_API_KEY',
    tokenAudio: 'AUDIO_FILE_TOKEN',
    filename: 'File name'
};

axios.post(url, data)
    .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;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse.BodyHandlers;

public class RenameAudioFile {

    public static void main(String[] args) {
        // The API URL to rename an audio file
        String url = "https://api.voicepartner.fr/v1/audio-file/rename";

        // Your authentication data and file information
        String apiKey = "YOUR_API_KEY";
        String tokenAudio = "YOUR_AUDIO_TOKEN";
        String newName = "NewFileName";

        // The data to send as JSON
        String json = String.format(
                "{\"apiKey\":\"%s\",\"tokenAudio\":\"%s\",\"filename\":\"%s\"}",
                apiKey, tokenAudio, newName);

        // Create an HttpClient instance
        HttpClient client = HttpClient.newHttpClient();

        // Build the request
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .POST(BodyPublishers.ofString(json))
                .build();

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

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

type RenameData struct {
	ApiKey     string `json:"apiKey"`
	TokenAudio string `json:"tokenAudio"`
	Filename   string `json:"filename"`
}

func main() {
	url := "https://api.voicepartner.fr/v1/audio-file/rename"
	data := RenameData{
		ApiKey:     "YOUR_API_KEY",
		TokenAudio: "AUDIO_FILE_TOKEN",
		Filename:   "File name",
	}

	payloadBytes, err := json.Marshal(data)
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}
	body := bytes.NewReader(payloadBytes)

	req, err := http.NewRequest("POST", url, body)
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}
	req.Header.Set("Content-Type", "application/json")

	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.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace API.ApiClients
{
    public class RenameAudioFile
    {
        public static async Task Main()
        {
            var url = "https://api.voicepartner.fr/v1/audio-file/rename";
            var data = new
            {
                apiKey = "YOUR_API_KEY",
                tokenAudio = "AUDIO_FILE_TOKEN",
                filename = "File name"
            };

            using (var client = new HttpClient())
            {
                try
                {
                    var json = JsonConvert.SerializeObject(data);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");
                    var response = await client.PostAsync(url, content);
                    var responseContent = await response.Content.ReadAsStringAsync();
                    Console.WriteLine("Response: " + responseContent);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error: " + ex.Message);
                }
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

#### **Response**

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

```json
{
    "success": true,
    "filename": "FILE NAME",
    "tokenAudio": "AUDIO FILE TOKEN"
}
```

{% endtab %}
{% endtabs %}


---

# 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/voice-message/rename-audio-file.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.
