# restoreWorkflowVersionAsDraft

Roll back: copy an OLDER version (workflowAutomationId from getWorkflow.versions) into the DRAFT, then publish it with promoteWorkflowDraft. Only a PAUSED version a later-published one superseded (compare publishedAt); the most recently published one is refused (resume it with resumeWorkflowVersion). REPLACES the current draft and its edits, so confirm first when one exists. Nothing goes live.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "restoreWorkflowVersionAsDraft", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `workflowAutomationId`: `ID!` (required)

## Response (data, an example)

```json
{
  "workflowAutomationsMutation": {
    "restoreWorkflowVersionAsDraft": {
      "id": "<ID>",
      "workflowGroupId": "<ID>",
      "name": "…",
      "status": "DRAFT"
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "restoreWorkflowVersionAsDraft",
    "variables": {
      "workflowAutomationId": "<workflowAutomationId>"
    }
  }'
```
