Get documents
curl --request GET \
--url https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents \
--header 'Authorization: Bearer <token>'import requests
url = "https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"documents": [
{
"data_source_id": "3b7d9f1e5a",
"created": 1625097600,
"document_id": "2c4a6e8d0f",
"title": "Customer Support FAQ",
"mime_type": "text/md",
"timestamp": 1625097600,
"tags": [
"customer_support",
"faq"
],
"parent_id": "1234f4567c",
"parents": [
"7b9d1f3e5a",
"2c4a6e8d0f"
],
"source_url": "https://example.com/support/article1",
"hash": "a1b2c3d4e5",
"text_size": 1024,
"chunk_count": 5,
"chunks": [
{
"chunk_id": "9f1d3b5a7c",
"text": "This is the first chunk of the document.",
"embedding": [
0.1,
0.2,
0.3,
0.4
]
},
{
"chunk_id": "4a2c6e8b0d",
"text": "This is the second chunk of the document.",
"embedding": [
0.5,
0.6,
0.7,
0.8
]
}
],
"text": "This is the full text content of the document. It contains multiple paragraphs and covers various topics related to customer support.",
"token_count": 150
}
],
"total": 123
}Datasources
Get documents
Get documents in the data source identified by in the workspace identified by .
GET
/
api
/
v1
/
w
/
{wId}
/
spaces
/
{spaceId}
/
data_sources
/
{dsId}
/
documents
Get documents
curl --request GET \
--url https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents \
--header 'Authorization: Bearer <token>'import requests
url = "https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://dust.tt/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"documents": [
{
"data_source_id": "3b7d9f1e5a",
"created": 1625097600,
"document_id": "2c4a6e8d0f",
"title": "Customer Support FAQ",
"mime_type": "text/md",
"timestamp": 1625097600,
"tags": [
"customer_support",
"faq"
],
"parent_id": "1234f4567c",
"parents": [
"7b9d1f3e5a",
"2c4a6e8d0f"
],
"source_url": "https://example.com/support/article1",
"hash": "a1b2c3d4e5",
"text_size": 1024,
"chunk_count": 5,
"chunks": [
{
"chunk_id": "9f1d3b5a7c",
"text": "This is the first chunk of the document.",
"embedding": [
0.1,
0.2,
0.3,
0.4
]
},
{
"chunk_id": "4a2c6e8b0d",
"text": "This is the second chunk of the document.",
"embedding": [
0.5,
0.6,
0.7,
0.8
]
}
],
"text": "This is the full text content of the document. It contains multiple paragraphs and covers various topics related to customer support.",
"token_count": 150
}
],
"total": 123
}Authorizations
Your DUST API key is a Bearer token.
Path Parameters
ID of the workspace
ID of the space
ID of the data source
Query Parameters
The IDs of the documents to fetch (optional)
Limit the number of documents returned
Offset the returned documents
⌘I