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

# Scheduled Task ausführen

> Stelle einen Lauf einer Scheduled Task in die Queue, die diesem Workspace-API-Key gehört

Stellt einen Lauf einer Scheduled Task in die Queue, die diesem Workspace-API-Key gehört. Der Aufruf kehrt zurück, sobald der Lauf eingereiht ist. Er wartet nicht auf die Konversation.

`conversationId` in dieser Antwort ist immer `null`. Nutze `runId`, um den eingereihten Lauf zu erkennen.

## Basis-URL

```
https://api.langdock.com/automations/v1/{automationId}/run
```

<Warning>
  **Dedicated Deployments**

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

## Benötigte Scopes

Dieser Endpoint braucht den Scope `AUTOMATION_API` (**Scheduled Tasks API**) auf einem Workspace-API-Key.

## Parameter

| Parameter      | In   | Typ    | Pflicht | Beschreibung             |
| -------------- | ---- | ------ | ------- | ------------------------ |
| `automationId` | Pfad | string | Ja      | UUID der Scheduled Task. |

Dieser Endpoint hat keinen Body. Du kannst eine pausierte Aufgabe ausführen. Der Lauf setzt `active` nicht von allein wieder auf `true`.

## Beispiel

```javascript theme={null}
const axios = require("axios");

async function runScheduledTask(automationId) {
  const response = await axios.post(
    `https://api.langdock.com/automations/v1/${automationId}/run`,
    null,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY"
      }
    }
  );

  console.log(response.data.runId);
}

runScheduledTask("550e8400-e29b-41d4-a716-446655440000");
```

## Antwortformat

### Erfolgreiche Antwort (200 OK)

```typescript theme={null}
{
  runId: string;
  conversationId: null;
}
```

## Fehlerbehandlung

| Statuscode | Beschreibung                                                                                                             |
| ---------- | ------------------------------------------------------------------------------------------------------------------------ |
| 400        | Ungültige Task-ID                                                                                                        |
| 401        | Ungültiger oder fehlender API-Key, oder der Key-User wurde nicht gefunden                                                |
| 403        | `AUTOMATION_API` fehlt, persönlicher API-Key, Scheduled Tasks deaktiviert, kein Produktzugriff oder Code `TRIAL_EXPIRED` |
| 404        | Message `AUTOMATION_NOT_FOUND`                                                                                           |
| 405        | Methode nicht erlaubt                                                                                                    |
| 429        | Rate Limit überschritten                                                                                                 |
| 500        | Interner Serverfehler                                                                                                    |

<Info>
  Langdock blockiert Anfragen aus Browser-Origins absichtlich, um deinen API-Key zu schützen und deine Anwendungen sicher zu halten. Mehr dazu findest du im Guide zu [API Key Best Practices](/de/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>


## OpenAPI

````yaml POST /automations/v1/{automationId}/run
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
    description: Production
security:
  - bearerAuth: []
paths:
  /automations/v1/{automationId}/run:
    post:
      tags:
        - Scheduled Tasks
      summary: Run a scheduled task
      description: >-
        Enqueues one run and returns immediately. conversationId is null. A
        paused task can be run, and active stays unchanged.
      operationId: runScheduledTask
      parameters:
        - name: automationId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Run queued. Body is runId and conversationId null.
        '400':
          description: Invalid task id
        '401':
          description: Invalid or missing API key, or the key user was not found
        '403':
          description: >-
            Missing AUTOMATION_API, a personal API key, Scheduled Tasks
            disabled, no product access, or TRIAL_EXPIRED
        '404':
          description: Message AUTOMATION_NOT_FOUND
        '405':
          description: Method not allowed
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````