> 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.

# Pobierz wygenerowane elementy

GET https://api.elevenlabs.io/v1/history

Zwraca listę wygenerowanego przez ciebie audio (np. zamiana tekstu na mowę, mowa-mowa, Studio, dubbing). Generacje muzyki i SFX nie są uwzględniane i obecnie nie można ich pobrać przez API.

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

## 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

### Query parameters

- `page_size` (integer, optional, default: 100) — Maksymalna liczba elementów historii do zwrócenia. Nie może przekraczać 1000, domyślnie 100.
- `start_after_history_item_id` (string, optional, nullable) — ID, po którym rozpocząć pobieranie. Użyj tego parametru, aby stronicować dużą kolekcję elementów historii. Jeśli go nie podasz, elementy historii będą pobierane od najnowszego, w kolejności malejącej według daty utworzenia.
- `voice_id` (string, optional, nullable) — ID głosu, według którego filtrować. Wszystkie dostępne głosy możesz wyświetlić za pomocą endpointu [Pobierz głosy](/docs/api-reference/voices/search).
- `model_id` (string, optional, nullable) — Fraza używana do filtrowania elementów historii. Jeśli ją podasz, wymagane będzie source.
- `date_before_unix` (integer, optional, nullable) — Znacznik czasu Unix do filtrowania elementów historii przed tą datą (z wyłączeniem).
- `date_after_unix` (integer, optional, nullable) — Znacznik czasu Unix do filtrowania elementów historii po tej dacie (włącznie).
- `sort_direction` (enum, optional, nullable, default: desc) — Kierunek sortowania wyników.
  - Allowed values: `asc`, `desc`
- `search` (string, optional, nullable) — fraza używana do filtrowania
- `source` (enum, optional, nullable) — Źródło wygenerowanego elementu historii
  - Allowed values: `TTS`, `STS`, `Flows`

## Response

### 200

Pomyślna odpowiedź

- `history` (list of SpeechHistoryItemResponseModel, required) — Lista elementów historii mowy.
- `has_more` (boolean, required) — Czy są kolejne elementy historii do pobrania.
- `last_history_item_id` (string, optional, nullable) — ID ostatniego elementu historii.
- `scanned_until` (integer, optional, nullable) — Znacznik czasu ostatniego elementu historii.

## Errors

### 422 Unprocessable Entity Error

Błąd walidacji

- `detail` (list of ValidationError, optional)

## Types

### SpeechHistoryItemResponseModel

- `history_item_id` (string, required) — ID elementu historii.
- `date_unix` (integer, required) — Znacznik czasu Unix utworzenia elementu.
- `character_count_change_from` (integer, required) — Zmiana liczby znaków od.
- `character_count_change_to` (integer, required) — Zmiana liczby znaków do.
- `content_type` (string, required) — Typ zawartości wygenerowanego elementu.
- `state` (any, required)
- `request_id` (string, optional, nullable) — ID żądania.
- `voice_id` (string, optional, nullable) — ID użytego głosu.
- `model_id` (string, optional, nullable) — ID modelu.
- `voice_name` (string, optional, nullable) — Nazwa głosu.
- `voice_category` (enum, optional, nullable) — Kategoria głosu: „premade”, „cloned”, „generated” lub „professional”.
  - Allowed values: `premade`, `cloned`, `generated`, `professional`
- `text` (string, optional, nullable) — Tekst użyty do wygenerowania elementu audio.
- `settings` (map from string to any, optional, nullable) — Ustawienia elementu historii.
- `share_link_id` (string, optional, nullable) — ID linku udostępniania.
- `source` (enum, optional, nullable) — Źródło elementu historii. TTS (zamiana tekstu na mowę), STS (mowa na tekst), AN (Audio Native), Projects, Dubbing, PlayAPI, PD (słownik wymowy) lub ConvAI (platforma agentów).
  - Allowed values: `TTS`, `STS`, `Projects`, `PD`, `AN`, `Dubbing`, `PlayAPI`, `ConvAI`, `VoiceGeneration`, `InVPC`, `Flows`, `VoicePreview`
- `alignments` (HistoryAlignmentsResponseModel, optional, nullable) — Wyrównania elementu historii.
- `dialogue` (list of DialogueInputResponseModel, optional, nullable) — Dialog (pary głosu i tekstu) użyty do wygenerowania elementu audio. Jeśli jest ustawiony, pola `text` i `voice_id` najwyższego poziomu będą puste.
- `output_format` (string, optional, nullable) — Format wyjściowy, w którym audio zostało pierwotnie wygenerowane.

### ValidationError

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

### HistoryAlignmentsResponseModel

- `alignment` (HistoryAlignmentResponseModel, required) — Wyrównanie tekstu.
- `normalized_alignment` (HistoryAlignmentResponseModel, required) — Znormalizowane wyrównanie tekstu.

### DialogueInputResponseModel

- `text` (string, required) — Tekst wiersza wejściowego dialogu.
- `voice_id` (string, required) — ID głosu użytego w tej linii wejściowej dialogu.
- `voice_name` (string, required) — Nazwa głosu użytego w tej linii wejściowej dialogu.

### ValidationErrorLocItems

- string
- integer

### HistoryAlignmentResponseModel

- `characters` (list of string, required) — Znaki w wyrównaniu.
- `character_start_times_seconds` (list of double, required) — Czasy rozpoczęcia znaków w sekundach.
- `character_end_times_seconds` (list of double, required) — Czasy zakończenia znaków w sekundach.

## Examples

**Response**

```json
{
  "history": [
    {
      "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"
    }
  ],
  "has_more": true,
  "last_history_item_id": "ja9xsmfGhxYcymxGcOGB",
  "scanned_until": 1714650306
}
```

**SDK Code**

```python
import requests

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

querystring = {"date_after_unix":"1640995200","date_before_unix":"1640995200","model_id":"eleven_turbo_v2","search":"In the land far far away","sort_direction":"desc","source":"TTS"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/history?date_after_unix=1640995200&date_before_unix=1640995200&model_id=eleven_turbo_v2&search=In+the+land+far+far+away&sort_direction=desc&source=TTS';
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?date_after_unix=1640995200&date_before_unix=1640995200&model_id=eleven_turbo_v2&search=In+the+land+far+far+away&sort_direction=desc&source=TTS"

	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?date_after_unix=1640995200&date_before_unix=1640995200&model_id=eleven_turbo_v2&search=In+the+land+far+far+away&sort_direction=desc&source=TTS")

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?date_after_unix=1640995200&date_before_unix=1640995200&model_id=eleven_turbo_v2&search=In+the+land+far+far+away&sort_direction=desc&source=TTS")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/history?date_after_unix=1640995200&date_before_unix=1640995200&model_id=eleven_turbo_v2&search=In+the+land+far+far+away&sort_direction=desc&source=TTS');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/history?date_after_unix=1640995200&date_before_unix=1640995200&model_id=eleven_turbo_v2&search=In+the+land+far+far+away&sort_direction=desc&source=TTS");
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?date_after_unix=1640995200&date_before_unix=1640995200&model_id=eleven_turbo_v2&search=In+the+land+far+far+away&sort_direction=desc&source=TTS")! 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()
```