# Repeat an Appointment

Creates copies of an Appointment on the dates produced by a repeat rule, for example
"every Tuesday until the end of the month" or "10 times every other day". Copies keep the
Team Member, Services, duration and Resource Instances of the original.
The dates are calculated and checked synchronously: the request fails if a date is busy
for the Team Member or its Resource Instances, unless `force` is `true`. The copies are then
created asynchronously, so they appear in the Appointment list shortly after the response.
`meta.count` is the number of copies scheduled. A second request for the same Appointment
while copies are still being created returns `429`.
Event Appointments cannot be repeated. The Business User needs the permission to create
Appointments.

Endpoint: POST /locations/{location_id}/appointments/{record_id}/duplicate
Version: 1.0.0
Security: BearerPartnerUser

## Security:

  - `BearerPartnerUser` (unknown)
    http bearer Bearer {PartnerToken}, User {UserToken}

## Path parameters:

  - `location_id` (integer, required)
    Location ID

  - `record_id` (integer, required)
    ID of the Appointment to repeat

## Header parameters:

  - `Accept` (string, required)

  - `Content-Type` (string, required)

  - `Authorization` (string, required)
    Bearer {partner_token}, User {user_token}

## Request fields (application/json):

  - `strategy` (object, required)
    Repeat rule. Use the values of a saved repeat template or a one-off rule.

  - `strategy.repeat_mode` (string, required)
    Repeat mode:
- `day` - every day
- `working_days` - Monday to Friday
- `mon_wed_fri` - Monday, Wednesday and Friday
- `tue_thu` - Tuesday and Thursday
- `week` - every week on the `days` listed
- `month` - every month on the same day
- `year` - every year on the same date
    Enum: "day", "working_days", "mon_wed_fri", "tue_thu", "week", "month", "year"

  - `strategy.interval` (integer, required)
    Number of periods skipped between repetitions for `day`, `week`, `month` and `year` (0 - every period, 1 - every other period)

  - `strategy.days` (array, required)
    Days of the week for `week` mode, required there: 1 - Monday ... 7 - Sunday

  - `from` (string, required)
    First date to consider for copies (YYYY-MM-DD). The original Appointment's own date and time are skipped.

  - `till` (string)
    Last date to consider (YYYY-MM-DD), inclusive. Required unless `count` is set; must be after `from`.

  - `count` (integer)
    Number of copies to create. Required unless `till` is set; ignored when `till` is set.

  - `hours` (integer)
    Start hour of the copies. Defaults to the original Appointment's hour.

  - `minutes` (integer)
    Start minute of the copies. Defaults to the original Appointment's minute.

  - `force` (boolean)
    Create copies even when a date is busy for the Team Member or its Resource Instances.

  - `duplication_settings` (object)

  - `duplication_settings.with_client` (boolean)
    Copy the client to the new Appointments. By default the copies are created without a client.

## Response 201:

  - `201` (unknown)
    Created. Copies are being created asynchronously.

## Response 201 fields (application/json):

  - `success` (boolean)

  - `data` (null)

  - `meta` (object)

  - `meta.count` (integer)
    Number of copies scheduled

## Response 400:

  - `400` (unknown)
    Invalid dates, count, time or repeat rule

## Response 400 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: An error has occurred.

  - `meta.errors` (array)
    Set of a validation error messages.

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Authentication needed.

## Response 403:

  - `403` (unknown)
    Forbidden, or the Appointment belongs to an Event or another Location

## Response 403 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Access denied.

## Response 404:

  - `404` (unknown)
    Appointment not found

## Response 404 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object | array)
    Additional response data (empty object or empty array)
    Example: {}

## Response 429:

  - `429` (unknown)
    Copies of this Appointment are still being created

