---
title: "Start a workflow execution as a new session or a new attempt of an existing session"
method: PUT
path: "/api/attempts"
tags: ["Attempt"]
---

# Start a workflow execution as a new session or a new attempt of an existing session

`PUT /api/attempts`

"resume" is used to rerun an attempt. It is used in the case an attempt failed then users want to resume it from the middle.It has two modes "failed" or "from" to set the way to resume.In "failed" mode, the attempt specified by "attemptId" is resumed from the failed tasks.In "from" mode, the attempt is resumed from the task which is set in "from" field.

## Request body

- RestSessionAttemptRequest — Request body for new attempt
  - `allowQueueing` boolean — Whether an attempt can be queued when the maximum attempt limit is reached.
  - `params` object, required — parameters as json
  - `projectName` string — project name. workflowId or (projectName and workflowName) are required
  - `resume` union — Configuration to resume an attempt. {"mode": "failed", "attemptId": "12345"} or {"mode": "from", "attemptId": "12345", "from": "+t1"}
    - object — Configuration to resume an attempt from the specified task
      - `attemptId` string, required — attemptId
      - `from` string, required — the task name to resume
      - `mode` 'from' | 'failed', required — mode: "from" or "failed"
    - object — Configuration to resume an attempt from the failed task
      - `attemptId` string, required — attemptId
      - `mode` 'from' | 'failed', required — mode: "from" or "failed"
  - `retryAttemptName` string — unique attempt name for retry
  - `sessionTime` string, date-time, required — session time
  - `workflowId` string — workflow ID. workflowId or (projectName and workflowName) are required
  - `workflowName` string — workflow name. workflowId or (projectName and workflowName) are required

## Response `200`

return an attempt

- RestSessionAttempt — Response of an attempt
  - `cancelRequested` boolean, required — true if kill requested
  - `createdAt` string, date-time, required — created time
  - `done` boolean, required — true if the attempt finished
  - `finishedAt` string, date-time — finished time
  - `id` string, required — attempt ID
  - `index` integer, required — index for multiple attempts
  - `params` object, required — passed parameters as JSON
  - `poolId` string — ID of the pool to which this attempt is assigned.
  - `project` IdAndName, required — Name and ID
    - `id` string, required — ID
    - `name` string, required — name
  - `retryAttemptName` string, required — attempt name for retry
  - `sessionId` string, required — session ID
  - `sessionTime` string, required — session time
  - `sessionUuid` string, uuid, required — unique UUID of this session
  - `status` 'blocked' | 'queued' | 'running' | 'canceling' | 'success' | 'error' | 'killed', required — The current status of the attempt.
  - `success` boolean, required — true if the attempt finished successfully
  - `workflow` NameOptionalId, required — Name and optional ID
    - `id` string — ID
    - `name` string, required — name

## Other responses

- `409` — session or attempt already exist. return the existing attempt.

---

[API](https://skmtc.net/treasure/apis/treasure-workflow.md) · [All operations](https://skmtc.net/treasure/apis/treasure-workflow/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/treasure/treasure-workflow/revisions/4eedf1838ef4/schema)
