> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Obter item do histórico

GET https://api.elevenlabs.io/v1/history/{history_item_id}

Recupera um item do histórico.

Reference: https://elevenlabs.io/docs/api-reference/history/get

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Path parameters

- `history_item_id` (string, required) — ID do item do histórico a ser usado. Você pode usar o endpoint [Get generated items](/docs/api-reference/history/list) para recuperar uma lista de itens do histórico.

## Response

### 200

Resposta bem-sucedida

- `history_item_id` (string, required) — O ID do item do histórico.
- `date_unix` (integer, required) — Timestamp Unix de criação do item.
- `character_count_change_from` (integer, required) — A alteração da contagem de caracteres de origem.
- `character_count_change_to` (integer, required) — A alteração da contagem de caracteres de destino.
- `content_type` (string, required) — O tipo de conteúdo do item gerado.
- `state` (any, required)
- `request_id` (string, optional, nullable) — O ID da solicitação.
- `voice_id` (string, optional, nullable) — O ID da voz usada.
- `model_id` (string, optional, nullable) — O ID do modelo.
- `voice_name` (string, optional, nullable) — O nome da voz.
- `voice_category` (enum, optional, nullable) — A categoria da voz. Pode ser 'premade', 'cloned', 'generated' ou 'professional'.
  - Allowed values: `premade`, `cloned`, `generated`, `professional`
- `text` (string, optional, nullable) — O texto usado para gerar o item de áudio.
- `settings` (map from string to any, optional, nullable) — As configurações do item de histórico.
- `share_link_id` (string, optional, nullable) — O ID do link de compartilhamento.
- `source` (enum, optional, nullable) — A origem do item do histórico. Pode ser TTS (texto para fala), STS (fala para texto), AN (áudio nativo), Projects, Dubbing, PlayAPI, PD (dicionário de pronúncia) ou ConvAI (plataforma de agentes).
  - Allowed values: `TTS`, `STS`, `Projects`, `PD`, `AN`, `Dubbing`, `PlayAPI`, `ConvAI`, `VoiceGeneration`, `InVPC`, `Flows`, `VoicePreview`
- `alignments` (HistoryAlignmentsResponseModel, optional, nullable) — Os alinhamentos do item do histórico.
- `dialogue` (list of DialogueInputResponseModel, optional, nullable) — O diálogo (pares de voz e texto) usado para gerar o item de áudio. Se definido, os campos `text` e `voice_id` de nível superior ficarão vazios.
- `output_format` (string, optional, nullable) — O formato de saída em que o áudio foi gerado originalmente.

## Errors

### 422 Unprocessable Entity Error

Erro de validação

- `detail` (list of ValidationError, optional)

## Types

### HistoryAlignmentsResponseModel

- `alignment` (HistoryAlignmentResponseModel, required) — O alinhamento do texto.
- `normalized_alignment` (HistoryAlignmentResponseModel, required) — O alinhamento normalizado do texto.

### DialogueInputResponseModel

- `text` (string, required) — O texto da linha de entrada do diálogo.
- `voice_id` (string, required) — O ID da voz usada nesta linha de entrada do diálogo.
- `voice_name` (string, required) — O nome da voz usada nesta linha de entrada do diálogo.

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### HistoryAlignmentResponseModel

- `characters` (list of string, required) — Os caracteres no alinhamento.
- `character_start_times_seconds` (list of double, required) — Os horários de início dos caracteres em segundos.
- `character_end_times_seconds` (list of double, required) — Os tempos finais dos caracteres em segundos.

### ValidationErrorLocItems

## Examples

**Response**

```json
{
  "history_item_id": "ja9xsmfGhxYcymxGcOGB",
  "date_unix": 1714650306,
  "character_count_change_from": 17189,
  "character_count_change_to": 17231,
  "content_type": "audio/mpeg",
  "state": null,
  "request_id": "BF0BZg4IwLGBlaVjv9Im",
  "voice_id": "21m00Tcm4TlvDq8ikWAM",
  "model_id": "eleven_multilingual_v2",
  "voice_name": "Rachel",
  "voice_category": "premade",
  "text": "Hello, world!",
  "settings": {
    "similarity_boost": 0.5,
    "stability": 0.71,
    "style": 0,
    "use_speaker_boost": true
  },
  "source": "TTS"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L';
const options = {method: 'GET'};

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

```go
package main

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

func main() {

	url := "https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L"

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

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

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

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

}
```

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

url = URI("https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L")

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

request = Net::HTTP::Get.new(url)

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

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

HttpResponse<String> response = Unirest.get("https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/history/VW7YKqPnjY4h39yTbx2L")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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