Export workflow usage data
curl --request POST \
--url https://api.langdock.com/export/workflows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": {
"date": "2024-01-01T00:00:00.000Z",
"timezone": "UTC"
},
"to": {
"date": "2024-01-31T23:59:59.999Z",
"timezone": "UTC"
}
}
'import requests
url = "https://api.langdock.com/export/workflows"
payload = {
"from": {
"date": "2024-01-01T00:00:00.000Z",
"timezone": "UTC"
},
"to": {
"date": "2024-01-31T23:59:59.999Z",
"timezone": "UTC"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: {date: '2024-01-01T00:00:00.000Z', timezone: 'UTC'},
to: {date: '2024-01-31T23:59:59.999Z', timezone: 'UTC'}
})
};
fetch('https://api.langdock.com/export/workflows', 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://api.langdock.com/export/workflows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => [
'date' => '2024-01-01T00:00:00.000Z',
'timezone' => 'UTC'
],
'to' => [
'date' => '2024-01-31T23:59:59.999Z',
'timezone' => 'UTC'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/export/workflows"
payload := strings.NewReader("{\n \"from\": {\n \"date\": \"2024-01-01T00:00:00.000Z\",\n \"timezone\": \"UTC\"\n },\n \"to\": {\n \"date\": \"2024-01-31T23:59:59.999Z\",\n \"timezone\": \"UTC\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.langdock.com/export/workflows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": {\n \"date\": \"2024-01-01T00:00:00.000Z\",\n \"timezone\": \"UTC\"\n },\n \"to\": {\n \"date\": \"2024-01-31T23:59:59.999Z\",\n \"timezone\": \"UTC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/export/workflows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": {\n \"date\": \"2024-01-01T00:00:00.000Z\",\n \"timezone\": \"UTC\"\n },\n \"to\": {\n \"date\": \"2024-01-31T23:59:59.999Z\",\n \"timezone\": \"UTC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"filePath": "agents-usage/workspace-id/agents-usage-2024-01-01-2024-01-31-abc12345.csv",
"downloadUrl": "https://storage.example.com/signed-url",
"dataType": "assistants",
"recordCount": 1250,
"dateRange": {
"from": "2024-01-01T00:00:00.000Z",
"to": "2024-01-31T23:59:59.999Z"
}
}
}{
"message": "No usage data found for the selected period",
"code": "NOT_FOUND",
"details": {}
}{
"message": "No usage data found for the selected period",
"code": "NOT_FOUND",
"details": {}
}{
"message": "No usage data found for the selected period",
"code": "NOT_FOUND",
"details": {}
}Usage Export API
Workflow-Nutzung exportieren
API-Endpunkt zum Exportieren von Workflow-Nutzungsdaten, inklusive Kosten, Läufen und Auslastung des monatlichen Caps
POST
/
export
/
workflows
Export workflow usage data
curl --request POST \
--url https://api.langdock.com/export/workflows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": {
"date": "2024-01-01T00:00:00.000Z",
"timezone": "UTC"
},
"to": {
"date": "2024-01-31T23:59:59.999Z",
"timezone": "UTC"
}
}
'import requests
url = "https://api.langdock.com/export/workflows"
payload = {
"from": {
"date": "2024-01-01T00:00:00.000Z",
"timezone": "UTC"
},
"to": {
"date": "2024-01-31T23:59:59.999Z",
"timezone": "UTC"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: {date: '2024-01-01T00:00:00.000Z', timezone: 'UTC'},
to: {date: '2024-01-31T23:59:59.999Z', timezone: 'UTC'}
})
};
fetch('https://api.langdock.com/export/workflows', 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://api.langdock.com/export/workflows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => [
'date' => '2024-01-01T00:00:00.000Z',
'timezone' => 'UTC'
],
'to' => [
'date' => '2024-01-31T23:59:59.999Z',
'timezone' => 'UTC'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.langdock.com/export/workflows"
payload := strings.NewReader("{\n \"from\": {\n \"date\": \"2024-01-01T00:00:00.000Z\",\n \"timezone\": \"UTC\"\n },\n \"to\": {\n \"date\": \"2024-01-31T23:59:59.999Z\",\n \"timezone\": \"UTC\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.langdock.com/export/workflows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": {\n \"date\": \"2024-01-01T00:00:00.000Z\",\n \"timezone\": \"UTC\"\n },\n \"to\": {\n \"date\": \"2024-01-31T23:59:59.999Z\",\n \"timezone\": \"UTC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.langdock.com/export/workflows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": {\n \"date\": \"2024-01-01T00:00:00.000Z\",\n \"timezone\": \"UTC\"\n },\n \"to\": {\n \"date\": \"2024-01-31T23:59:59.999Z\",\n \"timezone\": \"UTC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"filePath": "agents-usage/workspace-id/agents-usage-2024-01-01-2024-01-31-abc12345.csv",
"downloadUrl": "https://storage.example.com/signed-url",
"dataType": "assistants",
"recordCount": 1250,
"dateRange": {
"from": "2024-01-01T00:00:00.000Z",
"to": "2024-01-31T23:59:59.999Z"
}
}
}{
"message": "No usage data found for the selected period",
"code": "NOT_FOUND",
"details": {}
}{
"message": "No usage data found for the selected period",
"code": "NOT_FOUND",
"details": {}
}{
"message": "No usage data found for the selected period",
"code": "NOT_FOUND",
"details": {}
}Dieser Endpunkt exportiert Workflow-Nutzungsdaten für den gewählten Zeitraum, inklusive Kosten, Läufen und Auslastung des monatlichen Caps.
Bevor du startest
- Voraussetzungen und Rate Limits: Details findest du in der Übersicht zur Usage Export API.
- Browser-Anfragen: Langdock blockiert bewusst Browser-basierte Anfragen, um deinen API-Schlüssel zu schützen. Verwende API-Schlüssel serverseitig und speichere sie sicher. Mehr dazu unter Best Practices für API-Schlüssel.
- Datenschutz: Wenn Daten auf Nutzerebene deaktiviert sind, entfallen
workflow_owner_idundworkflow_owner_email. Private Workflows, die nur der Owner sieht, werden dann ebenfalls ausgeschlossen.
Basis-URL
https://api.langdock.com/export/workflows
Dedicated DeploymentsErsetze
api.langdock.com durch <your-deployment-url>/api/public in allen Anfragen.Enthaltene Daten
Der Workflow-Export gibt eine Zeile pro Nicht-Template-Workflow zurück, der im gewählten Zeitraum Läufe oder Kosten hatte.| Spalte | Beschreibung |
|---|---|
period_start | Startdatum des Berichts |
period_end | Enddatum des Berichts |
org_id | ID des Workspaces |
workflow_id | ID des Workflows |
workflow_name | Name des Workflows |
status | ACTIVE, INACTIVE oder NOT_DEPLOYED |
runs | Anzahl der Workflow-Läufe im gewählten Zeitraum |
total_cost_usd | Kosten in USD im gewählten Zeitraum |
monthly_limit_usd | Aktuelles monatliches USD-Cap des Workflows; null, wenn kein Cap gesetzt ist |
current_month_cost_usd | Kosten in USD im aktuellen Kalendermonat |
monthly_utilization_pct_current | current_month_cost_usd / monthly_limit_usd; null, wenn kein Cap gesetzt ist |
workflow_owner_id | ID des Workflow-Owners; entfällt, wenn Daten auf Nutzerebene deaktiviert sind |
workflow_owner_email | E-Mail des Workflow-Owners; entfällt, wenn Daten auf Nutzerebene deaktiviert sind |
monthly_limit_usd, current_month_cost_usd und monthly_utilization_pct_current beziehen sich auf das monatliche USD-Cap des Workflows und die Kosten im aktuellen Kalendermonat. Das sind nicht die Extra-Nutzung-Felder aus dem Nutzer-Export.
Zusätzliche Spalten für BYOK-Workspaces
| Spalte | Beschreibung |
|---|---|
sum_input_tokens | Gesamte Input-Tokens |
sum_cached_input_tokens | Cache-Read-Input-Tokens |
sum_cache_creation_tokens | Cache-Write-Input-Tokens |
sum_output_tokens | Gesamte Output-Tokens |
Weil BYOK-Workspaces eigene Modellschlüssel mitbringen, kann Langdock Token-Verbrauch direkt ausweisen. Das ist nicht möglich, wenn du Modelle direkt über Langdock beziehst.
group_by wird für Workflow-Exporte nicht unterstützt.Autorisierungen
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
application/json
War diese Seite hilfreich?