---
title: "Regenerate tasks for a cohort"
method: POST
path: "/cohorts/{id}/regenerate-tasks"
tags: ["Cohorts"]
---

# Regenerate tasks for a cohort

`POST /cohorts/{id}/regenerate-tasks`

## Request

- Base URL: `https://api.production.yourmedley.com`
- URL: `https://api.production.yourmedley.com/cohorts/{id}/regenerate-tasks`
- Auth: HTTP bearer

Regenerate tasks from templates for an existing cohort. Supports two modes - skip_existing (default) and replace_template_tasks.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `mode` 'skip_existing' | 'replace_template_tasks': skip_existing (default) adds only new templates, replace_template_tasks deletes all template tasks and recreates

## Response `200`

Tasks regenerated successfully

- object
  - `success` boolean
  - `data` object
    - `tasksGenerated` integer
    - `tasksDeleted` integer
    - `mode` string
  - `message` string

## Other responses

- `401`: Unauthorized
- `404`: Cohort not found

---

[API](https://skmtc.dev/withmedley/apis/medley-api.md) - [All operations](https://skmtc.dev/withmedley/apis/medley-api/llms.txt) - [OpenAPI document](https://skmtc.dev/withmedley/apis/medley-api/revisions/40aaac5ca6bd?raw)
