POST/api/v1/schedule

Create Schedule

Create new Schedule

A schedule is a method to program in time the extractions of shops. For example a shop can be scheduled to extract at 8am every day, or another shop can be extracted on Tuesdays only. By making a POST request to this endpoint, users can provide the necessary parameters and details in the request body to define a new schedule. This includes information such as the schedule name, date, time, and any other relevant parameters or configurations.

Mandatory Fields

  • _timezone: The ID of the timezone.
  • dayOfMonth: The day(s) of the month when the schedule is active. Can be a number (1-31), or * to indicate all days. Multiple days should be separated by comma (,).
  • month: The month(s) when the schedule is active. Can be a number (1-12), or * to indicate all months. Multiple months should be by comma (,).
  • dayOfWeek: The day(s) of the week when the schedule is active. Can be a number (0-6), where 0 is Sunday, or * to indicate all days. Multiple days should be by comma (,).
  • hour: The hour(s) when the schedule is active. Can be a number (0-23), or * to indicate all hours. Multiple hours should be by comma (,).
  • minute: The minute(s) when the schedule is active. Can be a number (0-59). Multiple minutes are not accepted.
  • isActiveStatus: Boolean value indicating whether the schedule is active (true or false).
  • startDate: The start date of the schedule (format: YYYY-MM-DD).
  • endDate: The end date of the schedule (format: YYYY-MM-DD).
  • scheduleName: The name of the schedule.
  • _shops: The ID(s) of the shop(s) associated with the schedule, by comma (,) if multiple.

The provided data should align with the following structures retrieved from the database:

  • Timezones: Active and non-deleted timezones fetched from the Timezone model.
  • Shops: Active, non-deleted shops associated with the authenticated user, excluding those marked as real-time.

This format ensures all necessary parameters are covered with detailed explanations to facilitate a new shop creation via the API.

POST/api/v1/schedule

Parameter Details

NameInTypeRequiredDescription
bodybodyRequirednone

Responses

StatusMeaningDescriptionSchema
200OKSuccess
400Bad RequestRequest data failed validation(s)None
401UnauthorizedAuthentication Failed!None
429Too Many RequestsToo Many Requests.None
500Internal Server ErrorInternal Server ErrorNone

Example Request

# You can also use wget
curl -X POST https://api.flightrates.example.com/api/v1/schedule \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: API_KEY'

Body parameter

{
  "scheduleName": "Flightschedule name",
  "_shops": [
    "66fbd773cfa2fa105752dc26"
  ],
  "_timezone": "64ae7e58d06e77f95bff0565",
  "dayOfMonth": "*",
  "month": "*",
  "dayOfWeek": "*",
  "hour": "*",
  "minute": "0",
  "isActiveStatus": true,
  "startDate": "2019-08-24",
  "endDate": "2019-08-24"
}

Example responses

200 Response
{
  "error": false,
  "schedule": {
    "scheduleName": "#1 Flightschedule name",
    "_shop": "6a0bea8e9650dadda773d04b",
    "_timezone": "64ae7e58d06e77f95bff0565",
    "timezoneName": "Europe/Mariehamn",
    "minute": "0",
    "hour": "*",
    "dayOfMonth": "*",
    "month": "*",
    "dayOfWeek": "*",
    "isActiveStatus": true,
    "startDate": "2026-05-19",
    "endDate": "2026-05-19",
    "_user": "6a0aaf8da93611b858a5abf8",
    "userName": "testinbound",
    "vertical": "flightrates",
    "_id": "6a0becec9650dadda773d068",
    "isCustomerCreated": true,
    "crontabExpression": "0 * * * *",
    "nextRunAt": "2026-05-19T06:00:00.000Z",
    "lastRunAt": null,
    "createdAt": "2026-05-19T04:54:04.903Z",
    "crontabHuman": "Every hour, every day",
    "id": "6a0becec9650dadda773d068"
  }
}

Need Support?

Our team is here to help you integrate and make the most of our APIs. Get in touch for technical support, custom solutions, or any questions.