# Edit Appointment

Fully updates an Appointment. This is not a partial update: for a standard Appointment,
resend `staff_id`, `services`, `client`, `datetime`, and `seance_length`, including when
only `custom_fields` needs to change. A missing required field returns `422`.
For a Group Event Appointment, send `activity_id` and `client`. The `activity_id` must
match the Appointment's current Group Event. The API obtains `staff_id`, `services`,
`datetime`, and `seance_length` from that Group Event.
### Updating only custom fields
1. Get the current Appointment.
2. Copy the required main fields into this request without changing them.
3. Add the new values to `custom_fields`, using each configured field code as a key.

The Business User must have both `custom_fields_record_values_read_access` and
`custom_fields_record_values_edit_access`. Without both permissions, custom Appointment
Field values are not updated.
### Editing restrictions
The request can be rejected when the Appointment is waiting for online payment, lies
outside the Business User's allowed editing period, is fully paid, or has an arrived
client and the Business User lacks the corresponding edit permission.
If `is_sale_bill_printed` is `true`, keep the resent date, time, client, attendance status,
Team Member, and Services unchanged when updating only custom fields. Changes covered by
the printed receipt can require reversing the receipt first.

Endpoint: PUT /record/{location_id}/{record_id}
Version: 1.0.0
Security: BearerPartnerUser

## Description:

  - `Updating only custom fields` ()
    Get the current Appointment.Copy the required main fields into this request without changing them.Add the new values to custom_fields, using each configured field code as a key. The Business User must have both custom_fields_record_values_read_access andcustom_fields_record_values_edit_access. Without both permissions, custom AppointmentField values are not updated.

  - `Editing restrictions` ()
    The request can be rejected when the Appointment is waiting for online payment, liesoutside the Business User's allowed editing period, is fully paid, or has an arrivedclient and the Business User lacks the corresponding edit permission. If is_sale_bill_printed is true, keep the resent date, time, client, attendance status,Team Member, and Services unchanged when updating only custom fields. Changes covered bythe printed receipt can require reversing the receipt first.

## Security:

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

## Path parameters:

  - `location_id` (number, required)
    location ID

  - `record_id` (number, required)
    Appointment ID

## Query parameters:

  - `include_consumables` (number)

  - `include_finance_transactions` (number)

## Header parameters:

  - `Accept` (string, required)
    e.g. application/vnd.api.v2+json

  - `Content-Type` (string, required)
    application/json

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

## Request fields (application/json):

  - `activity_id` (integer)
    Group Event ID. Required for a Group Event Appointment; omit it or use 0 for a standard Appointment. When updating, the value must match the current Appointment.

  - `staff_id` (number)
    team member ID

  - `services` (array)
    Service parameters (id, cost, discount)

  - `services.id` (number)
    Service ID

  - `services.first_cost` (number)
    Initial cost of the service

  - `services.discount` (number)
    Service discount

  - `services.cost` (number)
    The total cost of the service

  - `client` (object)
    Client parameters (phone, name, email)

  - `client.phone` (string)
    Customer phone number

  - `client.name` (string)
    Client name

  - `client.email` (string)
    Client Email

  - `save_if_busy` (boolean)
    Whether to keep the appointment if the time is busy or non-working, or give an error

  - `datetime` (string)
    Date and time of appointment

  - `seance_length` (number)
    Appointment duration in seconds. Includes technical_break_duration. To add a technical break without reducing the service time, increase seance_length by the break delta.

  - `send_sms` (boolean)
    Whether to send SMS with the details of the appointment to the client

  - `comment` (string)
    Appointment Comment

  - `sms_remain_hours` (number)
    Specifies how many hours before the visit an SMS reminder should be sent to the client. Set to 0 if no reminder is needed.

  - `email_remain_hours` (number)
    Specifies how many hours before the visit an email reminder should be sent to the client. Set to 0 if no reminder is needed.

  - `attendance` (number)
    Appointment status (2 - User confirmed the appointment, 1 - User came, services provided, 0 - user waiting, -1 - user did not show)

  - `api_id` (string)
    External system ID

  - `custom_color` (string)
    Appointment color

  - `record_labels` (array)
    Array of post category IDs

  - `technical_break_duration` (any)
    Technical break duration in seconds.
- Must be in multiples of 300 (5-minute intervals)
- Maximum value is 3600 (1 hour)
- If null or not provided, uses location default from Settings → Appointment Log → Technical Breaks

  - `custom_fields` (object)
    Custom Appointment Field values keyed by field code.
The Business User must have both `custom_fields_record_values_read_access` and
`custom_fields_record_values_edit_access`. When updating an Appointment, supplying
`custom_fields` does not make the request partial: resend the required main fields
for the applicable Appointment type.

  - `custom_fields.my_custom_field` (integer)

  - `custom_fields.some_another_field` (array)

  - `activity_id` (integer)
    Enum: 0

## Request examples:

  - `Update custom fields on a standard Appointment` (unknown)

  - `Update custom fields on a Group Event Appointment` (unknown)

## Response 201:

  - `201` (unknown)
    Created

## Response 201 fields (application/json):

  - `success` (boolean)
    Success status (true)

  - `data` (object)
    Object with data

  - `data.id` (integer)

  - `data.services` (array)

  - `data.services.id` (number)
    Service ID

  - `data.services.first_cost` (number)
    Initial cost of the service (excluding discounts)

  - `data.services.discount` (number)
    Discount

  - `data.services.cost` (number)
    The total cost of the service

  - `data.client` (object)

  - `data.client.phone` (string)
    Customer phone

  - `data.client.name` (string)
    Client name

  - `data.client.email` (string)
    Client Email

  - `data.clients_count` (number)
    Number of occupied places in a group appointment

  - `data.staff` (object)

  - `data.staff.id` (number)
    team member ID

  - `data.staff.name` (string)
    team member name

  - `data.staff.spec` (string)
    team member specialization

  - `data.datetime` (string)
    Session date

  - `data.seance_length` (number)
    Appointment duration in seconds. Includes technical_break_duration. Equal to the sum of services plus the technical break.

  - `data.create_date` (string)
    date of creation

  - `data.comment` (string)
    Appointment Comment

  - `data.confirmed` (number)
    Is the appointment verified?

  - `data.sms_before` (number)
    Whether to send an SMS reminder to the client (if the client is specified)

  - `data.sms_now` (number)
    Did you send SMS when adding an appointment

  - `data.sms_now_text` (string)
    SMS text

  - `data.email_now` (number)
    Has an email notification been sent?

  - `data.notified` (number)
    Flag for confirmation of the appointment by the location administrator, if the client asked to confirm the appointment

  - `data.master_request` (number)
    Indicates whether a specific team member was selected for the appointment. Set to false if the "any team member" option was chosen

  - `data.api_id` (string)
    External appointment ID

  - `data.from_url` (string)
    From which page the transition was made to complete the appointment (website, VK application, etc.)

  - `data.review_requested` (number)
    Flag for requesting visit feedback from the client

  - `data.activity_id` (number)
    Group  event ID

  - `data.documents` (array)

  - `data.documents.id` (number)
    Document ID

  - `data.documents.type_id` (number)
    Document type

  - `data.documents.storage_id` (number)
    Inventory ID

  - `data.documents.user_id` (number)
    ID of the user who created the document

  - `data.documents.company_id` (number)
    location ID

  - `data.documents.number` (number)
    Document Number

  - `data.documents.comment` (string)
    Document comment

  - `data.documents.date_created` (string)
    Document creation date

  - `data.documents.category_id` (integer)
    Product category ID

  - `data.documents.visit_id` (integer)
    Visit ID

  - `data.documents.record_id` (integer)
    Appointment ID

  - `data.documents.type_title` (string)
    The name of the entity to which the document belongs

  - `meta` (array)
    Metadata (empty array)

## Response 400:

  - `400` (unknown)
    Appointment is waiting for online payment or the request format is invalid

## 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)
    Business User does not have permission to edit this Appointment

## 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)
    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 422:

  - `422` (unknown)
    Required request data is missing or invalid, or the requested change is not allowed

## Response 422 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.

