> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow-Nutzung exportieren

> API-Endpunkt zum Exportieren von Workflow-Nutzungsdaten, inklusive Kosten, Läufen und Auslastung des monatlichen Caps

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](/de/developer/usage-export-api/intro-to-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](/de/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
* **Datenschutz**: Wenn Daten auf Nutzerebene deaktiviert sind, entfallen `workflow_owner_id` und `workflow_owner_email`. Private Workflows, die nur der Owner sieht, werden dann ebenfalls ausgeschlossen.

## Basis-URL

```
https://api.langdock.com/export/workflows
```

<Warning>
  **Dedicated Deployments**

  Ersetze `api.langdock.com` durch `<your-deployment-url>/api/public` in allen Anfragen.
</Warning>

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

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

`group_by` wird für Workflow-Exporte nicht unterstützt.


## OpenAPI

````yaml POST /export/workflows
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
    description: Production
security:
  - bearerAuth: []
paths:
  /export/workflows:
    post:
      tags:
        - Usage Export
      summary: Export workflow usage data
      description: >-
        Export cost, run counts, and monthly cap utilization for workflows in
        the workspace
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsageExportRequest'
      responses:
        '200':
          description: Export successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageExportResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageExportError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageExportError'
        '404':
          description: No data found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageExportError'
components:
  schemas:
    UsageExportRequest:
      type: object
      description: Request body for usage export endpoints
      properties:
        from:
          type: object
          description: Start date and timezone for the export
          properties:
            date:
              type: string
              format: date-time
              description: Start date in ISO 8601 format
              example: '2024-01-01T00:00:00.000Z'
            timezone:
              type: string
              description: Timezone for the date range
              example: UTC
          required:
            - date
            - timezone
        to:
          type: object
          description: End date and timezone for the export
          properties:
            date:
              type: string
              format: date-time
              description: End date in ISO 8601 format
              example: '2024-01-31T23:59:59.999Z'
            timezone:
              type: string
              description: Timezone for the date range
              example: UTC
          required:
            - date
            - timezone
      required:
        - from
        - to
    UsageExportResponse:
      type: object
      description: Successful response from usage export endpoints
      properties:
        success:
          type: boolean
          description: Indicates if the export was successful
          example: true
        data:
          type: object
          description: Export data information
          properties:
            filePath:
              type: string
              description: Path to the generated export file
              example: >-
                agents-usage/workspace-id/agents-usage-2024-01-01-2024-01-31-abc12345.csv
            downloadUrl:
              type: string
              format: uri
              description: Signed URL to download the export file
              example: https://storage.example.com/signed-url
            dataType:
              type: string
              description: Type of data exported
              enum:
                - assistants
                - agents
                - api_keys
                - users
                - projects
                - models
                - workflows
              example: assistants
            recordCount:
              type: integer
              description: Number of records in the export
              example: 1250
            dateRange:
              type: object
              description: Actual date range of the exported data
              properties:
                from:
                  type: string
                  format: date-time
                  description: Start date of the export
                  example: '2024-01-01T00:00:00.000Z'
                to:
                  type: string
                  format: date-time
                  description: End date of the export
                  example: '2024-01-31T23:59:59.999Z'
              required:
                - from
                - to
          required:
            - filePath
            - downloadUrl
            - dataType
            - recordCount
            - dateRange
      required:
        - success
        - data
    UsageExportError:
      type: object
      description: Error response from usage export endpoints
      properties:
        message:
          type: string
          description: Detailed error message
          example: No usage data found for the selected period
        code:
          type: string
          description: Machine-readable error code
          example: NOT_FOUND
        details:
          type: object
          description: >-
            Additional error context. Oversized exports include the scanned row
            counts and the configured row limit.
      required:
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````