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

# Test workflow draft

> Execute a test run of a workflow draft using sample or custom trigger payloads.

Executes an isolated test run of a workflow draft without activating production trigger listeners. Steps execute for real, providing exact execution logs and output data for debugging.

### Path Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | **Yes** | Unique identifier of the workflow (`wkf_...`). |

### Request Body

| Field | Type | Required | Description |
| - | - | - | - |
| `triggerPayload` | `object` | No | Optional JSON object containing mock trigger data to evaluate expressions against. |

### cURL Example

```bash theme={null}
curl -X POST "https://posttu.com/api/v1/workflow/wkf_abc123/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "triggerPayload": {
      "item": {
        "title": "Breaking Tech News",
        "description": "Artificial intelligence breakthrough announced today.",
        "link": "https://example.com/article-1"
      }
    }
  }'
```

### Response Example

```json theme={null}
{
  "data": {
    "runId": "run_test_999",
    "status": "SUCCESS",
    "mode": "test",
    "startedAt": "2026-07-29T22:20:00.000Z",
    "finishedAt": "2026-07-29T22:20:01.250Z",
    "durationMs": 1250
  },
  "success": true
}
```


## OpenAPI

````yaml openapi.json POST /api/v1/workflow/{id}/test
openapi: 3.1.0
info:
  title: Posttu API
  version: 1.0.0
  description: >-
    Posttu V1 REST API — Workflow automation, social-media post management,
    inbox, tags, and calendar.
servers:
  - url: https://posttu.com
    description: Production
security: []
paths:
  /api/v1/workflow/{id}/test:
    post:
      tags:
        - Workflow
      summary: Test run a workflow
      parameters:
        - schema:
            type: string
            description: Workflow ID
            example: wkf_123abc
          required: true
          description: Workflow ID
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestWorkflowRun'
      responses:
        '200':
          description: Test run result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowTestRunResponse'
        '401':
          description: Error response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TestWorkflowRun:
      type: object
      properties:
        workflowId:
          type: string
          description: Workflow ID to test
          example: wkf_123abc
        triggerPayload:
          type: object
          additionalProperties: {}
          description: Payload to send to trigger
          example:
            userId: usr_123
      required:
        - workflowId
    WorkflowTestRunResponse:
      type: object
      properties:
        runId:
          type: string
          description: Test run ID
          example: test_run_123
        workflowId:
          type: string
          description: Workflow ID
        status:
          type: string
          enum:
            - PENDING
            - RUNNING
            - COMPLETED
            - FAILED
            - PAUSED
            - CANCELED
          description: Workflow run status
          example: COMPLETED
        output:
          type: object
          additionalProperties: {}
          description: Test output
        logs:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowRunLog'
          description: Execution logs
        duration:
          type: number
          description: Execution duration in ms
          example: 1500
      required:
        - runId
        - workflowId
        - status
    WorkflowRunLog:
      type: object
      properties:
        id:
          type: string
          description: Log ID
        stepId:
          type: string
          description: Step ID
        stepName:
          type: string
          description: Step name
        status:
          type: string
          enum:
            - PENDING
            - RUNNING
            - COMPLETED
            - FAILED
            - PAUSED
            - CANCELED
          description: Workflow run status
          example: COMPLETED
        message:
          type: string
          description: Log message
        output:
          description: Step output
        error:
          type:
            - string
            - 'null'
          description: Error details
        timestamp:
          type: string
          format: date-time
          description: Log timestamp
      required:
        - id
        - stepId
        - stepName
        - status
        - timestamp
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: 'Pass your API key via the Authorization header: `Bearer <api-key>`'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.