# Crédits

{% hint style="warning" %}
Limite : 5 requêtes par minute
{% endhint %}

## URL

<mark style="color:red;">`GET`</mark> `https://api.voicepartner.fr/v1/me`

#### **Paramètres obligatoires**

<table><thead><tr><th width="142">Nom</th><th>Valeur</th></tr></thead><tbody><tr><td><code>apiKey</code></td><td><a href="https://my.voicepartner.fr/app/api">Votre clé API</a></td></tr></tbody></table>

#### Paramètres optionnels

<table><thead><tr><th width="142">Nom</th><th>Valeur</th></tr></thead><tbody><tr><td><code>_format</code></td><td><code>json</code>  ou  <code>xml</code></td></tr></tbody></table>

#### Requêtes

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

```php
<?php
 
        // Prepare data for GET request
        $data = 'YOUR_API_KEY';
 
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL,'https://api.voicepartner.fr/v1/me/'.$data);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
 
 
        $result = curl_exec($curl);
        curl_close($curl);
 
        // Process your response here
        echo $result;
?>
```

{% endtab %}

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

```vbnet
cURL
Imports System.IO
Imports System.Net
 
Module Module1
 
  Sub Main()
 
    Dim base_url As String = "https://api.voicepartner.fr/v1/"
    Dim apiKey As String = "VOTRE_APIKEY"
 
    #check credits
    Dim url As String
    url = base_url & "me" & "/" & apiKey
 
    Dim credits As String
    credits = apiRequest("GET", url, Nothing)
 
  End Sub
 
  Function apiRequest(method As String, url As String, parameters As String) As String
 
    Dim request As HttpWebRequest
    request = WebRequest.Create(url)
    request.Method = method
    request.Timeout = 10000   # timeout in ms
    request.ContentType = "application/json; charset=utf-8"
    request.ContentLength = 0
 
    #set POST data
    If Not String.IsNullOrEmpty(parameters) Then
      request.ContentLength = parameters.Length
      Using reqStream As StreamWriter = New StreamWriter(request.GetRequestStream())
        reqStream.Write(parameters)
      End Using
    End If
 
    #get response
    Dim returnValue As String = Nothing
    Using response As HttpWebResponse = request.GetResponse()
      If response.StatusCode = HttpStatusCode.OK Then
        Using resStream = response.GetResponseStream()
          If resStream IsNot Nothing Then
            Using reader As New StreamReader(resStream)
              returnValue = reader.ReadToEnd()
            End Using
          End If
        End Using
      End If
    End Using
    apiRequest = returnValue
 
  End Function
 
End Module
```

{% endtab %}

{% tab title="Python" %}

```python
# std
import logging
import json
from collections import OrderedDict
 
# 3p
import requests
 
API_KEY = "MY API KEY"
URL = "https://api.voicepartner.fr/v1"
 
class SMSPartner():
    def get_balance(self):
		url = URL + "/me/" + API_KEY
		r = requests.get(url)
		r_json = r.json()
		if r_json.get("success") == True:
			print(r_json)
			status = True
		else:
			print(r_json)
			status = False
		return status
```

{% endtab %}

{% tab title="cURL" %}

```
curl -H "Content-Type: application/json" -X GET  https://api.voicepartner.fr/v1/me/xxx
```

{% endtab %}

{% tab title="Nodejs" %}

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

// Replace 'YOUR_API_KEY' with your actual API key
const apiKey = 'YOUR_API_KEY';

// The URL of the API with the API key appended
const url = `https://api.voicepartner.fr/v1/me/${apiKey}`;

axios.get(url)
.then(response => {
console.log('Response:', response.data);
})
.catch(error => {
console.error('Error:', error.response ? error.response.data : error.message);
});
```

{% 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.HttpResponse.BodyHandlers;

public class CreditVoix {
    public static void main(String[] args) {
        // Replace 'YOUR_API_KEY' with your actual API key
        String apiKey = "YOUR_API_KEY";
        String url = "https://api.voicepartner.fr/v1/me/" + apiKey;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .build();

        client.sendAsync(request, BodyHandlers.ofString())
                .thenApply(HttpResponse::body)
                .thenAccept(System.out::println)
                .exceptionally(e -> {
                    System.out.println("Error: " + e.getMessage());
                    return null;
                })
                .join();
    }
}
```

{% endtab %}

{% tab title="Go" %}

```go
package main

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

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

	response, err := http.Get(url)
	if err != nil {
		fmt.Printf("Error: %s\n", err.Error())
		return
	}
	defer response.Body.Close()

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

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

{% endtab %}

{% tab title="C#" %}

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

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

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

{% endtab %}
{% endtabs %}

#### **Réponse**

{% tabs %}
{% tab title="json" %}
{% code fullWidth="true" %}

```json
{
    "success": true,
    "credit": "19",
    "currency": "€",
    "details": {
        "tts": {
            "h": 5,
            "m": 55,
            "s": 66
        },
        "tts_fixe": {
            "h": 3,
            "m": 44,
            "s": 55
        },
        "voice": {
            "message": 10
        }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### **Code erreurs**

| Code de réponse | Réponse                 |
| --------------- | ----------------------- |
| 10              | Clé API incorrecte      |
| 200             | Tout s’est bien passé ! |


---

# Agent Instructions: 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:

```
GET https://www.docpartner.dev/api/voice-partner/credits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
