Schedules REST API
Grafana Cloud

Schedules REST API

Note

The documentation for this API is also available as an OpenAPI description.

Get the load test schedule

GET /cloud/v6/load_tests/{id}/schedule

Get the load test schedule.

Request parameters

NameDescriptionInRequiredType
X-Stack-Id

Numeric ID of the Grafana stack representing the request scope.

  • If the API is called with a Personal API token, the user must be a member of the specified stack.
  • If the API is called with a Grafana Stack API token, the value must be the ID of the corresponding stack.
headertrueinteger
idID of the load test.pathtrueinteger

200 response

OK.

Content types: application/json

ScheduleApiModel properties:

NameDescriptionRequiredType
created_byThe email of the user who created the schedule if applicable.truestring | null
deactivatedWhether the schedule is deactivated. A deactivated schedule will not trigger new test runs, but the schedule recurrence rule and expiration is not affected.trueboolean
idID of the schedule.trueinteger
load_test_idID of the test to run.trueinteger
next_runThe date of the next scheduled test run. The value is null if the schedule is expired and no more occurrences are expected in the future according to the recurrence rule.truestring | null , format: date-time
recurrence_ruleThe schedule recurrence settings. If null, the test will run only once on the starts date.trueScheduleRecurrenceRule | null
startsThe date on which the schedule will start running the test.truestring , format: date-time

ScheduleRecurrenceRule properties:

NameDescriptionRequiredType
bydayThe weekdays when the ‘WEEKLY’ recurrence will be applied. Cannot be set for other frequencies.falsearray | null
countDetermines how many times the recurrence will repeat.falseinteger | null
frequencytrueFrequency
intervalThe interval between each frequency iteration. An interval of 2 with ‘HOURLY’ frequency makes the test run once every 2 hours.falseinteger
untilA datetime instance specifying the upper-bound time limit of the recurrence.falsestring | null , format: date-time

The unit type of the recurrence interval.

Deactivated example
{
  "created_by": "user@example.com",
  "deactivated": true,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-20T01:46:04.021Z",
  "recurrence_rule": {
    "days": [],
    "ends": null,
    "frequency": "HOURLY",
    "interval": 2
  },
  "starts": "2024-07-16T08:46:04.021Z"
}
EveryTwoHours example
{
  "created_by": "user@example.com",
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-20T01:46:04.021Z",
  "recurrence_rule": {
    "byday": null,
    "count": null,
    "frequency": "HOURLY",
    "interval": 2,
    "until": null
  },
  "starts": "2024-07-16T08:46:04.021Z"
}
TriggeredOnceInThePast example
{
  "created_by": "user@example.com",
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": null,
  "recurrence_rule": null,
  "starts": "2023-08-01T12:00:00.000Z"
}
WeeklyOnWeekendsStopsAfter10Runs example
{
  "created_by": null,
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-17T08:46:04.021Z",
  "recurrence_rule": {
    "byday": [
      "SA",
      "SU"
    ],
    "count": 10,
    "frequency": "WEEKLY",
    "interval": 1,
    "until": null
  },
  "starts": "2024-07-16T08:46:04.021Z"
}

401 response

403 response

404 response

500 response

Set a schedule for the load test

POST /cloud/v6/load_tests/{id}/schedule

Set a schedule for the load test.

This operation overwrites any existing test schedule.

Monthly schedules running on days 29-31 are adjusted to run on the last day of the month if the target day doesn’t exist in a given month (for example, March 31 -> April 30).

Request parameters

NameDescriptionInRequiredType
X-Stack-Id

Numeric ID of the Grafana stack representing the request scope.

  • If the API is called with a Personal API token, the user must be a member of the specified stack.
  • If the API is called with a Grafana Stack API token, the value must be the ID of the corresponding stack.
headertrueinteger
idID of the load test.pathtrueinteger

Request body

Content types: application/json

CreateScheduleRequest properties:

NameDescriptionRequiredType
recurrence_ruleThe schedule recurrence settings. If null, the test will run only once on the starts date.trueScheduleRecurrenceRule | null
startsThe timezone-aware date on which the schedule will start running the test.truestring , format: date-time

ScheduleRecurrenceRule properties:

NameDescriptionRequiredType
bydayThe weekdays when the ‘WEEKLY’ recurrence will be applied. Cannot be set for other frequencies.falsearray | null
countDetermines how many times the recurrence will repeat.falseinteger | null
frequencytrueFrequency
intervalThe interval between each frequency iteration. An interval of 2 with ‘HOURLY’ frequency makes the test run once every 2 hours.falseinteger
untilA datetime instance specifying the upper-bound time limit of the recurrence.falsestring | null , format: date-time

The unit type of the recurrence interval.

EveryTwoHours example
{
  "recurrence_rule": {
    "frequency": "HOURLY",
    "interval": 2
  },
  "starts": "2024-07-16T08:46:04.021Z"
}
TriggeredOnce example
{
  "recurrence_rule": null,
  "starts": "2028-08-01T12:00:00.000Z"
}
WeeklyOnWeekendsStopsAfter10Runs example
{
  "recurrence_rule": {
    "byday": [
      "SA",
      "SU"
    ],
    "count": 10,
    "frequency": "WEEKLY"
  },
  "starts": "2024-07-16T08:46:04.021Z"
}

200 response

OK.

Content types: application/json

ScheduleApiModel properties:

NameDescriptionRequiredType
created_byThe email of the user who created the schedule if applicable.truestring | null
deactivatedWhether the schedule is deactivated. A deactivated schedule will not trigger new test runs, but the schedule recurrence rule and expiration is not affected.trueboolean
idID of the schedule.trueinteger
load_test_idID of the test to run.trueinteger
next_runThe date of the next scheduled test run. The value is null if the schedule is expired and no more occurrences are expected in the future according to the recurrence rule.truestring | null , format: date-time
recurrence_ruleThe schedule recurrence settings. If null, the test will run only once on the starts date.trueScheduleRecurrenceRule | null
startsThe date on which the schedule will start running the test.truestring , format: date-time

ScheduleRecurrenceRule properties:

NameDescriptionRequiredType
bydayThe weekdays when the ‘WEEKLY’ recurrence will be applied. Cannot be set for other frequencies.falsearray | null
countDetermines how many times the recurrence will repeat.falseinteger | null
frequencytrueFrequency
intervalThe interval between each frequency iteration. An interval of 2 with ‘HOURLY’ frequency makes the test run once every 2 hours.falseinteger
untilA datetime instance specifying the upper-bound time limit of the recurrence.falsestring | null , format: date-time

The unit type of the recurrence interval.

Deactivated example
{
  "created_by": "user@example.com",
  "deactivated": true,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-20T01:46:04.021Z",
  "recurrence_rule": {
    "days": [],
    "ends": null,
    "frequency": "HOURLY",
    "interval": 2
  },
  "starts": "2024-07-16T08:46:04.021Z"
}
EveryTwoHours example
{
  "created_by": "user@example.com",
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-20T01:46:04.021Z",
  "recurrence_rule": {
    "byday": null,
    "count": null,
    "frequency": "HOURLY",
    "interval": 2,
    "until": null
  },
  "starts": "2024-07-16T08:46:04.021Z"
}
TriggeredOnceInThePast example
{
  "created_by": "user@example.com",
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": null,
  "recurrence_rule": null,
  "starts": "2023-08-01T12:00:00.000Z"
}
WeeklyOnWeekendsStopsAfter10Runs example
{
  "created_by": null,
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-17T08:46:04.021Z",
  "recurrence_rule": {
    "byday": [
      "SA",
      "SU"
    ],
    "count": 10,
    "frequency": "WEEKLY",
    "interval": 1,
    "until": null
  },
  "starts": "2024-07-16T08:46:04.021Z"
}

400 response

401 response

403 response

404 response

500 response

List all schedules

GET /cloud/v6/schedules

List all schedules.

Request parameters

NameDescriptionInRequiredType
X-Stack-Id

Numeric ID of the Grafana stack representing the request scope.

  • If the API is called with a Personal API token, the user must be a member of the specified stack.
  • If the API is called with a Grafana Stack API token, the value must be the ID of the corresponding stack.
headertrueinteger
$countInclude collection length in the response object as @count.queryfalseboolean
$skipThe initial index from which to return the results.queryfalseinteger
$topNumber of results to return per page.
Default: 1000
Maximum: 1000
queryfalseinteger

200 response

OK.

Content types: application/json

ScheduleListResponse properties:

NameDescriptionRequiredType
@countObject count in the collection.falseinteger
@nextLinkA reference to the next page of results. The property is included until there are no more pages of results to retrieve.falsestring , format: uri
valueList of the resulting values.trueArray[ScheduleApiModel]

ScheduleApiModel properties:

NameDescriptionRequiredType
created_byThe email of the user who created the schedule if applicable.truestring | null
deactivatedWhether the schedule is deactivated. A deactivated schedule will not trigger new test runs, but the schedule recurrence rule and expiration is not affected.trueboolean
idID of the schedule.trueinteger
load_test_idID of the test to run.trueinteger
next_runThe date of the next scheduled test run. The value is null if the schedule is expired and no more occurrences are expected in the future according to the recurrence rule.truestring | null , format: date-time
recurrence_ruleThe schedule recurrence settings. If null, the test will run only once on the starts date.trueScheduleRecurrenceRule | null
startsThe date on which the schedule will start running the test.truestring , format: date-time

ScheduleRecurrenceRule properties:

NameDescriptionRequiredType
bydayThe weekdays when the ‘WEEKLY’ recurrence will be applied. Cannot be set for other frequencies.falsearray | null
countDetermines how many times the recurrence will repeat.falseinteger | null
frequencytrueFrequency
intervalThe interval between each frequency iteration. An interval of 2 with ‘HOURLY’ frequency makes the test run once every 2 hours.falseinteger
untilA datetime instance specifying the upper-bound time limit of the recurrence.falsestring | null , format: date-time

The unit type of the recurrence interval.

OK example
{
  "@count": 12,
  "@nextLink": "https://api.k6.io/cloud/v6/schedules?$skip=50\u0026$top=20",
  "value": [
    {
      "created_by": "user@example.com",
      "deactivated": false,
      "id": 123,
      "load_test_id": 234,
      "next_run": "2024-07-20T01:46:04.021Z",
      "recurrence_rule": {
        "byday": null,
        "count": null,
        "frequency": "HOURLY",
        "interval": 2,
        "until": null
      },
      "starts": "2024-07-16T08:46:04.021Z"
    }
  ]
}

400 response

401 response

403 response

500 response

Get a schedule by ID

GET /cloud/v6/schedules/{id}

Get a schedule by ID.

Request parameters

NameDescriptionInRequiredType
X-Stack-Id

Numeric ID of the Grafana stack representing the request scope.

  • If the API is called with a Personal API token, the user must be a member of the specified stack.
  • If the API is called with a Grafana Stack API token, the value must be the ID of the corresponding stack.
headertrueinteger
idID of the schedule.pathtrueinteger

200 response

OK.

Content types: application/json

ScheduleApiModel properties:

NameDescriptionRequiredType
created_byThe email of the user who created the schedule if applicable.truestring | null
deactivatedWhether the schedule is deactivated. A deactivated schedule will not trigger new test runs, but the schedule recurrence rule and expiration is not affected.trueboolean
idID of the schedule.trueinteger
load_test_idID of the test to run.trueinteger
next_runThe date of the next scheduled test run. The value is null if the schedule is expired and no more occurrences are expected in the future according to the recurrence rule.truestring | null , format: date-time
recurrence_ruleThe schedule recurrence settings. If null, the test will run only once on the starts date.trueScheduleRecurrenceRule | null
startsThe date on which the schedule will start running the test.truestring , format: date-time

ScheduleRecurrenceRule properties:

NameDescriptionRequiredType
bydayThe weekdays when the ‘WEEKLY’ recurrence will be applied. Cannot be set for other frequencies.falsearray | null
countDetermines how many times the recurrence will repeat.falseinteger | null
frequencytrueFrequency
intervalThe interval between each frequency iteration. An interval of 2 with ‘HOURLY’ frequency makes the test run once every 2 hours.falseinteger
untilA datetime instance specifying the upper-bound time limit of the recurrence.falsestring | null , format: date-time

The unit type of the recurrence interval.

Deactivated example
{
  "created_by": "user@example.com",
  "deactivated": true,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-20T01:46:04.021Z",
  "recurrence_rule": {
    "days": [],
    "ends": null,
    "frequency": "HOURLY",
    "interval": 2
  },
  "starts": "2024-07-16T08:46:04.021Z"
}
EveryTwoHours example
{
  "created_by": "user@example.com",
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-20T01:46:04.021Z",
  "recurrence_rule": {
    "byday": null,
    "count": null,
    "frequency": "HOURLY",
    "interval": 2,
    "until": null
  },
  "starts": "2024-07-16T08:46:04.021Z"
}
TriggeredOnceInThePast example
{
  "created_by": "user@example.com",
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": null,
  "recurrence_rule": null,
  "starts": "2023-08-01T12:00:00.000Z"
}
WeeklyOnWeekendsStopsAfter10Runs example
{
  "created_by": null,
  "deactivated": false,
  "id": 123,
  "load_test_id": 234,
  "next_run": "2024-07-17T08:46:04.021Z",
  "recurrence_rule": {
    "byday": [
      "SA",
      "SU"
    ],
    "count": 10,
    "frequency": "WEEKLY",
    "interval": 1,
    "until": null
  },
  "starts": "2024-07-16T08:46:04.021Z"
}

401 response

403 response

404 response

500 response

Delete a schedule

DELETE /cloud/v6/schedules/{id}

Delete a schedule.

Request parameters

NameDescriptionInRequiredType
X-Stack-Id

Numeric ID of the Grafana stack representing the request scope.

  • If the API is called with a Personal API token, the user must be a member of the specified stack.
  • If the API is called with a Grafana Stack API token, the value must be the ID of the corresponding stack.
headertrueinteger
idID of the schedule.pathtrueinteger

204 response

OK.

401 response

403 response

404 response

500 response

Re-activate deactivated schedule

POST /cloud/v6/schedules/{id}/activate

Re-activate a deactivated schedule.

A deactivated schedule can be re-activated only if it still has at least one future recurrence.

Request parameters

NameDescriptionInRequiredType
X-Stack-Id

Numeric ID of the Grafana stack representing the request scope.

  • If the API is called with a Personal API token, the user must be a member of the specified stack.
  • If the API is called with a Grafana Stack API token, the value must be the ID of the corresponding stack.
headertrueinteger
idID of the schedule.pathtrueinteger

204 response

OK.

401 response

403 response

404 response

409 response

Cannot re-activate an expired schedule.

Content types: application/json

ErrorResponseApiModel properties:

NameDescriptionRequiredType
errortrueErrorApiModel

Details of the error.

ErrorApiModel properties:

NameDescriptionRequiredType
codeService-defined error code.truestring
detailsArray of objects with more specific error information when applicable.falsearray | null
messageHuman-readable string describing the error.truestring
targetA string indicating the target of the error. For example, the name of the property in error.falsestring | null

500 response

Deactivate a schedule

POST /cloud/v6/schedules/{id}/deactivate

Deactivate a schedule.

A deactivated schedule will not trigger new test runs. Disabling a schedule does not affect the schedule recurrence rule and does not delay its expiration.

The operation has no effect if the schedule is expired.

Request parameters

NameDescriptionInRequiredType
X-Stack-Id

Numeric ID of the Grafana stack representing the request scope.

  • If the API is called with a Personal API token, the user must be a member of the specified stack.
  • If the API is called with a Grafana Stack API token, the value must be the ID of the corresponding stack.
headertrueinteger
idID of the schedule.pathtrueinteger

204 response

OK.

401 response

403 response

404 response

500 response