How can I create multiple sprints in one scrum board with API?

    "sprints": [
        "name": "API Testing",
        "originBoardId": 570
        "name": "API Testing",
        "originBoardId": 570

        "name": "API Testing",
        "originBoardId": 570

        "name": "API Testing",
        "originBoardId": 570

You can use a REST call for each sprint you need to create.

See the documentation here

  "startDate": "2023-08-29T00:00:00.000+02:00",
  "name": "Sprint Name",
  "endDate": "2023-08-28T13:00:00.000+02:00",
  "originBoardId": 1234

In you code
create connection to server
for each sprint you want to create
create sprint
close connection

1 Like

Hello @SurenderKannemoni is this your solution :slight_smile:

1 Like

Hi @GrahamTwine1
Yes. It’s me
I am able to create with running a postman collection. but I am looking for JSON request payload to create multiple sprints in single REST call.

Hello @SurenderKannemoni one cannot do this in “a single request”

One can do this in multiple calls.
In your client code create variables for things like the sprint name, board id and dates.
Then in your code do this in a loop.

This is not using the REST API but rather groovy from scriptrunner.

import org.apache.log4j.Level
import groovy.util.logging.Log4j
import org.joda.time.DateTime

import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean

import com.atlassian.greenhopper.service.sprint.SprintManager
import com.atlassian.greenhopper.service.sprint.Sprint
import com.atlassian.greenhopper.service.sprint.Sprint.SprintBuilder

import com.atlassian.greenhopper.service.ServiceOutcome

import com.onresolve.annotation.Nullable
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin


    Console Example
        def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
        new AutoSprintBuilder().createPiSprints(loggedInUser, [556L, 557L, 580L], ['sprint 1', 'Spring 2'])


public class AutoSprintBuilder {

    private SprintManager sprintManager

    public AutoSprintBuilder() {

    public void createSprints(ApplicationUser loggedInUser, List<Long> boardIds, List<String> sprintNames) {
        DateTime startDate = new DateTime(2023, 9, 1, 12, 0, 0, 0)
        DateTime endDate = new DateTime(2023, 9, 14, 12, 0, 0, 0)
        String goal = 'We always need goals'

        boardIds.each { boardId ->
            sprintNames.each { name ->

      "Creating sprint $name on board $boardId")
                // For REST, instead of calling the SprintManager with a Sprint in the next two lines
               // Call the REST API instead with a payload
                Sprint sprint = buildFutureSprint(name, boardId, goal, startDate, endDate)
                ServiceOutcome<Sprint> result = sprintManager.createSprint(sprint)

      "Completed creating sprint $name with id ${result.get()?.id}")

                if ( result.errors.errors.size() > 0) {
                    log.error("An error occured.")

        Sprint Name and Board ID are mandatory
    private Sprint buildFutureSprint (
                    String   name,
                    long     boardId,
          @Nullable String   goal,
          @Nullable DateTime startDate,
          @Nullable DateTime endDate
    ) {

        SprintBuilder builder = Sprint.builder()

        if ( startDate ) builder = builder.startDate(startDate)
        if ( endDate )   builder = builder.endDate(endDate)
        if ( goal )      builder = builder.goal(goal)


1 Like