@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Square
@base https://connect.squareup.com
@version 2.0
@auth OAuth2 | ApiKey Authorization in header
@endpoints 327
@hint download_for_search
@toc mobile(1), oauth2(3), {location_id}(3), apple-pay(1), bank-accounts(3), bookings(24), cards(4), cash-drawers(3), catalog(14), channels(3), customers(31), devices(5), disputes(9), employees(2), events(4), gift-cards(9), inventory(13), invoices(10), labor(27), locations(20), loyalty(18), merchants(13), online-checkout(9), orders(19), payments(7), payouts(3), refunds(3), sites(4), subscriptions(12), team-members(12), terminals(15), transfer-orders(8), vendors(7), webhooks(8)

@group mobile
@endpoint POST /mobile/authorization-code
@optional {location_id: str}
@returns(200) {authorization_code: str, expires_at: str, errors: [map]}

@endgroup

@group oauth2
@endpoint POST /oauth2/revoke
@optional {client_id: str, access_token: str, merchant_id: str, revoke_only_access_token: bool}
@returns(200) {success: bool, errors: [map]}

@endpoint POST /oauth2/token
@required {client_id: str, grant_type: str}
@optional {client_secret: str, code: str, redirect_uri: str, refresh_token: str, migration_token: str, scopes: [str], short_lived: bool, code_verifier: str}
@returns(200) {access_token: str, token_type: str, expires_at: str, merchant_id: str, subscription_id: str, plan_id: str, id_token: str, refresh_token: str, short_lived: bool, errors: [map], refresh_token_expires_at: str}

@endpoint POST /oauth2/token/status
@returns(200) {scopes: [str], expires_at: str, client_id: str, merchant_id: str, errors: [map]}

@endgroup

@group {location_id}
@endpoint GET /v1/{location_id}/orders
@required {location_id: str}
@optional {order: str, limit: int, batch_token: str}
@returns(200)

@endpoint GET /v1/{location_id}/orders/{order_id}
@required {location_id: str, order_id: str}
@returns(200) {errors: [map]?, id: str, buyer_email: str?, recipient_name: str?, recipient_phone_number: str?, state: str, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, subtotal_money: map{amount: int?, currency_code: str}, total_shipping_money: map{amount: int?, currency_code: str}, total_tax_money: map{amount: int?, currency_code: str}, total_price_money: map{amount: int?, currency_code: str}, total_discount_money: map{amount: int?, currency_code: str}, created_at: str, updated_at: str, expires_at: str?, payment_id: str?, buyer_note: str?, completed_note: str?, refunded_note: str?, canceled_note: str?, tender: map{id: str, type: str, name: str?, employee_id: str?, receipt_url: str?, card_brand: str, pan_suffix: str?, entry_method: str, payment_note: str?, total_money: map{amount: int?, currency_code: str}, tendered_money: map{amount: int?, currency_code: str}, tendered_at: str?, settled_at: str?, change_back_money: map{amount: int?, currency_code: str}, refunded_money: map{amount: int?, currency_code: str}, is_exchange: bool?}, order_history: [map]?, promo_code: str?, btc_receive_address: str?, btc_price_satoshi: num?}

@endpoint PUT /v1/{location_id}/orders/{order_id}
@required {location_id: str, order_id: str, action: str(COMPLETE/CANCEL/REFUND)}
@optional {shipped_tracking_number: str, completed_note: str, refunded_note: str, canceled_note: str}
@returns(200) {errors: [map]?, id: str, buyer_email: str?, recipient_name: str?, recipient_phone_number: str?, state: str, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, subtotal_money: map{amount: int?, currency_code: str}, total_shipping_money: map{amount: int?, currency_code: str}, total_tax_money: map{amount: int?, currency_code: str}, total_price_money: map{amount: int?, currency_code: str}, total_discount_money: map{amount: int?, currency_code: str}, created_at: str, updated_at: str, expires_at: str?, payment_id: str?, buyer_note: str?, completed_note: str?, refunded_note: str?, canceled_note: str?, tender: map{id: str, type: str, name: str?, employee_id: str?, receipt_url: str?, card_brand: str, pan_suffix: str?, entry_method: str, payment_note: str?, total_money: map{amount: int?, currency_code: str}, tendered_money: map{amount: int?, currency_code: str}, tendered_at: str?, settled_at: str?, change_back_money: map{amount: int?, currency_code: str}, refunded_money: map{amount: int?, currency_code: str}, is_exchange: bool?}, order_history: [map]?, promo_code: str?, btc_receive_address: str?, btc_price_satoshi: num?}

@endgroup

@group apple-pay
@endpoint POST /v2/apple-pay/domains
@required {domain_name: str}
@returns(200) {errors: [map], status: str}

@endgroup

@group bank-accounts
@endpoint GET /v2/bank-accounts
@optional {cursor: str, limit: int, location_id: str}
@returns(200) {errors: [map], bank_accounts: [map], cursor: str}

@endpoint GET /v2/bank-accounts/by-v1-id/{v1_bank_account_id}
@required {v1_bank_account_id: str}
@returns(200) {errors: [map], bank_account: map{id: str, account_number_suffix: str, country: str, currency: str, account_type: str, holder_name: str, primary_bank_identification_number: str, secondary_bank_identification_number: str?, debit_mandate_reference_id: str?, reference_id: str?, location_id: str?, status: str, creditable: bool, debitable: bool, fingerprint: str?, version: int, bank_name: str?}}

@endpoint GET /v2/bank-accounts/{bank_account_id}
@required {bank_account_id: str}
@returns(200) {errors: [map], bank_account: map{id: str, account_number_suffix: str, country: str, currency: str, account_type: str, holder_name: str, primary_bank_identification_number: str, secondary_bank_identification_number: str?, debit_mandate_reference_id: str?, reference_id: str?, location_id: str?, status: str, creditable: bool, debitable: bool, fingerprint: str?, version: int, bank_name: str?}}

@endgroup

@group bookings
@endpoint GET /v2/bookings
@optional {limit: int, cursor: str, customer_id: str, team_member_id: str, location_id: str, start_at_min: str, start_at_max: str}
@returns(200) {bookings: [map], cursor: str, errors: [map]}

@endpoint POST /v2/bookings
@required {booking: map{id: str, version: int, status: str, created_at: str, updated_at: str, start_at: str, location_id: str, customer_id: str, customer_note: str, seller_note: str, appointment_segments: [map], transition_time_minutes: int, all_day: bool, location_type: str, creator_details: map, source: str, address: map}}
@optional {idempotency_key: str}
@returns(200) {booking: map{id: str, version: int, status: str, created_at: str, updated_at: str, start_at: str?, location_id: str?, customer_id: str?, customer_note: str?, seller_note: str?, appointment_segments: [map]?, transition_time_minutes: int, all_day: bool, location_type: str, creator_details: map{creator_type: str, team_member_id: str, customer_id: str}, source: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}}, errors: [map]}

@endpoint POST /v2/bookings/availability/search
@required {query: map{filter!: map}}
@returns(200) {availabilities: [map], errors: [map]}

@endpoint POST /v2/bookings/bulk-retrieve
@required {booking_ids: [str]}
@returns(200) {bookings: map, errors: [map]}

@endpoint GET /v2/bookings/business-booking-profile
@returns(200) {business_booking_profile: map{seller_id: str?, created_at: str, booking_enabled: bool?, customer_timezone_choice: str, booking_policy: str, allow_user_cancel: bool?, business_appointment_settings: map{location_types: [str]?, alignment_time: str, min_booking_lead_time_seconds: int?, max_booking_lead_time_seconds: int?, any_team_member_booking_enabled: bool?, multiple_service_booking_enabled: bool?, max_appointments_per_day_limit_type: str, max_appointments_per_day_limit: int?, cancellation_window_seconds: int?, cancellation_fee_money: map{amount: int(int64)?, currency: str}, cancellation_policy: str, cancellation_policy_text: str?, skip_booking_flow_staff_selection: bool?}, support_seller_level_writes: bool?}, errors: [map]}

@endpoint GET /v2/bookings/custom-attribute-definitions
@optional {limit: int, cursor: str}
@returns(200) {custom_attribute_definitions: [map], cursor: str, errors: [map]}

@endpoint POST /v2/bookings/custom-attribute-definitions
@required {custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint DELETE /v2/bookings/custom-attribute-definitions/{key}
@required {key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/bookings/custom-attribute-definitions/{key}
@required {key: str}
@optional {version: int}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint PUT /v2/bookings/custom-attribute-definitions/{key}
@required {key: str, custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/bookings/custom-attributes/bulk-delete
@required {values: map}
@returns(200) {values: map, errors: [map]}

@endpoint POST /v2/bookings/custom-attributes/bulk-upsert
@required {values: map}
@returns(200) {values: map, errors: [map]}

@endpoint GET /v2/bookings/location-booking-profiles
@optional {limit: int, cursor: str}
@returns(200) {location_booking_profiles: [map], cursor: str, errors: [map]}

@endpoint GET /v2/bookings/location-booking-profiles/{location_id}
@required {location_id: str}
@returns(200) {location_booking_profile: map{location_id: str?, booking_site_url: str?, online_booking_enabled: bool?}, errors: [map]}

@endpoint GET /v2/bookings/team-member-booking-profiles
@optional {bookable_only: bool=false, limit: int, cursor: str, location_id: str}
@returns(200) {team_member_booking_profiles: [map], cursor: str, errors: [map]}

@endpoint POST /v2/bookings/team-member-booking-profiles/bulk-retrieve
@required {team_member_ids: [str]}
@returns(200) {team_member_booking_profiles: map, errors: [map]}

@endpoint GET /v2/bookings/team-member-booking-profiles/{team_member_id}
@required {team_member_id: str}
@returns(200) {team_member_booking_profile: map{team_member_id: str, description: str, display_name: str, is_bookable: bool?, profile_image_url: str}, errors: [map]}

@endpoint GET /v2/bookings/{booking_id}
@required {booking_id: str}
@returns(200) {booking: map{id: str, version: int, status: str, created_at: str, updated_at: str, start_at: str?, location_id: str?, customer_id: str?, customer_note: str?, seller_note: str?, appointment_segments: [map]?, transition_time_minutes: int, all_day: bool, location_type: str, creator_details: map{creator_type: str, team_member_id: str, customer_id: str}, source: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}}, errors: [map]}

@endpoint PUT /v2/bookings/{booking_id}
@required {booking_id: str, booking: map{id: str, version: int, status: str, created_at: str, updated_at: str, start_at: str, location_id: str, customer_id: str, customer_note: str, seller_note: str, appointment_segments: [map], transition_time_minutes: int, all_day: bool, location_type: str, creator_details: map, source: str, address: map}}
@optional {idempotency_key: str}
@returns(200) {booking: map{id: str, version: int, status: str, created_at: str, updated_at: str, start_at: str?, location_id: str?, customer_id: str?, customer_note: str?, seller_note: str?, appointment_segments: [map]?, transition_time_minutes: int, all_day: bool, location_type: str, creator_details: map{creator_type: str, team_member_id: str, customer_id: str}, source: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}}, errors: [map]}

@endpoint POST /v2/bookings/{booking_id}/cancel
@required {booking_id: str}
@optional {idempotency_key: str, booking_version: int}
@returns(200) {booking: map{id: str, version: int, status: str, created_at: str, updated_at: str, start_at: str?, location_id: str?, customer_id: str?, customer_note: str?, seller_note: str?, appointment_segments: [map]?, transition_time_minutes: int, all_day: bool, location_type: str, creator_details: map{creator_type: str, team_member_id: str, customer_id: str}, source: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}}, errors: [map]}

@endpoint GET /v2/bookings/{booking_id}/custom-attributes
@required {booking_id: str}
@optional {limit: int, cursor: str, with_definitions: bool=false}
@returns(200) {custom_attributes: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/bookings/{booking_id}/custom-attributes/{key}
@required {booking_id: str, key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/bookings/{booking_id}/custom-attributes/{key}
@required {booking_id: str, key: str}
@optional {with_definition: bool=false, version: int}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint PUT /v2/bookings/{booking_id}/custom-attributes/{key}
@required {booking_id: str, key: str, custom_attribute: map{key: str, value: any, version: int, visibility: str, definition: map, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endgroup

@group cards
@endpoint GET /v2/cards
@optional {cursor: str, customer_id: str, include_disabled: bool=false, reference_id: str, sort_order: str}
@returns(200) {errors: [map], cards: [map], cursor: str}

@endpoint POST /v2/cards
@required {idempotency_key: str, source_id: str, card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64), exp_year: int(int64), cardholder_name: str, billing_address: map, fingerprint: str, customer_id: str, merchant_id: str, reference_id: str, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}}
@optional {verification_token: str}
@returns(200) {errors: [map], card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}}

@endpoint GET /v2/cards/{card_id}
@required {card_id: str}
@returns(200) {errors: [map], card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}}

@endpoint POST /v2/cards/{card_id}/disable
@required {card_id: str}
@returns(200) {errors: [map], card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}}

@endgroup

@group cash-drawers
@endpoint GET /v2/cash-drawers/shifts
@required {location_id: str}
@optional {sort_order: str, begin_time: str, end_time: str, limit: int, cursor: str}
@returns(200) {cursor: str, errors: [map], cash_drawer_shifts: [map]}

@endpoint GET /v2/cash-drawers/shifts/{shift_id}
@required {location_id: str, shift_id: str}
@returns(200) {cash_drawer_shift: map{id: str, state: str, opened_at: str?, ended_at: str?, closed_at: str?, description: str?, opened_cash_money: map{amount: int(int64)?, currency: str}, cash_payment_money: map{amount: int(int64)?, currency: str}, cash_refunds_money: map{amount: int(int64)?, currency: str}, cash_paid_in_money: map{amount: int(int64)?, currency: str}, cash_paid_out_money: map{amount: int(int64)?, currency: str}, expected_cash_money: map{amount: int(int64)?, currency: str}, closed_cash_money: map{amount: int(int64)?, currency: str}, device: map{id: str, name: str?}, created_at: str, updated_at: str, location_id: str, team_member_ids: [str], opening_team_member_id: str, ending_team_member_id: str, closing_team_member_id: str}, errors: [map]}

@endpoint GET /v2/cash-drawers/shifts/{shift_id}/events
@required {location_id: str, shift_id: str}
@optional {limit: int, cursor: str}
@returns(200) {cursor: str, errors: [map], cash_drawer_shift_events: [map]}

@endgroup

@group catalog
@endpoint POST /v2/catalog/batch-delete
@required {object_ids: [str]}
@returns(200) {errors: [map], deleted_object_ids: [str], deleted_at: str}

@endpoint POST /v2/catalog/batch-retrieve
@required {object_ids: [str]}
@optional {include_related_objects: bool, catalog_version: int(int64), include_deleted_objects: bool, include_category_path_to_root: bool}
@returns(200) {errors: [map], objects: [map], related_objects: [map]}

@endpoint POST /v2/catalog/batch-upsert
@required {idempotency_key: str, batches: [map{objects!: [map]}]}
@returns(200) {errors: [map], objects: [map], updated_at: str, id_mappings: [map]}

@endpoint POST /v2/catalog/images
@returns(200) {errors: [map], image: map{type: str, id: str, updated_at: str, version: int(int64), is_deleted: bool?, custom_attribute_values: map?, catalog_v1_ids: [map]?, present_at_all_locations: bool?, present_at_location_ids: [str]?, absent_at_location_ids: [str]?, item_data: map{name: str?, description: str?, abbreviation: str?, label_color: str?, is_taxable: bool?, category_id: str?, tax_ids: [str]?, modifier_list_info: [map]?, variations: [map]?, product_type: str, skip_modifier_screen: bool?, item_options: [map]?, ecom_uri: str?, ecom_image_uris: [str]?, image_ids: [str]?, sort_name: str?, categories: [map]?, description_html: str?, description_plaintext: str, channels: [str]?, is_archived: bool?, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, food_and_beverage_details: map{calorie_count: int?, dietary_preferences: [map]?, ingredients: [map]?}, reporting_category: map{id: str, ordinal: int(int64)?}, is_alcoholic: bool?}, category_data: map{name: str?, image_ids: [str]?, category_type: str, parent_category: map{id: str, ordinal: int(int64)?}, is_top_level: bool?, channels: [str]?, availability_period_ids: [str]?, online_visibility: bool?, root_category: str, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, path_to_root: [map]?}, item_variation_data: map{item_id: str?, name: str?, sku: str?, upc: str?, ordinal: int, pricing_type: str, price_money: map{amount: int(int64)?, currency: str}, location_overrides: [map]?, track_inventory: bool?, inventory_alert_type: str, inventory_alert_threshold: int(int64)?, user_data: str?, service_duration: int(int64)?, available_for_booking: bool?, item_option_values: [map]?, measurement_unit_id: str?, sellable: bool?, stockable: bool?, image_ids: [str]?, team_member_ids: [str]?, stockable_conversion: map{stockable_item_variation_id: str, stockable_quantity: str, nonstockable_quantity: str}}, tax_data: map{name: str?, calculation_phase: str, inclusion_type: str, percentage: str?, applies_to_custom_amounts: bool?, enabled: bool?, applies_to_product_set_id: str?}, discount_data: map{name: str?, discount_type: str, percentage: str?, amount_money: map{amount: int(int64)?, currency: str}, pin_required: bool?, label_color: str?, modify_tax_basis: str, maximum_amount_money: map{amount: int(int64)?, currency: str}}, modifier_list_data: map{name: str?, ordinal: int?, selection_type: str, modifiers: [map]?, image_ids: [str]?, allow_quantities: bool?, is_conversational: bool?, modifier_type: str, max_length: int?, text_required: bool?, internal_name: str?, min_selected_modifiers: int(int64)?, max_selected_modifiers: int(int64)?, hidden_from_customer: bool?}, modifier_data: map{name: str?, price_money: map{amount: int(int64)?, currency: str}, on_by_default: bool?, ordinal: int?, modifier_list_id: str?, location_overrides: [map]?, image_id: str?, hidden_online: bool?}, time_period_data: map{event: str?}, product_set_data: map{name: str?, product_ids_any: [str]?, product_ids_all: [str]?, quantity_exact: int(int64)?, quantity_min: int(int64)?, quantity_max: int(int64)?, all_products: bool?}, pricing_rule_data: map{name: str?, time_period_ids: [str]?, discount_id: str?, match_products_id: str?, apply_products_id: str?, exclude_products_id: str?, valid_from_date: str?, valid_from_local_time: str?, valid_until_date: str?, valid_until_local_time: str?, exclude_strategy: str, minimum_order_subtotal_money: map{amount: int(int64)?, currency: str}, customer_group_ids_any: [str]?}, image_data: map{name: str?, url: str?, caption: str?, photo_studio_order_id: str?}, measurement_unit_data: map{measurement_unit: map{custom_unit: map, area_unit: str, length_unit: str, volume_unit: str, weight_unit: str, generic_unit: str, time_unit: str, type: str}, precision: int?}, subscription_plan_data: map{name: str, phases: [map]?, subscription_plan_variations: [map]?, eligible_item_ids: [str]?, eligible_category_ids: [str]?, all_items: bool?}, item_option_data: map{name: str?, display_name: str?, description: str?, show_colors: bool?, values: [map]?}, item_option_value_data: map{item_option_id: str?, name: str?, description: str?, color: str?, ordinal: int?}, custom_attribute_definition_data: map{type: str, name: str, description: str?, source_application: map{product: str, application_id: str?, name: str?}, allowed_object_types: [str], seller_visibility: str, app_visibility: str, string_config: map{enforce_uniqueness: bool?}, number_config: map{precision: int?}, selection_config: map{max_allowed_selections: int?, allowed_selections: [map]?}, custom_attribute_usage_count: int, key: str?}, quick_amounts_settings_data: map{option: str, eligible_for_auto_amounts: bool?, amounts: [map]?}, subscription_plan_variation_data: map{name: str, phases: [map], subscription_plan_id: str?, monthly_billing_anchor_date: int(int64)?, can_prorate: bool?, successor_plan_variation_id: str?}, availability_period_data: map{start_local_time: str?, end_local_time: str?, day_of_week: str}}}

@endpoint PUT /v2/catalog/images/{image_id}
@required {image_id: str}
@returns(200) {errors: [map], image: map{type: str, id: str, updated_at: str, version: int(int64), is_deleted: bool?, custom_attribute_values: map?, catalog_v1_ids: [map]?, present_at_all_locations: bool?, present_at_location_ids: [str]?, absent_at_location_ids: [str]?, item_data: map{name: str?, description: str?, abbreviation: str?, label_color: str?, is_taxable: bool?, category_id: str?, tax_ids: [str]?, modifier_list_info: [map]?, variations: [map]?, product_type: str, skip_modifier_screen: bool?, item_options: [map]?, ecom_uri: str?, ecom_image_uris: [str]?, image_ids: [str]?, sort_name: str?, categories: [map]?, description_html: str?, description_plaintext: str, channels: [str]?, is_archived: bool?, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, food_and_beverage_details: map{calorie_count: int?, dietary_preferences: [map]?, ingredients: [map]?}, reporting_category: map{id: str, ordinal: int(int64)?}, is_alcoholic: bool?}, category_data: map{name: str?, image_ids: [str]?, category_type: str, parent_category: map{id: str, ordinal: int(int64)?}, is_top_level: bool?, channels: [str]?, availability_period_ids: [str]?, online_visibility: bool?, root_category: str, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, path_to_root: [map]?}, item_variation_data: map{item_id: str?, name: str?, sku: str?, upc: str?, ordinal: int, pricing_type: str, price_money: map{amount: int(int64)?, currency: str}, location_overrides: [map]?, track_inventory: bool?, inventory_alert_type: str, inventory_alert_threshold: int(int64)?, user_data: str?, service_duration: int(int64)?, available_for_booking: bool?, item_option_values: [map]?, measurement_unit_id: str?, sellable: bool?, stockable: bool?, image_ids: [str]?, team_member_ids: [str]?, stockable_conversion: map{stockable_item_variation_id: str, stockable_quantity: str, nonstockable_quantity: str}}, tax_data: map{name: str?, calculation_phase: str, inclusion_type: str, percentage: str?, applies_to_custom_amounts: bool?, enabled: bool?, applies_to_product_set_id: str?}, discount_data: map{name: str?, discount_type: str, percentage: str?, amount_money: map{amount: int(int64)?, currency: str}, pin_required: bool?, label_color: str?, modify_tax_basis: str, maximum_amount_money: map{amount: int(int64)?, currency: str}}, modifier_list_data: map{name: str?, ordinal: int?, selection_type: str, modifiers: [map]?, image_ids: [str]?, allow_quantities: bool?, is_conversational: bool?, modifier_type: str, max_length: int?, text_required: bool?, internal_name: str?, min_selected_modifiers: int(int64)?, max_selected_modifiers: int(int64)?, hidden_from_customer: bool?}, modifier_data: map{name: str?, price_money: map{amount: int(int64)?, currency: str}, on_by_default: bool?, ordinal: int?, modifier_list_id: str?, location_overrides: [map]?, image_id: str?, hidden_online: bool?}, time_period_data: map{event: str?}, product_set_data: map{name: str?, product_ids_any: [str]?, product_ids_all: [str]?, quantity_exact: int(int64)?, quantity_min: int(int64)?, quantity_max: int(int64)?, all_products: bool?}, pricing_rule_data: map{name: str?, time_period_ids: [str]?, discount_id: str?, match_products_id: str?, apply_products_id: str?, exclude_products_id: str?, valid_from_date: str?, valid_from_local_time: str?, valid_until_date: str?, valid_until_local_time: str?, exclude_strategy: str, minimum_order_subtotal_money: map{amount: int(int64)?, currency: str}, customer_group_ids_any: [str]?}, image_data: map{name: str?, url: str?, caption: str?, photo_studio_order_id: str?}, measurement_unit_data: map{measurement_unit: map{custom_unit: map, area_unit: str, length_unit: str, volume_unit: str, weight_unit: str, generic_unit: str, time_unit: str, type: str}, precision: int?}, subscription_plan_data: map{name: str, phases: [map]?, subscription_plan_variations: [map]?, eligible_item_ids: [str]?, eligible_category_ids: [str]?, all_items: bool?}, item_option_data: map{name: str?, display_name: str?, description: str?, show_colors: bool?, values: [map]?}, item_option_value_data: map{item_option_id: str?, name: str?, description: str?, color: str?, ordinal: int?}, custom_attribute_definition_data: map{type: str, name: str, description: str?, source_application: map{product: str, application_id: str?, name: str?}, allowed_object_types: [str], seller_visibility: str, app_visibility: str, string_config: map{enforce_uniqueness: bool?}, number_config: map{precision: int?}, selection_config: map{max_allowed_selections: int?, allowed_selections: [map]?}, custom_attribute_usage_count: int, key: str?}, quick_amounts_settings_data: map{option: str, eligible_for_auto_amounts: bool?, amounts: [map]?}, subscription_plan_variation_data: map{name: str, phases: [map], subscription_plan_id: str?, monthly_billing_anchor_date: int(int64)?, can_prorate: bool?, successor_plan_variation_id: str?}, availability_period_data: map{start_local_time: str?, end_local_time: str?, day_of_week: str}}}

@endpoint GET /v2/catalog/info
@returns(200) {errors: [map], limits: map{batch_upsert_max_objects_per_batch: int?, batch_upsert_max_total_objects: int?, batch_retrieve_max_object_ids: int?, search_max_page_limit: int?, batch_delete_max_object_ids: int?, update_item_taxes_max_item_ids: int?, update_item_taxes_max_taxes_to_enable: int?, update_item_taxes_max_taxes_to_disable: int?, update_item_modifier_lists_max_item_ids: int?, update_item_modifier_lists_max_modifier_lists_to_enable: int?, update_item_modifier_lists_max_modifier_lists_to_disable: int?}, standard_unit_description_group: map{standard_unit_descriptions: [map]?, language_code: str?}}

@endpoint GET /v2/catalog/list
@optional {cursor: str, types: str, catalog_version: int(int64)}
@returns(200) {errors: [map], cursor: str, objects: [map]}

@endpoint POST /v2/catalog/object
@required {idempotency_key: str, object: map{type!: str, id!: str, updated_at: str, version: int(int64), is_deleted: bool, custom_attribute_values: map, catalog_v1_ids: [map], present_at_all_locations: bool, present_at_location_ids: [str], absent_at_location_ids: [str], item_data: map, category_data: map, item_variation_data: map, tax_data: map, discount_data: map, modifier_list_data: map, modifier_data: map, time_period_data: map, product_set_data: map, pricing_rule_data: map, image_data: map, measurement_unit_data: map, subscription_plan_data: map, item_option_data: map, item_option_value_data: map, custom_attribute_definition_data: map, quick_amounts_settings_data: map, subscription_plan_variation_data: map, availability_period_data: map}}
@returns(200) {errors: [map], catalog_object: map{type: str, id: str, updated_at: str, version: int(int64), is_deleted: bool?, custom_attribute_values: map?, catalog_v1_ids: [map]?, present_at_all_locations: bool?, present_at_location_ids: [str]?, absent_at_location_ids: [str]?, item_data: map{name: str?, description: str?, abbreviation: str?, label_color: str?, is_taxable: bool?, category_id: str?, tax_ids: [str]?, modifier_list_info: [map]?, variations: [map]?, product_type: str, skip_modifier_screen: bool?, item_options: [map]?, ecom_uri: str?, ecom_image_uris: [str]?, image_ids: [str]?, sort_name: str?, categories: [map]?, description_html: str?, description_plaintext: str, channels: [str]?, is_archived: bool?, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, food_and_beverage_details: map{calorie_count: int?, dietary_preferences: [map]?, ingredients: [map]?}, reporting_category: map{id: str, ordinal: int(int64)?}, is_alcoholic: bool?}, category_data: map{name: str?, image_ids: [str]?, category_type: str, parent_category: map{id: str, ordinal: int(int64)?}, is_top_level: bool?, channels: [str]?, availability_period_ids: [str]?, online_visibility: bool?, root_category: str, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, path_to_root: [map]?}, item_variation_data: map{item_id: str?, name: str?, sku: str?, upc: str?, ordinal: int, pricing_type: str, price_money: map{amount: int(int64)?, currency: str}, location_overrides: [map]?, track_inventory: bool?, inventory_alert_type: str, inventory_alert_threshold: int(int64)?, user_data: str?, service_duration: int(int64)?, available_for_booking: bool?, item_option_values: [map]?, measurement_unit_id: str?, sellable: bool?, stockable: bool?, image_ids: [str]?, team_member_ids: [str]?, stockable_conversion: map{stockable_item_variation_id: str, stockable_quantity: str, nonstockable_quantity: str}}, tax_data: map{name: str?, calculation_phase: str, inclusion_type: str, percentage: str?, applies_to_custom_amounts: bool?, enabled: bool?, applies_to_product_set_id: str?}, discount_data: map{name: str?, discount_type: str, percentage: str?, amount_money: map{amount: int(int64)?, currency: str}, pin_required: bool?, label_color: str?, modify_tax_basis: str, maximum_amount_money: map{amount: int(int64)?, currency: str}}, modifier_list_data: map{name: str?, ordinal: int?, selection_type: str, modifiers: [map]?, image_ids: [str]?, allow_quantities: bool?, is_conversational: bool?, modifier_type: str, max_length: int?, text_required: bool?, internal_name: str?, min_selected_modifiers: int(int64)?, max_selected_modifiers: int(int64)?, hidden_from_customer: bool?}, modifier_data: map{name: str?, price_money: map{amount: int(int64)?, currency: str}, on_by_default: bool?, ordinal: int?, modifier_list_id: str?, location_overrides: [map]?, image_id: str?, hidden_online: bool?}, time_period_data: map{event: str?}, product_set_data: map{name: str?, product_ids_any: [str]?, product_ids_all: [str]?, quantity_exact: int(int64)?, quantity_min: int(int64)?, quantity_max: int(int64)?, all_products: bool?}, pricing_rule_data: map{name: str?, time_period_ids: [str]?, discount_id: str?, match_products_id: str?, apply_products_id: str?, exclude_products_id: str?, valid_from_date: str?, valid_from_local_time: str?, valid_until_date: str?, valid_until_local_time: str?, exclude_strategy: str, minimum_order_subtotal_money: map{amount: int(int64)?, currency: str}, customer_group_ids_any: [str]?}, image_data: map{name: str?, url: str?, caption: str?, photo_studio_order_id: str?}, measurement_unit_data: map{measurement_unit: map{custom_unit: map, area_unit: str, length_unit: str, volume_unit: str, weight_unit: str, generic_unit: str, time_unit: str, type: str}, precision: int?}, subscription_plan_data: map{name: str, phases: [map]?, subscription_plan_variations: [map]?, eligible_item_ids: [str]?, eligible_category_ids: [str]?, all_items: bool?}, item_option_data: map{name: str?, display_name: str?, description: str?, show_colors: bool?, values: [map]?}, item_option_value_data: map{item_option_id: str?, name: str?, description: str?, color: str?, ordinal: int?}, custom_attribute_definition_data: map{type: str, name: str, description: str?, source_application: map{product: str, application_id: str?, name: str?}, allowed_object_types: [str], seller_visibility: str, app_visibility: str, string_config: map{enforce_uniqueness: bool?}, number_config: map{precision: int?}, selection_config: map{max_allowed_selections: int?, allowed_selections: [map]?}, custom_attribute_usage_count: int, key: str?}, quick_amounts_settings_data: map{option: str, eligible_for_auto_amounts: bool?, amounts: [map]?}, subscription_plan_variation_data: map{name: str, phases: [map], subscription_plan_id: str?, monthly_billing_anchor_date: int(int64)?, can_prorate: bool?, successor_plan_variation_id: str?}, availability_period_data: map{start_local_time: str?, end_local_time: str?, day_of_week: str}}, id_mappings: [map]}

@endpoint DELETE /v2/catalog/object/{object_id}
@required {object_id: str}
@returns(200) {errors: [map], deleted_object_ids: [str], deleted_at: str}

@endpoint GET /v2/catalog/object/{object_id}
@required {object_id: str}
@optional {include_related_objects: bool=false, catalog_version: int(int64), include_category_path_to_root: bool=false}
@returns(200) {errors: [map], object: map{type: str, id: str, updated_at: str, version: int(int64), is_deleted: bool?, custom_attribute_values: map?, catalog_v1_ids: [map]?, present_at_all_locations: bool?, present_at_location_ids: [str]?, absent_at_location_ids: [str]?, item_data: map{name: str?, description: str?, abbreviation: str?, label_color: str?, is_taxable: bool?, category_id: str?, tax_ids: [str]?, modifier_list_info: [map]?, variations: [map]?, product_type: str, skip_modifier_screen: bool?, item_options: [map]?, ecom_uri: str?, ecom_image_uris: [str]?, image_ids: [str]?, sort_name: str?, categories: [map]?, description_html: str?, description_plaintext: str, channels: [str]?, is_archived: bool?, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, food_and_beverage_details: map{calorie_count: int?, dietary_preferences: [map]?, ingredients: [map]?}, reporting_category: map{id: str, ordinal: int(int64)?}, is_alcoholic: bool?}, category_data: map{name: str?, image_ids: [str]?, category_type: str, parent_category: map{id: str, ordinal: int(int64)?}, is_top_level: bool?, channels: [str]?, availability_period_ids: [str]?, online_visibility: bool?, root_category: str, ecom_seo_data: map{page_title: str?, page_description: str?, permalink: str?}, path_to_root: [map]?}, item_variation_data: map{item_id: str?, name: str?, sku: str?, upc: str?, ordinal: int, pricing_type: str, price_money: map{amount: int(int64)?, currency: str}, location_overrides: [map]?, track_inventory: bool?, inventory_alert_type: str, inventory_alert_threshold: int(int64)?, user_data: str?, service_duration: int(int64)?, available_for_booking: bool?, item_option_values: [map]?, measurement_unit_id: str?, sellable: bool?, stockable: bool?, image_ids: [str]?, team_member_ids: [str]?, stockable_conversion: map{stockable_item_variation_id: str, stockable_quantity: str, nonstockable_quantity: str}}, tax_data: map{name: str?, calculation_phase: str, inclusion_type: str, percentage: str?, applies_to_custom_amounts: bool?, enabled: bool?, applies_to_product_set_id: str?}, discount_data: map{name: str?, discount_type: str, percentage: str?, amount_money: map{amount: int(int64)?, currency: str}, pin_required: bool?, label_color: str?, modify_tax_basis: str, maximum_amount_money: map{amount: int(int64)?, currency: str}}, modifier_list_data: map{name: str?, ordinal: int?, selection_type: str, modifiers: [map]?, image_ids: [str]?, allow_quantities: bool?, is_conversational: bool?, modifier_type: str, max_length: int?, text_required: bool?, internal_name: str?, min_selected_modifiers: int(int64)?, max_selected_modifiers: int(int64)?, hidden_from_customer: bool?}, modifier_data: map{name: str?, price_money: map{amount: int(int64)?, currency: str}, on_by_default: bool?, ordinal: int?, modifier_list_id: str?, location_overrides: [map]?, image_id: str?, hidden_online: bool?}, time_period_data: map{event: str?}, product_set_data: map{name: str?, product_ids_any: [str]?, product_ids_all: [str]?, quantity_exact: int(int64)?, quantity_min: int(int64)?, quantity_max: int(int64)?, all_products: bool?}, pricing_rule_data: map{name: str?, time_period_ids: [str]?, discount_id: str?, match_products_id: str?, apply_products_id: str?, exclude_products_id: str?, valid_from_date: str?, valid_from_local_time: str?, valid_until_date: str?, valid_until_local_time: str?, exclude_strategy: str, minimum_order_subtotal_money: map{amount: int(int64)?, currency: str}, customer_group_ids_any: [str]?}, image_data: map{name: str?, url: str?, caption: str?, photo_studio_order_id: str?}, measurement_unit_data: map{measurement_unit: map{custom_unit: map, area_unit: str, length_unit: str, volume_unit: str, weight_unit: str, generic_unit: str, time_unit: str, type: str}, precision: int?}, subscription_plan_data: map{name: str, phases: [map]?, subscription_plan_variations: [map]?, eligible_item_ids: [str]?, eligible_category_ids: [str]?, all_items: bool?}, item_option_data: map{name: str?, display_name: str?, description: str?, show_colors: bool?, values: [map]?}, item_option_value_data: map{item_option_id: str?, name: str?, description: str?, color: str?, ordinal: int?}, custom_attribute_definition_data: map{type: str, name: str, description: str?, source_application: map{product: str, application_id: str?, name: str?}, allowed_object_types: [str], seller_visibility: str, app_visibility: str, string_config: map{enforce_uniqueness: bool?}, number_config: map{precision: int?}, selection_config: map{max_allowed_selections: int?, allowed_selections: [map]?}, custom_attribute_usage_count: int, key: str?}, quick_amounts_settings_data: map{option: str, eligible_for_auto_amounts: bool?, amounts: [map]?}, subscription_plan_variation_data: map{name: str, phases: [map], subscription_plan_id: str?, monthly_billing_anchor_date: int(int64)?, can_prorate: bool?, successor_plan_variation_id: str?}, availability_period_data: map{start_local_time: str?, end_local_time: str?, day_of_week: str}}, related_objects: [map]}

@endpoint POST /v2/catalog/search
@optional {cursor: str, object_types: [str], include_deleted_objects: bool, include_related_objects: bool, begin_time: str, query: map{sorted_attribute_query: map, exact_query: map, set_query: map, prefix_query: map, range_query: map, text_query: map, items_for_tax_query: map, items_for_modifier_list_query: map, items_for_item_options_query: map, item_variations_for_item_option_values_query: map}, limit: int, include_category_path_to_root: bool}
@returns(200) {errors: [map], cursor: str, objects: [map], related_objects: [map], latest_time: str}

@endpoint POST /v2/catalog/search-catalog-items
@optional {text_filter: str, category_ids: [str], stock_levels: [str], enabled_location_ids: [str], cursor: str, limit: int, sort_order: str(DESC/ASC), product_types: [str], custom_attribute_filters: [map{custom_attribute_definition_id: str, key: str, string_filter: str, number_filter: map, selection_uids_filter: [str], bool_filter: bool}], archived_state: str(ARCHIVED_STATE_NOT_ARCHIVED/ARCHIVED_STATE_ARCHIVED/ARCHIVED_STATE_ALL)}
@returns(200) {errors: [map], items: [map], cursor: str, matched_variation_ids: [str]}

@endpoint POST /v2/catalog/update-item-modifier-lists
@required {item_ids: [str]}
@optional {modifier_lists_to_enable: [str], modifier_lists_to_disable: [str]}
@returns(200) {errors: [map], updated_at: str}

@endpoint POST /v2/catalog/update-item-taxes
@required {item_ids: [str]}
@optional {taxes_to_enable: [str], taxes_to_disable: [str]}
@returns(200) {errors: [map], updated_at: str}

@endgroup

@group channels
@endpoint GET /v2/channels
@optional {reference_type: str, reference_id: str, status: str, cursor: str, limit: int}
@returns(200) {errors: [map], channels: [map], cursor: str}

@endpoint POST /v2/channels/bulk-retrieve
@required {channel_ids: [str]}
@returns(200) {errors: [map], responses: map}

@endpoint GET /v2/channels/{channel_id}
@required {channel_id: str}
@returns(200) {errors: [map], channel: map{id: str, merchant_id: str, name: str?, version: int, reference: map{type: str, id: str}, status: str, created_at: str, updated_at: str}}

@endgroup

@group customers
@endpoint GET /v2/customers
@optional {cursor: str, limit: int, sort_field: str, sort_order: str, count: bool=false}
@returns(200) {errors: [map], customers: [map], cursor: str, count: int(int64)}

@endpoint POST /v2/customers
@optional {idempotency_key: str, given_name: str, family_name: str, company_name: str, nickname: str, email_address: str, address: map{address_line_1: str, address_line_2: str, address_line_3: str, locality: str, sublocality: str, sublocality_2: str, sublocality_3: str, administrative_district_level_1: str, administrative_district_level_2: str, administrative_district_level_3: str, postal_code: str, country: str, first_name: str, last_name: str}, phone_number: str, reference_id: str, note: str, birthday: str, tax_ids: map{eu_vat: str}}
@returns(200) {errors: [map], customer: map{id: str, created_at: str, updated_at: str, given_name: str?, family_name: str?, nickname: str?, company_name: str?, email_address: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str?, birthday: str?, reference_id: str?, note: str?, preferences: map{email_unsubscribed: bool?}, creation_source: str, group_ids: [str]?, segment_ids: [str]?, version: int(int64), tax_ids: map{eu_vat: str?}}}

@endpoint POST /v2/customers/bulk-create
@required {customers: map}
@returns(200) {responses: map, errors: [map]}

@endpoint POST /v2/customers/bulk-delete
@required {customer_ids: [str]}
@returns(200) {responses: map, errors: [map]}

@endpoint POST /v2/customers/bulk-retrieve
@required {customer_ids: [str]}
@returns(200) {responses: map, errors: [map]}

@endpoint POST /v2/customers/bulk-update
@required {customers: map}
@returns(200) {responses: map, errors: [map]}

@endpoint GET /v2/customers/custom-attribute-definitions
@optional {limit: int, cursor: str}
@returns(200) {custom_attribute_definitions: [map], cursor: str, errors: [map]}

@endpoint POST /v2/customers/custom-attribute-definitions
@required {custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint DELETE /v2/customers/custom-attribute-definitions/{key}
@required {key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/customers/custom-attribute-definitions/{key}
@required {key: str}
@optional {version: int}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint PUT /v2/customers/custom-attribute-definitions/{key}
@required {key: str, custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/customers/custom-attributes/bulk-upsert
@required {values: map}
@returns(200) {values: map, errors: [map]}

@endpoint GET /v2/customers/groups
@optional {cursor: str, limit: int}
@returns(200) {errors: [map], groups: [map], cursor: str}

@endpoint POST /v2/customers/groups
@required {group: map{id: str, name!: str, created_at: str, updated_at: str}}
@optional {idempotency_key: str}
@returns(200) {errors: [map], group: map{id: str, name: str, created_at: str, updated_at: str}}

@endpoint DELETE /v2/customers/groups/{group_id}
@required {group_id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/customers/groups/{group_id}
@required {group_id: str}
@returns(200) {errors: [map], group: map{id: str, name: str, created_at: str, updated_at: str}}

@endpoint PUT /v2/customers/groups/{group_id}
@required {group_id: str, group: map{id: str, name!: str, created_at: str, updated_at: str}}
@returns(200) {errors: [map], group: map{id: str, name: str, created_at: str, updated_at: str}}

@endpoint POST /v2/customers/search
@optional {cursor: str, limit: int(int64), query: map{filter: map, sort: map}, count: bool}
@returns(200) {errors: [map], customers: [map], cursor: str, count: int(int64)}

@endpoint GET /v2/customers/segments
@optional {cursor: str, limit: int}
@returns(200) {errors: [map], segments: [map], cursor: str}

@endpoint GET /v2/customers/segments/{segment_id}
@required {segment_id: str}
@returns(200) {errors: [map], segment: map{id: str, name: str, created_at: str, updated_at: str}}

@endpoint DELETE /v2/customers/{customer_id}
@required {customer_id: str}
@optional {version: int(int64)}
@returns(200) {errors: [map]}

@endpoint GET /v2/customers/{customer_id}
@required {customer_id: str}
@returns(200) {errors: [map], customer: map{id: str, created_at: str, updated_at: str, given_name: str?, family_name: str?, nickname: str?, company_name: str?, email_address: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str?, birthday: str?, reference_id: str?, note: str?, preferences: map{email_unsubscribed: bool?}, creation_source: str, group_ids: [str]?, segment_ids: [str]?, version: int(int64), tax_ids: map{eu_vat: str?}}}

@endpoint PUT /v2/customers/{customer_id}
@required {customer_id: str}
@optional {given_name: str, family_name: str, company_name: str, nickname: str, email_address: str, address: map{address_line_1: str, address_line_2: str, address_line_3: str, locality: str, sublocality: str, sublocality_2: str, sublocality_3: str, administrative_district_level_1: str, administrative_district_level_2: str, administrative_district_level_3: str, postal_code: str, country: str, first_name: str, last_name: str}, phone_number: str, reference_id: str, note: str, birthday: str, version: int(int64), tax_ids: map{eu_vat: str}}
@returns(200) {errors: [map], customer: map{id: str, created_at: str, updated_at: str, given_name: str?, family_name: str?, nickname: str?, company_name: str?, email_address: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str?, birthday: str?, reference_id: str?, note: str?, preferences: map{email_unsubscribed: bool?}, creation_source: str, group_ids: [str]?, segment_ids: [str]?, version: int(int64), tax_ids: map{eu_vat: str?}}}

@endpoint POST /v2/customers/{customer_id}/cards
@required {customer_id: str, card_nonce: str}
@optional {billing_address: map{address_line_1: str, address_line_2: str, address_line_3: str, locality: str, sublocality: str, sublocality_2: str, sublocality_3: str, administrative_district_level_1: str, administrative_district_level_2: str, administrative_district_level_3: str, postal_code: str, country: str, first_name: str, last_name: str}, cardholder_name: str, verification_token: str}
@returns(200) {errors: [map], card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}}

@endpoint DELETE /v2/customers/{customer_id}/cards/{card_id}
@required {customer_id: str, card_id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/customers/{customer_id}/custom-attributes
@required {customer_id: str}
@optional {limit: int, cursor: str, with_definitions: bool=false}
@returns(200) {custom_attributes: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/customers/{customer_id}/custom-attributes/{key}
@required {customer_id: str, key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/customers/{customer_id}/custom-attributes/{key}
@required {customer_id: str, key: str}
@optional {with_definition: bool=false, version: int}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/customers/{customer_id}/custom-attributes/{key}
@required {customer_id: str, key: str, custom_attribute: map{key: str, value: any, version: int, visibility: str, definition: map, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint DELETE /v2/customers/{customer_id}/groups/{group_id}
@required {customer_id: str, group_id: str}
@returns(200) {errors: [map]}

@endpoint PUT /v2/customers/{customer_id}/groups/{group_id}
@required {customer_id: str, group_id: str}
@returns(200) {errors: [map]}

@endgroup

@group devices
@endpoint GET /v2/devices
@optional {cursor: str, sort_order: str, limit: int, location_id: str}
@returns(200) {errors: [map], devices: [map], cursor: str}

@endpoint GET /v2/devices/codes
@optional {cursor: str, location_id: str, product_type: str, status: str}
@returns(200) {errors: [map], device_codes: [map], cursor: str}

@endpoint POST /v2/devices/codes
@required {idempotency_key: str, device_code: map{id: str, name: str, code: str, device_id: str, product_type!: str, location_id: str, status: str, pair_by: str, created_at: str, status_changed_at: str, paired_at: str}}
@returns(200) {errors: [map], device_code: map{id: str, name: str?, code: str, device_id: str, product_type: str, location_id: str?, status: str, pair_by: str, created_at: str, status_changed_at: str, paired_at: str}}

@endpoint GET /v2/devices/codes/{id}
@required {id: str}
@returns(200) {errors: [map], device_code: map{id: str, name: str?, code: str, device_id: str, product_type: str, location_id: str?, status: str, pair_by: str, created_at: str, status_changed_at: str, paired_at: str}}

@endpoint GET /v2/devices/{device_id}
@required {device_id: str}
@returns(200) {errors: [map], device: map{id: str, attributes: map{type: str, manufacturer: str, model: str?, name: str?, manufacturers_id: str?, updated_at: str, version: str, merchant_token: str?}, components: [map]?, status: map{category: str}}}

@endgroup

@group disputes
@endpoint GET /v2/disputes
@optional {cursor: str, states: str, location_id: str}
@returns(200) {errors: [map], disputes: [map], cursor: str}

@endpoint GET /v2/disputes/{dispute_id}
@required {dispute_id: str}
@returns(200) {errors: [map], dispute: map{dispute_id: str?, id: str, amount_money: map{amount: int(int64)?, currency: str}, reason: str, state: str, due_at: str?, disputed_payment: map{payment_id: str?}, evidence_ids: [str]?, card_brand: str, created_at: str, updated_at: str, brand_dispute_id: str?, reported_date: str?, reported_at: str?, version: int, location_id: str?}}

@endpoint POST /v2/disputes/{dispute_id}/accept
@required {dispute_id: str}
@returns(200) {errors: [map], dispute: map{dispute_id: str?, id: str, amount_money: map{amount: int(int64)?, currency: str}, reason: str, state: str, due_at: str?, disputed_payment: map{payment_id: str?}, evidence_ids: [str]?, card_brand: str, created_at: str, updated_at: str, brand_dispute_id: str?, reported_date: str?, reported_at: str?, version: int, location_id: str?}}

@endpoint GET /v2/disputes/{dispute_id}/evidence
@required {dispute_id: str}
@optional {cursor: str}
@returns(200) {evidence: [map], errors: [map], cursor: str}

@endpoint POST /v2/disputes/{dispute_id}/evidence-files
@required {dispute_id: str}
@returns(200) {errors: [map], evidence: map{evidence_id: str?, id: str, dispute_id: str?, evidence_file: map{filename: str?, filetype: str?}, evidence_text: str?, uploaded_at: str?, evidence_type: str}}

@endpoint POST /v2/disputes/{dispute_id}/evidence-text
@required {dispute_id: str, idempotency_key: str, evidence_text: str}
@optional {evidence_type: str(GENERIC_EVIDENCE/ONLINE_OR_APP_ACCESS_LOG/AUTHORIZATION_DOCUMENTATION/CANCELLATION_OR_REFUND_DOCUMENTATION/CARDHOLDER_COMMUNICATION/CARDHOLDER_INFORMATION/PURCHASE_ACKNOWLEDGEMENT/DUPLICATE_CHARGE_DOCUMENTATION/PRODUCT_OR_SERVICE_DESCRIPTION/RECEIPT/SERVICE_RECEIVED_DOCUMENTATION/PROOF_OF_DELIVERY_DOCUMENTATION/RELATED_TRANSACTION_DOCUMENTATION/REBUTTAL_EXPLANATION/TRACKING_NUMBER)}
@returns(200) {errors: [map], evidence: map{evidence_id: str?, id: str, dispute_id: str?, evidence_file: map{filename: str?, filetype: str?}, evidence_text: str?, uploaded_at: str?, evidence_type: str}}

@endpoint DELETE /v2/disputes/{dispute_id}/evidence/{evidence_id}
@required {dispute_id: str, evidence_id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/disputes/{dispute_id}/evidence/{evidence_id}
@required {dispute_id: str, evidence_id: str}
@returns(200) {errors: [map], evidence: map{evidence_id: str?, id: str, dispute_id: str?, evidence_file: map{filename: str?, filetype: str?}, evidence_text: str?, uploaded_at: str?, evidence_type: str}}

@endpoint POST /v2/disputes/{dispute_id}/submit-evidence
@required {dispute_id: str}
@returns(200) {errors: [map], dispute: map{dispute_id: str?, id: str, amount_money: map{amount: int(int64)?, currency: str}, reason: str, state: str, due_at: str?, disputed_payment: map{payment_id: str?}, evidence_ids: [str]?, card_brand: str, created_at: str, updated_at: str, brand_dispute_id: str?, reported_date: str?, reported_at: str?, version: int, location_id: str?}}

@endgroup

@group employees
@endpoint GET /v2/employees
@optional {location_id: str, status: str, limit: int, cursor: str}
@returns(200) {employees: [map], cursor: str, errors: [map]}

@endpoint GET /v2/employees/{id}
@required {id: str}
@returns(200) {employee: map{id: str, first_name: str?, last_name: str?, email: str?, phone_number: str?, location_ids: [str]?, status: str, is_owner: bool?, created_at: str, updated_at: str}, errors: [map]}

@endgroup

@group events
@endpoint POST /v2/events
@optional {cursor: str, limit: int, query: map{filter: map, sort: map}}
@returns(200) {errors: [map], events: [map], metadata: [map], cursor: str}

@endpoint PUT /v2/events/disable
@returns(200) {errors: [map]}

@endpoint PUT /v2/events/enable
@returns(200) {errors: [map]}

@endpoint GET /v2/events/types
@optional {api_version: str}
@returns(200) {errors: [map], event_types: [str], metadata: [map]}

@endgroup

@group gift-cards
@endpoint GET /v2/gift-cards
@optional {type: str, state: str, limit: int, cursor: str, customer_id: str}
@returns(200) {errors: [map], gift_cards: [map], cursor: str}

@endpoint POST /v2/gift-cards
@required {idempotency_key: str, location_id: str, gift_card: map{id: str, type!: str, gan_source: str, state: str, balance_money: map, gan: str, created_at: str, customer_ids: [str]}}
@returns(200) {errors: [map], gift_card: map{id: str, type: str, gan_source: str, state: str, balance_money: map{amount: int(int64)?, currency: str}, gan: str?, created_at: str, customer_ids: [str]}}

@endpoint GET /v2/gift-cards/activities
@optional {gift_card_id: str, type: str, location_id: str, begin_time: str, end_time: str, limit: int, cursor: str, sort_order: str}
@returns(200) {errors: [map], gift_card_activities: [map], cursor: str}

@endpoint POST /v2/gift-cards/activities
@required {idempotency_key: str, gift_card_activity: map{id: str, type!: str, location_id!: str, created_at: str, gift_card_id: str, gift_card_gan: str, gift_card_balance_money: map, load_activity_details: map, activate_activity_details: map, redeem_activity_details: map, clear_balance_activity_details: map, deactivate_activity_details: map, adjust_increment_activity_details: map, adjust_decrement_activity_details: map, refund_activity_details: map, unlinked_activity_refund_activity_details: map, import_activity_details: map, block_activity_details: map, unblock_activity_details: map, import_reversal_activity_details: map, transfer_balance_to_activity_details: map, transfer_balance_from_activity_details: map}}
@returns(200) {errors: [map], gift_card_activity: map{id: str, type: str, location_id: str, created_at: str, gift_card_id: str?, gift_card_gan: str?, gift_card_balance_money: map{amount: int(int64)?, currency: str}, load_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}, order_id: str?, line_item_uid: str?, reference_id: str?, buyer_payment_instrument_ids: [str]?}, activate_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}, order_id: str?, line_item_uid: str?, reference_id: str?, buyer_payment_instrument_ids: [str]?}, redeem_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}, payment_id: str, reference_id: str?, status: str}, clear_balance_activity_details: map{reason: str}, deactivate_activity_details: map{reason: str}, adjust_increment_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}, reason: str}, adjust_decrement_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}, reason: str}, refund_activity_details: map{redeem_activity_id: str?, amount_money: map{amount: int(int64)?, currency: str}, reference_id: str?, payment_id: str}, unlinked_activity_refund_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}, reference_id: str?, payment_id: str}, import_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}}, block_activity_details: map{reason: str}, unblock_activity_details: map{reason: str}, import_reversal_activity_details: map{amount_money: map{amount: int(int64)?, currency: str}}, transfer_balance_to_activity_details: map{transfer_from_gift_card_id: str, amount_money: map{amount: int(int64)?, currency: str}}, transfer_balance_from_activity_details: map{transfer_to_gift_card_id: str, amount_money: map{amount: int(int64)?, currency: str}}}}

@endpoint POST /v2/gift-cards/from-gan
@required {gan: str}
@returns(200) {errors: [map], gift_card: map{id: str, type: str, gan_source: str, state: str, balance_money: map{amount: int(int64)?, currency: str}, gan: str?, created_at: str, customer_ids: [str]}}

@endpoint POST /v2/gift-cards/from-nonce
@required {nonce: str}
@returns(200) {errors: [map], gift_card: map{id: str, type: str, gan_source: str, state: str, balance_money: map{amount: int(int64)?, currency: str}, gan: str?, created_at: str, customer_ids: [str]}}

@endpoint POST /v2/gift-cards/{gift_card_id}/link-customer
@required {gift_card_id: str, customer_id: str}
@returns(200) {errors: [map], gift_card: map{id: str, type: str, gan_source: str, state: str, balance_money: map{amount: int(int64)?, currency: str}, gan: str?, created_at: str, customer_ids: [str]}}

@endpoint POST /v2/gift-cards/{gift_card_id}/unlink-customer
@required {gift_card_id: str, customer_id: str}
@returns(200) {errors: [map], gift_card: map{id: str, type: str, gan_source: str, state: str, balance_money: map{amount: int(int64)?, currency: str}, gan: str?, created_at: str, customer_ids: [str]}}

@endpoint GET /v2/gift-cards/{id}
@required {id: str}
@returns(200) {errors: [map], gift_card: map{id: str, type: str, gan_source: str, state: str, balance_money: map{amount: int(int64)?, currency: str}, gan: str?, created_at: str, customer_ids: [str]}}

@endgroup

@group inventory
@endpoint GET /v2/inventory/adjustment/{adjustment_id}
@required {adjustment_id: str}
@returns(200) {errors: [map], adjustment: map{id: str, reference_id: str?, from_state: str, to_state: str, location_id: str?, catalog_object_id: str?, catalog_object_type: str?, quantity: str?, total_price_money: map{amount: int(int64)?, currency: str}, occurred_at: str?, created_at: str, source: map{product: str, application_id: str?, name: str?}, employee_id: str?, team_member_id: str?, transaction_id: str, refund_id: str, purchase_order_id: str, goods_receipt_id: str, adjustment_group: map{id: str, root_adjustment_id: str, from_state: str, to_state: str}}}

@endpoint GET /v2/inventory/adjustments/{adjustment_id}
@required {adjustment_id: str}
@returns(200) {errors: [map], adjustment: map{id: str, reference_id: str?, from_state: str, to_state: str, location_id: str?, catalog_object_id: str?, catalog_object_type: str?, quantity: str?, total_price_money: map{amount: int(int64)?, currency: str}, occurred_at: str?, created_at: str, source: map{product: str, application_id: str?, name: str?}, employee_id: str?, team_member_id: str?, transaction_id: str, refund_id: str, purchase_order_id: str, goods_receipt_id: str, adjustment_group: map{id: str, root_adjustment_id: str, from_state: str, to_state: str}}}

@endpoint POST /v2/inventory/batch-change
@required {idempotency_key: str}
@optional {changes: [map{type: str, physical_count: map, adjustment: map, transfer: map, measurement_unit: map, measurement_unit_id: str}], ignore_unchanged_counts: bool}
@returns(200) {errors: [map], counts: [map], changes: [map]}

@endpoint POST /v2/inventory/batch-retrieve-changes
@optional {catalog_object_ids: [str], location_ids: [str], types: [str], states: [str], updated_after: str, updated_before: str, cursor: str, limit: int}
@returns(200) {errors: [map], changes: [map], cursor: str}

@endpoint POST /v2/inventory/batch-retrieve-counts
@optional {catalog_object_ids: [str], location_ids: [str], updated_after: str, cursor: str, states: [str], limit: int}
@returns(200) {errors: [map], counts: [map], cursor: str}

@endpoint POST /v2/inventory/changes/batch-create
@required {idempotency_key: str}
@optional {changes: [map{type: str, physical_count: map, adjustment: map, transfer: map, measurement_unit: map, measurement_unit_id: str}], ignore_unchanged_counts: bool}
@returns(200) {errors: [map], counts: [map], changes: [map]}

@endpoint POST /v2/inventory/changes/batch-retrieve
@optional {catalog_object_ids: [str], location_ids: [str], types: [str], states: [str], updated_after: str, updated_before: str, cursor: str, limit: int}
@returns(200) {errors: [map], changes: [map], cursor: str}

@endpoint POST /v2/inventory/counts/batch-retrieve
@optional {catalog_object_ids: [str], location_ids: [str], updated_after: str, cursor: str, states: [str], limit: int}
@returns(200) {errors: [map], counts: [map], cursor: str}

@endpoint GET /v2/inventory/physical-count/{physical_count_id}
@required {physical_count_id: str}
@returns(200) {errors: [map], count: map{id: str, reference_id: str?, catalog_object_id: str?, catalog_object_type: str?, state: str, location_id: str?, quantity: str?, source: map{product: str, application_id: str?, name: str?}, employee_id: str?, team_member_id: str?, occurred_at: str?, created_at: str}}

@endpoint GET /v2/inventory/physical-counts/{physical_count_id}
@required {physical_count_id: str}
@returns(200) {errors: [map], count: map{id: str, reference_id: str?, catalog_object_id: str?, catalog_object_type: str?, state: str, location_id: str?, quantity: str?, source: map{product: str, application_id: str?, name: str?}, employee_id: str?, team_member_id: str?, occurred_at: str?, created_at: str}}

@endpoint GET /v2/inventory/transfers/{transfer_id}
@required {transfer_id: str}
@returns(200) {errors: [map], transfer: map{id: str, reference_id: str?, state: str, from_location_id: str?, to_location_id: str?, catalog_object_id: str?, catalog_object_type: str?, quantity: str?, occurred_at: str?, created_at: str, source: map{product: str, application_id: str?, name: str?}, employee_id: str?, team_member_id: str?}}

@endpoint GET /v2/inventory/{catalog_object_id}
@required {catalog_object_id: str}
@optional {location_ids: str, cursor: str}
@returns(200) {errors: [map], counts: [map], cursor: str}

@endpoint GET /v2/inventory/{catalog_object_id}/changes
@required {catalog_object_id: str}
@optional {location_ids: str, cursor: str}
@returns(200) {errors: [map], changes: [map], cursor: str}

@endgroup

@group invoices
@endpoint GET /v2/invoices
@required {location_id: str}
@optional {cursor: str, limit: int}
@returns(200) {invoices: [map], cursor: str, errors: [map]}

@endpoint POST /v2/invoices
@required {invoice: map{id: str, version: int, location_id: str, order_id: str, primary_recipient: map, payment_requests: [map], delivery_method: str, invoice_number: str, title: str, description: str, scheduled_at: str, public_url: str, next_payment_amount_money: map, status: str, timezone: str, created_at: str, updated_at: str, accepted_payment_methods: map, custom_fields: [map], subscription_id: str, sale_or_service_date: str, payment_conditions: str, store_payment_method_enabled: bool, attachments: [map], creator_team_member_id: str}}
@optional {idempotency_key: str}
@returns(200) {invoice: map{id: str, version: int, location_id: str?, order_id: str?, primary_recipient: map{customer_id: str?, given_name: str, family_name: str, email_address: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str, company_name: str, tax_ids: map{eu_vat: str}}, payment_requests: [map]?, delivery_method: str, invoice_number: str?, title: str?, description: str?, scheduled_at: str?, public_url: str, next_payment_amount_money: map{amount: int(int64)?, currency: str}, status: str, timezone: str, created_at: str, updated_at: str, accepted_payment_methods: map{card: bool?, square_gift_card: bool?, bank_account: bool?, buy_now_pay_later: bool?, cash_app_pay: bool?}, custom_fields: [map]?, subscription_id: str, sale_or_service_date: str?, payment_conditions: str?, store_payment_method_enabled: bool?, attachments: [map], creator_team_member_id: str}, errors: [map]}

@endpoint POST /v2/invoices/search
@required {query: map{filter!: map, sort: map}}
@optional {limit: int, cursor: str}
@returns(200) {invoices: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/invoices/{invoice_id}
@required {invoice_id: str}
@optional {version: int}
@returns(200) {errors: [map]}

@endpoint GET /v2/invoices/{invoice_id}
@required {invoice_id: str}
@returns(200) {invoice: map{id: str, version: int, location_id: str?, order_id: str?, primary_recipient: map{customer_id: str?, given_name: str, family_name: str, email_address: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str, company_name: str, tax_ids: map{eu_vat: str}}, payment_requests: [map]?, delivery_method: str, invoice_number: str?, title: str?, description: str?, scheduled_at: str?, public_url: str, next_payment_amount_money: map{amount: int(int64)?, currency: str}, status: str, timezone: str, created_at: str, updated_at: str, accepted_payment_methods: map{card: bool?, square_gift_card: bool?, bank_account: bool?, buy_now_pay_later: bool?, cash_app_pay: bool?}, custom_fields: [map]?, subscription_id: str, sale_or_service_date: str?, payment_conditions: str?, store_payment_method_enabled: bool?, attachments: [map], creator_team_member_id: str}, errors: [map]}

@endpoint PUT /v2/invoices/{invoice_id}
@required {invoice_id: str, invoice: map{id: str, version: int, location_id: str, order_id: str, primary_recipient: map, payment_requests: [map], delivery_method: str, invoice_number: str, title: str, description: str, scheduled_at: str, public_url: str, next_payment_amount_money: map, status: str, timezone: str, created_at: str, updated_at: str, accepted_payment_methods: map, custom_fields: [map], subscription_id: str, sale_or_service_date: str, payment_conditions: str, store_payment_method_enabled: bool, attachments: [map], creator_team_member_id: str}}
@optional {idempotency_key: str, fields_to_clear: [str]}
@returns(200) {invoice: map{id: str, version: int, location_id: str?, order_id: str?, primary_recipient: map{customer_id: str?, given_name: str, family_name: str, email_address: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str, company_name: str, tax_ids: map{eu_vat: str}}, payment_requests: [map]?, delivery_method: str, invoice_number: str?, title: str?, description: str?, scheduled_at: str?, public_url: str, next_payment_amount_money: map{amount: int(int64)?, currency: str}, status: str, timezone: str, created_at: str, updated_at: str, accepted_payment_methods: map{card: bool?, square_gift_card: bool?, bank_account: bool?, buy_now_pay_later: bool?, cash_app_pay: bool?}, custom_fields: [map]?, subscription_id: str, sale_or_service_date: str?, payment_conditions: str?, store_payment_method_enabled: bool?, attachments: [map], creator_team_member_id: str}, errors: [map]}

@endpoint POST /v2/invoices/{invoice_id}/attachments
@required {invoice_id: str}
@returns(200) {attachment: map{id: str, filename: str, description: str, filesize: int, hash: str, mime_type: str, uploaded_at: str}, errors: [map]}

@endpoint DELETE /v2/invoices/{invoice_id}/attachments/{attachment_id}
@required {invoice_id: str, attachment_id: str}
@returns(200) {errors: [map]}

@endpoint POST /v2/invoices/{invoice_id}/cancel
@required {invoice_id: str, version: int}
@returns(200) {invoice: map{id: str, version: int, location_id: str?, order_id: str?, primary_recipient: map{customer_id: str?, given_name: str, family_name: str, email_address: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str, company_name: str, tax_ids: map{eu_vat: str}}, payment_requests: [map]?, delivery_method: str, invoice_number: str?, title: str?, description: str?, scheduled_at: str?, public_url: str, next_payment_amount_money: map{amount: int(int64)?, currency: str}, status: str, timezone: str, created_at: str, updated_at: str, accepted_payment_methods: map{card: bool?, square_gift_card: bool?, bank_account: bool?, buy_now_pay_later: bool?, cash_app_pay: bool?}, custom_fields: [map]?, subscription_id: str, sale_or_service_date: str?, payment_conditions: str?, store_payment_method_enabled: bool?, attachments: [map], creator_team_member_id: str}, errors: [map]}

@endpoint POST /v2/invoices/{invoice_id}/publish
@required {invoice_id: str, version: int}
@optional {idempotency_key: str}
@returns(200) {invoice: map{id: str, version: int, location_id: str?, order_id: str?, primary_recipient: map{customer_id: str?, given_name: str, family_name: str, email_address: str, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, phone_number: str, company_name: str, tax_ids: map{eu_vat: str}}, payment_requests: [map]?, delivery_method: str, invoice_number: str?, title: str?, description: str?, scheduled_at: str?, public_url: str, next_payment_amount_money: map{amount: int(int64)?, currency: str}, status: str, timezone: str, created_at: str, updated_at: str, accepted_payment_methods: map{card: bool?, square_gift_card: bool?, bank_account: bool?, buy_now_pay_later: bool?, cash_app_pay: bool?}, custom_fields: [map]?, subscription_id: str, sale_or_service_date: str?, payment_conditions: str?, store_payment_method_enabled: bool?, attachments: [map], creator_team_member_id: str}, errors: [map]}

@endgroup

@group labor
@endpoint GET /v2/labor/break-types
@optional {location_id: str, limit: int, cursor: str}
@returns(200) {break_types: [map], cursor: str, errors: [map]}

@endpoint POST /v2/labor/break-types
@required {break_type: map{id: str, location_id!: str, break_name!: str, expected_duration!: str, is_paid!: bool, version: int, created_at: str, updated_at: str}}
@optional {idempotency_key: str}
@returns(200) {break_type: map{id: str, location_id: str, break_name: str, expected_duration: str, is_paid: bool, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint DELETE /v2/labor/break-types/{id}
@required {id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/labor/break-types/{id}
@required {id: str}
@returns(200) {break_type: map{id: str, location_id: str, break_name: str, expected_duration: str, is_paid: bool, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint PUT /v2/labor/break-types/{id}
@required {id: str, break_type: map{id: str, location_id!: str, break_name!: str, expected_duration!: str, is_paid!: bool, version: int, created_at: str, updated_at: str}}
@returns(200) {break_type: map{id: str, location_id: str, break_name: str, expected_duration: str, is_paid: bool, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint GET /v2/labor/employee-wages
@optional {employee_id: str, limit: int, cursor: str}
@returns(200) {employee_wages: [map], cursor: str, errors: [map]}

@endpoint GET /v2/labor/employee-wages/{id}
@required {id: str}
@returns(200) {employee_wage: map{id: str, employee_id: str?, title: str?, hourly_rate: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint POST /v2/labor/scheduled-shifts
@required {scheduled_shift: map{id: str, draft_shift_details: map, published_shift_details: map, version: int, created_at: str, updated_at: str}}
@optional {idempotency_key: str}
@returns(200) {scheduled_shift: map{id: str, draft_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, published_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint POST /v2/labor/scheduled-shifts/bulk-publish
@required {scheduled_shifts: map}
@optional {scheduled_shift_notification_audience: str(ALL/AFFECTED/NONE)}
@returns(200) {responses: map, errors: [map]}

@endpoint POST /v2/labor/scheduled-shifts/search
@optional {query: map{filter: map, sort: map}, limit: int, cursor: str}
@returns(200) {scheduled_shifts: [map], cursor: str, errors: [map]}

@endpoint GET /v2/labor/scheduled-shifts/{id}
@required {id: str}
@returns(200) {scheduled_shift: map{id: str, draft_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, published_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint PUT /v2/labor/scheduled-shifts/{id}
@required {id: str, scheduled_shift: map{id: str, draft_shift_details: map, published_shift_details: map, version: int, created_at: str, updated_at: str}}
@returns(200) {scheduled_shift: map{id: str, draft_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, published_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint POST /v2/labor/scheduled-shifts/{id}/publish
@required {id: str, idempotency_key: str}
@optional {version: int, scheduled_shift_notification_audience: str(ALL/AFFECTED/NONE)}
@returns(200) {scheduled_shift: map{id: str, draft_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, published_shift_details: map{team_member_id: str?, location_id: str?, job_id: str?, start_at: str?, end_at: str?, notes: str?, is_deleted: bool?, timezone: str}, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint POST /v2/labor/shifts
@required {shift: map{id: str, employee_id: str, location_id!: str, timezone: str, start_at!: str, end_at: str, wage: map, breaks: [map], status: str, version: int, created_at: str, updated_at: str, team_member_id: str, declared_cash_tip_money: map}}
@optional {idempotency_key: str}
@returns(200) {shift: map{id: str, employee_id: str?, location_id: str, timezone: str?, start_at: str, end_at: str?, wage: map{title: str?, hourly_rate: map{amount: int(int64)?, currency: str}, job_id: str, tip_eligible: bool?}, breaks: [map]?, status: str, version: int, created_at: str, updated_at: str, team_member_id: str?, declared_cash_tip_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint POST /v2/labor/shifts/search
@optional {query: map{filter: map, sort: map}, limit: int, cursor: str}
@returns(200) {shifts: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/labor/shifts/{id}
@required {id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/labor/shifts/{id}
@required {id: str}
@returns(200) {shift: map{id: str, employee_id: str?, location_id: str, timezone: str?, start_at: str, end_at: str?, wage: map{title: str?, hourly_rate: map{amount: int(int64)?, currency: str}, job_id: str, tip_eligible: bool?}, breaks: [map]?, status: str, version: int, created_at: str, updated_at: str, team_member_id: str?, declared_cash_tip_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint PUT /v2/labor/shifts/{id}
@required {id: str, shift: map{id: str, employee_id: str, location_id!: str, timezone: str, start_at!: str, end_at: str, wage: map, breaks: [map], status: str, version: int, created_at: str, updated_at: str, team_member_id: str, declared_cash_tip_money: map}}
@returns(200) {shift: map{id: str, employee_id: str?, location_id: str, timezone: str?, start_at: str, end_at: str?, wage: map{title: str?, hourly_rate: map{amount: int(int64)?, currency: str}, job_id: str, tip_eligible: bool?}, breaks: [map]?, status: str, version: int, created_at: str, updated_at: str, team_member_id: str?, declared_cash_tip_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint GET /v2/labor/team-member-wages
@optional {team_member_id: str, limit: int, cursor: str}
@returns(200) {team_member_wages: [map], cursor: str, errors: [map]}

@endpoint GET /v2/labor/team-member-wages/{id}
@required {id: str}
@returns(200) {team_member_wage: map{id: str, team_member_id: str?, title: str?, hourly_rate: map{amount: int(int64)?, currency: str}, job_id: str?, tip_eligible: bool?}, errors: [map]}

@endpoint POST /v2/labor/timecards
@required {timecard: map{id: str, location_id!: str, timezone: str, start_at!: str, end_at: str, wage: map, breaks: [map], status: str, version: int, created_at: str, updated_at: str, team_member_id!: str, declared_cash_tip_money: map}}
@optional {idempotency_key: str}
@returns(200) {timecard: map{id: str, location_id: str, timezone: str?, start_at: str, end_at: str?, wage: map{title: str?, hourly_rate: map{amount: int(int64)?, currency: str}, job_id: str, tip_eligible: bool?}, breaks: [map]?, status: str, version: int, created_at: str, updated_at: str, team_member_id: str, declared_cash_tip_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint POST /v2/labor/timecards/search
@optional {query: map{filter: map, sort: map}, limit: int, cursor: str}
@returns(200) {timecards: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/labor/timecards/{id}
@required {id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/labor/timecards/{id}
@required {id: str}
@returns(200) {timecard: map{id: str, location_id: str, timezone: str?, start_at: str, end_at: str?, wage: map{title: str?, hourly_rate: map{amount: int(int64)?, currency: str}, job_id: str, tip_eligible: bool?}, breaks: [map]?, status: str, version: int, created_at: str, updated_at: str, team_member_id: str, declared_cash_tip_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint PUT /v2/labor/timecards/{id}
@required {id: str, timecard: map{id: str, location_id!: str, timezone: str, start_at!: str, end_at: str, wage: map, breaks: [map], status: str, version: int, created_at: str, updated_at: str, team_member_id!: str, declared_cash_tip_money: map}}
@returns(200) {timecard: map{id: str, location_id: str, timezone: str?, start_at: str, end_at: str?, wage: map{title: str?, hourly_rate: map{amount: int(int64)?, currency: str}, job_id: str, tip_eligible: bool?}, breaks: [map]?, status: str, version: int, created_at: str, updated_at: str, team_member_id: str, declared_cash_tip_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint GET /v2/labor/workweek-configs
@optional {limit: int, cursor: str}
@returns(200) {workweek_configs: [map], cursor: str, errors: [map]}

@endpoint PUT /v2/labor/workweek-configs/{id}
@required {id: str, workweek_config: map{id: str, start_of_week!: str, start_of_day_local_time!: str, version: int, created_at: str, updated_at: str}}
@returns(200) {workweek_config: map{id: str, start_of_week: str, start_of_day_local_time: str, version: int, created_at: str, updated_at: str}, errors: [map]}

@endgroup

@group locations
@endpoint GET /v2/locations
@returns(200) {errors: [map], locations: [map]}

@endpoint POST /v2/locations
@optional {location: map{id: str, name: str, address: map, timezone: str, capabilities: [str], status: str, created_at: str, merchant_id: str, country: str, language_code: str, currency: str, phone_number: str, business_name: str, type: str, website_url: str, business_hours: map, business_email: str, description: str, twitter_username: str, instagram_username: str, facebook_url: str, coordinates: map, logo_url: str, pos_background_url: str, mcc: str, full_format_logo_url: str, tax_ids: map}}
@returns(200) {errors: [map], location: map{id: str, name: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, timezone: str?, capabilities: [str], status: str, created_at: str, merchant_id: str, country: str, language_code: str?, currency: str, phone_number: str?, business_name: str?, type: str, website_url: str?, business_hours: map{periods: [map]?}, business_email: str?, description: str?, twitter_username: str?, instagram_username: str?, facebook_url: str?, coordinates: map{latitude: num?, longitude: num?}, logo_url: str, pos_background_url: str, mcc: str?, full_format_logo_url: str, tax_ids: map{eu_vat: str, fr_siret: str, fr_naf: str, es_nif: str, jp_qii: str}}}

@endpoint GET /v2/locations/custom-attribute-definitions
@optional {visibility_filter: str, limit: int, cursor: str}
@returns(200) {custom_attribute_definitions: [map], cursor: str, errors: [map]}

@endpoint POST /v2/locations/custom-attribute-definitions
@required {custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint DELETE /v2/locations/custom-attribute-definitions/{key}
@required {key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/locations/custom-attribute-definitions/{key}
@required {key: str}
@optional {version: int}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint PUT /v2/locations/custom-attribute-definitions/{key}
@required {key: str, custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/locations/custom-attributes/bulk-delete
@required {values: map}
@returns(200) {values: map, errors: [map]}

@endpoint POST /v2/locations/custom-attributes/bulk-upsert
@required {values: map}
@returns(200) {values: map, errors: [map]}

@endpoint GET /v2/locations/{location_id}
@required {location_id: str}
@returns(200) {errors: [map], location: map{id: str, name: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, timezone: str?, capabilities: [str], status: str, created_at: str, merchant_id: str, country: str, language_code: str?, currency: str, phone_number: str?, business_name: str?, type: str, website_url: str?, business_hours: map{periods: [map]?}, business_email: str?, description: str?, twitter_username: str?, instagram_username: str?, facebook_url: str?, coordinates: map{latitude: num?, longitude: num?}, logo_url: str, pos_background_url: str, mcc: str?, full_format_logo_url: str, tax_ids: map{eu_vat: str, fr_siret: str, fr_naf: str, es_nif: str, jp_qii: str}}}

@endpoint PUT /v2/locations/{location_id}
@required {location_id: str}
@optional {location: map{id: str, name: str, address: map, timezone: str, capabilities: [str], status: str, created_at: str, merchant_id: str, country: str, language_code: str, currency: str, phone_number: str, business_name: str, type: str, website_url: str, business_hours: map, business_email: str, description: str, twitter_username: str, instagram_username: str, facebook_url: str, coordinates: map, logo_url: str, pos_background_url: str, mcc: str, full_format_logo_url: str, tax_ids: map}}
@returns(200) {errors: [map], location: map{id: str, name: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, timezone: str?, capabilities: [str], status: str, created_at: str, merchant_id: str, country: str, language_code: str?, currency: str, phone_number: str?, business_name: str?, type: str, website_url: str?, business_hours: map{periods: [map]?}, business_email: str?, description: str?, twitter_username: str?, instagram_username: str?, facebook_url: str?, coordinates: map{latitude: num?, longitude: num?}, logo_url: str, pos_background_url: str, mcc: str?, full_format_logo_url: str, tax_ids: map{eu_vat: str, fr_siret: str, fr_naf: str, es_nif: str, jp_qii: str}}}

@endpoint POST /v2/locations/{location_id}/checkouts
@required {location_id: str, idempotency_key: str, order: map{order: map, idempotency_key: str}}
@optional {ask_for_shipping_address: bool, merchant_support_email: str, pre_populate_buyer_email: str, pre_populate_shipping_address: map{address_line_1: str, address_line_2: str, address_line_3: str, locality: str, sublocality: str, sublocality_2: str, sublocality_3: str, administrative_district_level_1: str, administrative_district_level_2: str, administrative_district_level_3: str, postal_code: str, country: str, first_name: str, last_name: str}, redirect_url: str, additional_recipients: [map{location_id!: str, description!: str, amount_money!: map}], note: str}
@returns(200) {checkout: map{id: str, checkout_page_url: str?, ask_for_shipping_address: bool?, merchant_support_email: str?, pre_populate_buyer_email: str?, pre_populate_shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, redirect_url: str?, order: map{id: str, location_id: str, reference_id: str?, source: map{name: str?}, customer_id: str?, line_items: [map]?, taxes: [map]?, discounts: [map]?, service_charges: [map]?, fulfillments: [map]?, returns: [map], return_amounts: map{total_money: map, tax_money: map, discount_money: map, tip_money: map, service_charge_money: map}, net_amounts: map{total_money: map, tax_money: map, discount_money: map, tip_money: map, service_charge_money: map}, rounding_adjustment: map{uid: str?, name: str?, amount_money: map}, tenders: [map], refunds: [map], metadata: map?, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map{amount: int(int64)?, currency: str}, total_tax_money: map{amount: int(int64)?, currency: str}, total_discount_money: map{amount: int(int64)?, currency: str}, total_tip_money: map{amount: int(int64)?, currency: str}, total_service_charge_money: map{amount: int(int64)?, currency: str}, ticket_name: str?, pricing_options: map{auto_apply_discounts: bool?, auto_apply_taxes: bool?}, rewards: [map], net_amount_due_money: map{amount: int(int64)?, currency: str}}, created_at: str, additional_recipients: [map]?}, errors: [map]}

@endpoint GET /v2/locations/{location_id}/custom-attributes
@required {location_id: str}
@optional {visibility_filter: str, limit: int, cursor: str, with_definitions: bool=false}
@returns(200) {custom_attributes: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/locations/{location_id}/custom-attributes/{key}
@required {location_id: str, key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/locations/{location_id}/custom-attributes/{key}
@required {location_id: str, key: str}
@optional {with_definition: bool=false, version: int}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/locations/{location_id}/custom-attributes/{key}
@required {location_id: str, key: str, custom_attribute: map{key: str, value: any, version: int, visibility: str, definition: map, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint GET /v2/locations/{location_id}/transactions
@required {location_id: str}
@optional {begin_time: str, end_time: str, sort_order: str, cursor: str}
@returns(200) {errors: [map], transactions: [map], cursor: str}

@endpoint GET /v2/locations/{location_id}/transactions/{transaction_id}
@required {location_id: str, transaction_id: str}
@returns(200) {errors: [map], transaction: map{id: str, location_id: str?, created_at: str, tenders: [map]?, refunds: [map]?, reference_id: str?, product: str, client_id: str?, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, order_id: str?}}

@endpoint POST /v2/locations/{location_id}/transactions/{transaction_id}/capture
@required {location_id: str, transaction_id: str}
@returns(200) {errors: [map]}

@endpoint POST /v2/locations/{location_id}/transactions/{transaction_id}/void
@required {location_id: str, transaction_id: str}
@returns(200) {errors: [map]}

@endgroup

@group loyalty
@endpoint POST /v2/loyalty/accounts
@required {loyalty_account: map{id: str, program_id!: str, balance: int, lifetime_points: int, customer_id: str, enrolled_at: str, created_at: str, updated_at: str, mapping: map, expiring_point_deadlines: [map]}, idempotency_key: str}
@returns(200) {errors: [map], loyalty_account: map{id: str, program_id: str, balance: int, lifetime_points: int, customer_id: str?, enrolled_at: str?, created_at: str, updated_at: str, mapping: map{id: str, created_at: str, phone_number: str?}, expiring_point_deadlines: [map]?}}

@endpoint POST /v2/loyalty/accounts/search
@optional {query: map{mappings: [map], customer_ids: [str]}, limit: int, cursor: str}
@returns(200) {errors: [map], loyalty_accounts: [map], cursor: str}

@endpoint GET /v2/loyalty/accounts/{account_id}
@required {account_id: str}
@returns(200) {errors: [map], loyalty_account: map{id: str, program_id: str, balance: int, lifetime_points: int, customer_id: str?, enrolled_at: str?, created_at: str, updated_at: str, mapping: map{id: str, created_at: str, phone_number: str?}, expiring_point_deadlines: [map]?}}

@endpoint POST /v2/loyalty/accounts/{account_id}/accumulate
@required {account_id: str, accumulate_points: map{loyalty_program_id: str, points: int, order_id: str}, idempotency_key: str, location_id: str}
@returns(200) {errors: [map], event: map{id: str, type: str, created_at: str, accumulate_points: map{loyalty_program_id: str, points: int?, order_id: str?}, create_reward: map{loyalty_program_id: str, reward_id: str, points: int}, redeem_reward: map{loyalty_program_id: str, reward_id: str, order_id: str}, delete_reward: map{loyalty_program_id: str, reward_id: str, points: int}, adjust_points: map{loyalty_program_id: str, points: int, reason: str?}, loyalty_account_id: str, location_id: str, source: str, expire_points: map{loyalty_program_id: str, points: int}, other_event: map{loyalty_program_id: str, points: int}, accumulate_promotion_points: map{loyalty_program_id: str, loyalty_promotion_id: str, points: int, order_id: str}}, events: [map]}

@endpoint POST /v2/loyalty/accounts/{account_id}/adjust
@required {account_id: str, idempotency_key: str, adjust_points: map{loyalty_program_id: str, points!: int, reason: str}}
@optional {allow_negative_balance: bool}
@returns(200) {errors: [map], event: map{id: str, type: str, created_at: str, accumulate_points: map{loyalty_program_id: str, points: int?, order_id: str?}, create_reward: map{loyalty_program_id: str, reward_id: str, points: int}, redeem_reward: map{loyalty_program_id: str, reward_id: str, order_id: str}, delete_reward: map{loyalty_program_id: str, reward_id: str, points: int}, adjust_points: map{loyalty_program_id: str, points: int, reason: str?}, loyalty_account_id: str, location_id: str, source: str, expire_points: map{loyalty_program_id: str, points: int}, other_event: map{loyalty_program_id: str, points: int}, accumulate_promotion_points: map{loyalty_program_id: str, loyalty_promotion_id: str, points: int, order_id: str}}}

@endpoint POST /v2/loyalty/events/search
@optional {query: map{filter: map}, limit: int, cursor: str}
@returns(200) {errors: [map], events: [map], cursor: str}

@endpoint GET /v2/loyalty/programs
@returns(200) {errors: [map], programs: [map]}

@endpoint GET /v2/loyalty/programs/{program_id}
@required {program_id: str}
@returns(200) {errors: [map], program: map{id: str, status: str, reward_tiers: [map]?, expiration_policy: map{expiration_duration: str}, terminology: map{one: str, other: str}, location_ids: [str]?, created_at: str, updated_at: str, accrual_rules: [map]?}}

@endpoint POST /v2/loyalty/programs/{program_id}/calculate
@required {program_id: str}
@optional {order_id: str, transaction_amount_money: map{amount: int(int64), currency: str}, loyalty_account_id: str}
@returns(200) {errors: [map], points: int, promotion_points: int}

@endpoint GET /v2/loyalty/programs/{program_id}/promotions
@required {program_id: str}
@optional {status: str, cursor: str, limit: int}
@returns(200) {errors: [map], loyalty_promotions: [map], cursor: str}

@endpoint POST /v2/loyalty/programs/{program_id}/promotions
@required {program_id: str, loyalty_promotion: map{id: str, name!: str, incentive!: map, available_time!: map, trigger_limit: map, status: str, created_at: str, canceled_at: str, updated_at: str, loyalty_program_id: str, minimum_spend_amount_money: map, qualifying_item_variation_ids: [str], qualifying_category_ids: [str]}, idempotency_key: str}
@returns(200) {errors: [map], loyalty_promotion: map{id: str, name: str, incentive: map{type: str, points_multiplier_data: map{points_multiplier: int?, multiplier: str?}, points_addition_data: map{points_addition: int}}, available_time: map{start_date: str, end_date: str, time_periods: [str]}, trigger_limit: map{times: int, interval: str}, status: str, created_at: str, canceled_at: str, updated_at: str, loyalty_program_id: str, minimum_spend_amount_money: map{amount: int(int64)?, currency: str}, qualifying_item_variation_ids: [str]?, qualifying_category_ids: [str]?}}

@endpoint GET /v2/loyalty/programs/{program_id}/promotions/{promotion_id}
@required {promotion_id: str, program_id: str}
@returns(200) {errors: [map], loyalty_promotion: map{id: str, name: str, incentive: map{type: str, points_multiplier_data: map{points_multiplier: int?, multiplier: str?}, points_addition_data: map{points_addition: int}}, available_time: map{start_date: str, end_date: str, time_periods: [str]}, trigger_limit: map{times: int, interval: str}, status: str, created_at: str, canceled_at: str, updated_at: str, loyalty_program_id: str, minimum_spend_amount_money: map{amount: int(int64)?, currency: str}, qualifying_item_variation_ids: [str]?, qualifying_category_ids: [str]?}}

@endpoint POST /v2/loyalty/programs/{program_id}/promotions/{promotion_id}/cancel
@required {promotion_id: str, program_id: str}
@returns(200) {errors: [map], loyalty_promotion: map{id: str, name: str, incentive: map{type: str, points_multiplier_data: map{points_multiplier: int?, multiplier: str?}, points_addition_data: map{points_addition: int}}, available_time: map{start_date: str, end_date: str, time_periods: [str]}, trigger_limit: map{times: int, interval: str}, status: str, created_at: str, canceled_at: str, updated_at: str, loyalty_program_id: str, minimum_spend_amount_money: map{amount: int(int64)?, currency: str}, qualifying_item_variation_ids: [str]?, qualifying_category_ids: [str]?}}

@endpoint POST /v2/loyalty/rewards
@required {reward: map{id: str, status: str, loyalty_account_id!: str, reward_tier_id!: str, points: int, order_id: str, created_at: str, updated_at: str, redeemed_at: str}, idempotency_key: str}
@returns(200) {errors: [map], reward: map{id: str, status: str, loyalty_account_id: str, reward_tier_id: str, points: int, order_id: str?, created_at: str, updated_at: str, redeemed_at: str}}

@endpoint POST /v2/loyalty/rewards/search
@optional {query: map{loyalty_account_id!: str, status: str}, limit: int, cursor: str}
@returns(200) {errors: [map], rewards: [map], cursor: str}

@endpoint DELETE /v2/loyalty/rewards/{reward_id}
@required {reward_id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/loyalty/rewards/{reward_id}
@required {reward_id: str}
@returns(200) {errors: [map], reward: map{id: str, status: str, loyalty_account_id: str, reward_tier_id: str, points: int, order_id: str?, created_at: str, updated_at: str, redeemed_at: str}}

@endpoint POST /v2/loyalty/rewards/{reward_id}/redeem
@required {reward_id: str, idempotency_key: str, location_id: str}
@returns(200) {errors: [map], event: map{id: str, type: str, created_at: str, accumulate_points: map{loyalty_program_id: str, points: int?, order_id: str?}, create_reward: map{loyalty_program_id: str, reward_id: str, points: int}, redeem_reward: map{loyalty_program_id: str, reward_id: str, order_id: str}, delete_reward: map{loyalty_program_id: str, reward_id: str, points: int}, adjust_points: map{loyalty_program_id: str, points: int, reason: str?}, loyalty_account_id: str, location_id: str, source: str, expire_points: map{loyalty_program_id: str, points: int}, other_event: map{loyalty_program_id: str, points: int}, accumulate_promotion_points: map{loyalty_program_id: str, loyalty_promotion_id: str, points: int, order_id: str}}}

@endgroup

@group merchants
@endpoint GET /v2/merchants
@optional {cursor: int}
@returns(200) {errors: [map], merchant: [map], cursor: int}

@endpoint GET /v2/merchants/custom-attribute-definitions
@optional {visibility_filter: str, limit: int, cursor: str}
@returns(200) {custom_attribute_definitions: [map], cursor: str, errors: [map]}

@endpoint POST /v2/merchants/custom-attribute-definitions
@required {custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint DELETE /v2/merchants/custom-attribute-definitions/{key}
@required {key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/merchants/custom-attribute-definitions/{key}
@required {key: str}
@optional {version: int}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint PUT /v2/merchants/custom-attribute-definitions/{key}
@required {key: str, custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/merchants/custom-attributes/bulk-delete
@required {values: map}
@returns(200) {values: map, errors: [map]}

@endpoint POST /v2/merchants/custom-attributes/bulk-upsert
@required {values: map}
@returns(200) {values: map, errors: [map]}

@endpoint GET /v2/merchants/{merchant_id}
@required {merchant_id: str}
@returns(200) {errors: [map], merchant: map{id: str, business_name: str?, country: str, language_code: str?, currency: str, status: str, main_location_id: str?, created_at: str}}

@endpoint GET /v2/merchants/{merchant_id}/custom-attributes
@required {merchant_id: str}
@optional {visibility_filter: str, limit: int, cursor: str, with_definitions: bool=false}
@returns(200) {custom_attributes: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/merchants/{merchant_id}/custom-attributes/{key}
@required {merchant_id: str, key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/merchants/{merchant_id}/custom-attributes/{key}
@required {merchant_id: str, key: str}
@optional {with_definition: bool=false, version: int}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/merchants/{merchant_id}/custom-attributes/{key}
@required {merchant_id: str, key: str, custom_attribute: map{key: str, value: any, version: int, visibility: str, definition: map, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endgroup

@group online-checkout
@endpoint GET /v2/online-checkout/location-settings/{location_id}
@required {location_id: str}
@returns(200) {errors: [map], location_settings: map{location_id: str?, customer_notes_enabled: bool?, policies: [map]?, branding: map{header_type: str, button_color: str?, button_shape: str}, tipping: map{percentages: [int]?, smart_tipping_enabled: bool?, default_percent: int?, smart_tips: [map]?, default_smart_tip: map{amount: int(int64)?, currency: str}}, coupons: map{enabled: bool?}, updated_at: str}}

@endpoint PUT /v2/online-checkout/location-settings/{location_id}
@required {location_id: str, location_settings: map{location_id: str, customer_notes_enabled: bool, policies: [map], branding: map, tipping: map, coupons: map, updated_at: str}}
@returns(200) {errors: [map], location_settings: map{location_id: str?, customer_notes_enabled: bool?, policies: [map]?, branding: map{header_type: str, button_color: str?, button_shape: str}, tipping: map{percentages: [int]?, smart_tipping_enabled: bool?, default_percent: int?, smart_tips: [map]?, default_smart_tip: map{amount: int(int64)?, currency: str}}, coupons: map{enabled: bool?}, updated_at: str}}

@endpoint GET /v2/online-checkout/merchant-settings
@returns(200) {errors: [map], merchant_settings: map{payment_methods: map{apple_pay: map{enabled: bool?}, google_pay: map{enabled: bool?}, cash_app: map{enabled: bool?}, afterpay_clearpay: map{order_eligibility_range: map, item_eligibility_range: map, enabled: bool}}, updated_at: str}}

@endpoint PUT /v2/online-checkout/merchant-settings
@required {merchant_settings: map{payment_methods: map, updated_at: str}}
@returns(200) {errors: [map], merchant_settings: map{payment_methods: map{apple_pay: map{enabled: bool?}, google_pay: map{enabled: bool?}, cash_app: map{enabled: bool?}, afterpay_clearpay: map{order_eligibility_range: map, item_eligibility_range: map, enabled: bool}}, updated_at: str}}

@endpoint GET /v2/online-checkout/payment-links
@optional {cursor: str, limit: int}
@returns(200) {errors: [map], payment_links: [map], cursor: str}

@endpoint POST /v2/online-checkout/payment-links
@optional {idempotency_key: str, description: str, quick_pay: map{name!: str, price_money!: map, location_id!: str}, order: map{id: str, location_id!: str, reference_id: str, source: map, customer_id: str, line_items: [map], taxes: [map], discounts: [map], service_charges: [map], fulfillments: [map], returns: [map], return_amounts: map, net_amounts: map, rounding_adjustment: map, tenders: [map], refunds: [map], metadata: map, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map, total_tax_money: map, total_discount_money: map, total_tip_money: map, total_service_charge_money: map, ticket_name: str, pricing_options: map, rewards: [map], net_amount_due_money: map}, checkout_options: map{allow_tipping: bool, custom_fields: [map], subscription_plan_id: str, redirect_url: str, merchant_support_email: str, ask_for_shipping_address: bool, accepted_payment_methods: map, app_fee_money: map, shipping_fee: map, enable_coupon: bool, enable_loyalty: bool}, pre_populated_data: map{buyer_email: str, buyer_phone_number: str, buyer_address: map}, payment_note: str}
@returns(200) {errors: [map], payment_link: map{id: str, version: int, description: str?, order_id: str, checkout_options: map{allow_tipping: bool?, custom_fields: [map]?, subscription_plan_id: str?, redirect_url: str?, merchant_support_email: str?, ask_for_shipping_address: bool?, accepted_payment_methods: map{apple_pay: bool?, google_pay: bool?, cash_app_pay: bool?, afterpay_clearpay: bool?}, app_fee_money: map{amount: int(int64)?, currency: str}, shipping_fee: map{name: str?, charge: map}, enable_coupon: bool?, enable_loyalty: bool?}, pre_populated_data: map{buyer_email: str?, buyer_phone_number: str?, buyer_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}}, url: str, long_url: str, created_at: str, updated_at: str, payment_note: str?}, related_resources: map{orders: [map]?, subscription_plans: [map]?}}

@endpoint DELETE /v2/online-checkout/payment-links/{id}
@required {id: str}
@returns(200) {errors: [map], id: str, cancelled_order_id: str}

@endpoint GET /v2/online-checkout/payment-links/{id}
@required {id: str}
@returns(200) {errors: [map], payment_link: map{id: str, version: int, description: str?, order_id: str, checkout_options: map{allow_tipping: bool?, custom_fields: [map]?, subscription_plan_id: str?, redirect_url: str?, merchant_support_email: str?, ask_for_shipping_address: bool?, accepted_payment_methods: map{apple_pay: bool?, google_pay: bool?, cash_app_pay: bool?, afterpay_clearpay: bool?}, app_fee_money: map{amount: int(int64)?, currency: str}, shipping_fee: map{name: str?, charge: map}, enable_coupon: bool?, enable_loyalty: bool?}, pre_populated_data: map{buyer_email: str?, buyer_phone_number: str?, buyer_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}}, url: str, long_url: str, created_at: str, updated_at: str, payment_note: str?}}

@endpoint PUT /v2/online-checkout/payment-links/{id}
@required {id: str, payment_link: map{id: str, version!: int, description: str, order_id: str, checkout_options: map, pre_populated_data: map, url: str, long_url: str, created_at: str, updated_at: str, payment_note: str}}
@returns(200) {errors: [map], payment_link: map{id: str, version: int, description: str?, order_id: str, checkout_options: map{allow_tipping: bool?, custom_fields: [map]?, subscription_plan_id: str?, redirect_url: str?, merchant_support_email: str?, ask_for_shipping_address: bool?, accepted_payment_methods: map{apple_pay: bool?, google_pay: bool?, cash_app_pay: bool?, afterpay_clearpay: bool?}, app_fee_money: map{amount: int(int64)?, currency: str}, shipping_fee: map{name: str?, charge: map}, enable_coupon: bool?, enable_loyalty: bool?}, pre_populated_data: map{buyer_email: str?, buyer_phone_number: str?, buyer_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}}, url: str, long_url: str, created_at: str, updated_at: str, payment_note: str?}}

@endgroup

@group orders
@endpoint POST /v2/orders
@optional {order: map{id: str, location_id!: str, reference_id: str, source: map, customer_id: str, line_items: [map], taxes: [map], discounts: [map], service_charges: [map], fulfillments: [map], returns: [map], return_amounts: map, net_amounts: map, rounding_adjustment: map, tenders: [map], refunds: [map], metadata: map, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map, total_tax_money: map, total_discount_money: map, total_tip_money: map, total_service_charge_money: map, ticket_name: str, pricing_options: map, rewards: [map], net_amount_due_money: map}, idempotency_key: str}
@returns(200) {order: map{id: str, location_id: str, reference_id: str?, source: map{name: str?}, customer_id: str?, line_items: [map]?, taxes: [map]?, discounts: [map]?, service_charges: [map]?, fulfillments: [map]?, returns: [map], return_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, net_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, rounding_adjustment: map{uid: str?, name: str?, amount_money: map{amount: int(int64)?, currency: str}}, tenders: [map], refunds: [map], metadata: map?, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map{amount: int(int64)?, currency: str}, total_tax_money: map{amount: int(int64)?, currency: str}, total_discount_money: map{amount: int(int64)?, currency: str}, total_tip_money: map{amount: int(int64)?, currency: str}, total_service_charge_money: map{amount: int(int64)?, currency: str}, ticket_name: str?, pricing_options: map{auto_apply_discounts: bool?, auto_apply_taxes: bool?}, rewards: [map], net_amount_due_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint POST /v2/orders/batch-retrieve
@required {order_ids: [str]}
@optional {location_id: str}
@returns(200) {orders: [map], errors: [map]}

@endpoint POST /v2/orders/calculate
@required {order: map{id: str, location_id!: str, reference_id: str, source: map, customer_id: str, line_items: [map], taxes: [map], discounts: [map], service_charges: [map], fulfillments: [map], returns: [map], return_amounts: map, net_amounts: map, rounding_adjustment: map, tenders: [map], refunds: [map], metadata: map, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map, total_tax_money: map, total_discount_money: map, total_tip_money: map, total_service_charge_money: map, ticket_name: str, pricing_options: map, rewards: [map], net_amount_due_money: map}}
@optional {proposed_rewards: [map{id!: str, reward_tier_id!: str}]}
@returns(200) {order: map{id: str, location_id: str, reference_id: str?, source: map{name: str?}, customer_id: str?, line_items: [map]?, taxes: [map]?, discounts: [map]?, service_charges: [map]?, fulfillments: [map]?, returns: [map], return_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, net_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, rounding_adjustment: map{uid: str?, name: str?, amount_money: map{amount: int(int64)?, currency: str}}, tenders: [map], refunds: [map], metadata: map?, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map{amount: int(int64)?, currency: str}, total_tax_money: map{amount: int(int64)?, currency: str}, total_discount_money: map{amount: int(int64)?, currency: str}, total_tip_money: map{amount: int(int64)?, currency: str}, total_service_charge_money: map{amount: int(int64)?, currency: str}, ticket_name: str?, pricing_options: map{auto_apply_discounts: bool?, auto_apply_taxes: bool?}, rewards: [map], net_amount_due_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint POST /v2/orders/clone
@required {order_id: str}
@optional {version: int, idempotency_key: str}
@returns(200) {order: map{id: str, location_id: str, reference_id: str?, source: map{name: str?}, customer_id: str?, line_items: [map]?, taxes: [map]?, discounts: [map]?, service_charges: [map]?, fulfillments: [map]?, returns: [map], return_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, net_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, rounding_adjustment: map{uid: str?, name: str?, amount_money: map{amount: int(int64)?, currency: str}}, tenders: [map], refunds: [map], metadata: map?, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map{amount: int(int64)?, currency: str}, total_tax_money: map{amount: int(int64)?, currency: str}, total_discount_money: map{amount: int(int64)?, currency: str}, total_tip_money: map{amount: int(int64)?, currency: str}, total_service_charge_money: map{amount: int(int64)?, currency: str}, ticket_name: str?, pricing_options: map{auto_apply_discounts: bool?, auto_apply_taxes: bool?}, rewards: [map], net_amount_due_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint GET /v2/orders/custom-attribute-definitions
@optional {visibility_filter: str, cursor: str, limit: int}
@returns(200) {custom_attribute_definitions: [map], cursor: str, errors: [map]}

@endpoint POST /v2/orders/custom-attribute-definitions
@required {custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint DELETE /v2/orders/custom-attribute-definitions/{key}
@required {key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/orders/custom-attribute-definitions/{key}
@required {key: str}
@optional {version: int}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint PUT /v2/orders/custom-attribute-definitions/{key}
@required {key: str, custom_attribute_definition: map{key: str, schema: map, name: str, description: str, visibility: str, version: int, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute_definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/orders/custom-attributes/bulk-delete
@required {values: map}
@returns(200) {errors: [map], values: map}

@endpoint POST /v2/orders/custom-attributes/bulk-upsert
@required {values: map}
@returns(200) {errors: [map], values: map}

@endpoint POST /v2/orders/search
@optional {location_ids: [str], cursor: str, query: map{filter: map, sort: map}, limit: int, return_entries: bool}
@returns(200) {order_entries: [map], orders: [map], cursor: str, errors: [map]}

@endpoint GET /v2/orders/{order_id}
@required {order_id: str}
@returns(200) {order: map{id: str, location_id: str, reference_id: str?, source: map{name: str?}, customer_id: str?, line_items: [map]?, taxes: [map]?, discounts: [map]?, service_charges: [map]?, fulfillments: [map]?, returns: [map], return_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, net_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, rounding_adjustment: map{uid: str?, name: str?, amount_money: map{amount: int(int64)?, currency: str}}, tenders: [map], refunds: [map], metadata: map?, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map{amount: int(int64)?, currency: str}, total_tax_money: map{amount: int(int64)?, currency: str}, total_discount_money: map{amount: int(int64)?, currency: str}, total_tip_money: map{amount: int(int64)?, currency: str}, total_service_charge_money: map{amount: int(int64)?, currency: str}, ticket_name: str?, pricing_options: map{auto_apply_discounts: bool?, auto_apply_taxes: bool?}, rewards: [map], net_amount_due_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint PUT /v2/orders/{order_id}
@required {order_id: str}
@optional {order: map{id: str, location_id!: str, reference_id: str, source: map, customer_id: str, line_items: [map], taxes: [map], discounts: [map], service_charges: [map], fulfillments: [map], returns: [map], return_amounts: map, net_amounts: map, rounding_adjustment: map, tenders: [map], refunds: [map], metadata: map, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map, total_tax_money: map, total_discount_money: map, total_tip_money: map, total_service_charge_money: map, ticket_name: str, pricing_options: map, rewards: [map], net_amount_due_money: map}, fields_to_clear: [str], idempotency_key: str}
@returns(200) {order: map{id: str, location_id: str, reference_id: str?, source: map{name: str?}, customer_id: str?, line_items: [map]?, taxes: [map]?, discounts: [map]?, service_charges: [map]?, fulfillments: [map]?, returns: [map], return_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, net_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, rounding_adjustment: map{uid: str?, name: str?, amount_money: map{amount: int(int64)?, currency: str}}, tenders: [map], refunds: [map], metadata: map?, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map{amount: int(int64)?, currency: str}, total_tax_money: map{amount: int(int64)?, currency: str}, total_discount_money: map{amount: int(int64)?, currency: str}, total_tip_money: map{amount: int(int64)?, currency: str}, total_service_charge_money: map{amount: int(int64)?, currency: str}, ticket_name: str?, pricing_options: map{auto_apply_discounts: bool?, auto_apply_taxes: bool?}, rewards: [map], net_amount_due_money: map{amount: int(int64)?, currency: str}}, errors: [map]}

@endpoint GET /v2/orders/{order_id}/custom-attributes
@required {order_id: str}
@optional {visibility_filter: str, cursor: str, limit: int, with_definitions: bool=false}
@returns(200) {custom_attributes: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/orders/{order_id}/custom-attributes/{custom_attribute_key}
@required {order_id: str, custom_attribute_key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/orders/{order_id}/custom-attributes/{custom_attribute_key}
@required {order_id: str, custom_attribute_key: str}
@optional {version: int, with_definition: bool=false}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/orders/{order_id}/custom-attributes/{custom_attribute_key}
@required {order_id: str, custom_attribute_key: str, custom_attribute: map{key: str, value: any, version: int, visibility: str, definition: map, updated_at: str, created_at: str}}
@optional {idempotency_key: str}
@returns(200) {custom_attribute: map{key: str?, value: any?, version: int, visibility: str, definition: map{key: str?, schema: map?, name: str?, description: str?, visibility: str, version: int, updated_at: str, created_at: str}, updated_at: str, created_at: str}, errors: [map]}

@endpoint POST /v2/orders/{order_id}/pay
@required {order_id: str, idempotency_key: str}
@optional {order_version: int, payment_ids: [str]}
@returns(200) {errors: [map], order: map{id: str, location_id: str, reference_id: str?, source: map{name: str?}, customer_id: str?, line_items: [map]?, taxes: [map]?, discounts: [map]?, service_charges: [map]?, fulfillments: [map]?, returns: [map], return_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, net_amounts: map{total_money: map{amount: int(int64)?, currency: str}, tax_money: map{amount: int(int64)?, currency: str}, discount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, service_charge_money: map{amount: int(int64)?, currency: str}}, rounding_adjustment: map{uid: str?, name: str?, amount_money: map{amount: int(int64)?, currency: str}}, tenders: [map], refunds: [map], metadata: map?, created_at: str, updated_at: str, closed_at: str, state: str, version: int, total_money: map{amount: int(int64)?, currency: str}, total_tax_money: map{amount: int(int64)?, currency: str}, total_discount_money: map{amount: int(int64)?, currency: str}, total_tip_money: map{amount: int(int64)?, currency: str}, total_service_charge_money: map{amount: int(int64)?, currency: str}, ticket_name: str?, pricing_options: map{auto_apply_discounts: bool?, auto_apply_taxes: bool?}, rewards: [map], net_amount_due_money: map{amount: int(int64)?, currency: str}}}

@endgroup

@group payments
@endpoint GET /v2/payments
@optional {begin_time: str, end_time: str, sort_order: str, cursor: str, location_id: str, total: int(int64), last_4: str, card_brand: str, limit: int, is_offline_payment: bool=false, offline_begin_time: str, offline_end_time: str, updated_at_begin_time: str, updated_at_end_time: str, sort_field: str}
@returns(200) {errors: [map], payments: [map], cursor: str}

@endpoint POST /v2/payments
@required {source_id: str, idempotency_key: str}
@optional {amount_money: map{amount: int(int64), currency: str}, tip_money: map{amount: int(int64), currency: str}, app_fee_money: map{amount: int(int64), currency: str}, delay_duration: str, delay_action: str, autocomplete: bool, order_id: str, customer_id: str, location_id: str, team_member_id: str, reference_id: str, verification_token: str, accept_partial_authorization: bool, buyer_email_address: str, buyer_phone_number: str, billing_address: map{address_line_1: str, address_line_2: str, address_line_3: str, locality: str, sublocality: str, sublocality_2: str, sublocality_3: str, administrative_district_level_1: str, administrative_district_level_2: str, administrative_district_level_3: str, postal_code: str, country: str, first_name: str, last_name: str}, shipping_address: map{address_line_1: str, address_line_2: str, address_line_3: str, locality: str, sublocality: str, sublocality_2: str, sublocality_3: str, administrative_district_level_1: str, administrative_district_level_2: str, administrative_district_level_3: str, postal_code: str, country: str, first_name: str, last_name: str}, note: str, statement_description_identifier: str, cash_details: map{buyer_supplied_money!: map, change_back_money: map}, external_details: map{type!: str, source!: str, source_id: str, source_fee_money: map}, customer_details: map{customer_initiated: bool, seller_keyed_in: bool}, offline_payment_details: map{client_created_at: str}}
@returns(200) {errors: [map], payment: map{id: str, created_at: str, updated_at: str, amount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, total_money: map{amount: int(int64)?, currency: str}, app_fee_money: map{amount: int(int64)?, currency: str}, approved_money: map{amount: int(int64)?, currency: str}, processing_fee: [map], refunded_money: map{amount: int(int64)?, currency: str}, status: str, delay_duration: str, delay_action: str?, delayed_until: str, source_type: str, card_details: map{status: str, card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}, entry_method: str, cvv_status: str, avs_status: str, auth_result_code: str, application_identifier: str, application_name: str, application_cryptogram: str, verification_method: str, verification_results: str, statement_description: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, card_payment_timeline: map{authorized_at: str?, captured_at: str?, voided_at: str?}, refund_requires_card_presence: bool, errors: [map]}, cash_details: map{buyer_supplied_money: map{amount: int(int64)?, currency: str}, change_back_money: map{amount: int(int64)?, currency: str}}, bank_account_details: map{bank_name: str?, transfer_type: str?, account_ownership_type: str?, fingerprint: str?, country: str?, statement_description: str?, ach_details: map{routing_number: str?, account_number_suffix: str?, account_type: str?}, errors: [map]?}, external_details: map{type: str, source: str, source_id: str?, source_fee_money: map{amount: int(int64)?, currency: str}}, wallet_details: map{status: str?, brand: str?, cash_app_details: map{buyer_full_name: str?, buyer_country_code: str?, buyer_cashtag: str}}, buy_now_pay_later_details: map{brand: str?, afterpay_details: map{email_address: str?}, clearpay_details: map{email_address: str?}}, square_account_details: map{payment_source_token: str?, errors: [map]?}, location_id: str, order_id: str, reference_id: str, customer_id: str, employee_id: str, team_member_id: str?, refund_ids: [str], risk_evaluation: map{created_at: str, risk_level: str}, terminal_checkout_id: str, buyer_email_address: str, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, note: str, statement_description_identifier: str, capabilities: [str], receipt_number: str, receipt_url: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, application_details: map{square_product: str, application_id: str?}, is_offline_payment: bool, offline_payment_details: map{client_created_at: str}, version_token: str?}}

@endpoint POST /v2/payments/cancel
@required {idempotency_key: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/payments/{payment_id}
@required {payment_id: str}
@returns(200) {errors: [map], payment: map{id: str, created_at: str, updated_at: str, amount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, total_money: map{amount: int(int64)?, currency: str}, app_fee_money: map{amount: int(int64)?, currency: str}, approved_money: map{amount: int(int64)?, currency: str}, processing_fee: [map], refunded_money: map{amount: int(int64)?, currency: str}, status: str, delay_duration: str, delay_action: str?, delayed_until: str, source_type: str, card_details: map{status: str, card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}, entry_method: str, cvv_status: str, avs_status: str, auth_result_code: str, application_identifier: str, application_name: str, application_cryptogram: str, verification_method: str, verification_results: str, statement_description: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, card_payment_timeline: map{authorized_at: str?, captured_at: str?, voided_at: str?}, refund_requires_card_presence: bool, errors: [map]}, cash_details: map{buyer_supplied_money: map{amount: int(int64)?, currency: str}, change_back_money: map{amount: int(int64)?, currency: str}}, bank_account_details: map{bank_name: str?, transfer_type: str?, account_ownership_type: str?, fingerprint: str?, country: str?, statement_description: str?, ach_details: map{routing_number: str?, account_number_suffix: str?, account_type: str?}, errors: [map]?}, external_details: map{type: str, source: str, source_id: str?, source_fee_money: map{amount: int(int64)?, currency: str}}, wallet_details: map{status: str?, brand: str?, cash_app_details: map{buyer_full_name: str?, buyer_country_code: str?, buyer_cashtag: str}}, buy_now_pay_later_details: map{brand: str?, afterpay_details: map{email_address: str?}, clearpay_details: map{email_address: str?}}, square_account_details: map{payment_source_token: str?, errors: [map]?}, location_id: str, order_id: str, reference_id: str, customer_id: str, employee_id: str, team_member_id: str?, refund_ids: [str], risk_evaluation: map{created_at: str, risk_level: str}, terminal_checkout_id: str, buyer_email_address: str, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, note: str, statement_description_identifier: str, capabilities: [str], receipt_number: str, receipt_url: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, application_details: map{square_product: str, application_id: str?}, is_offline_payment: bool, offline_payment_details: map{client_created_at: str}, version_token: str?}}

@endpoint PUT /v2/payments/{payment_id}
@required {payment_id: str, idempotency_key: str}
@optional {payment: map{id: str, created_at: str, updated_at: str, amount_money: map, tip_money: map, total_money: map, app_fee_money: map, approved_money: map, processing_fee: [map], refunded_money: map, status: str, delay_duration: str, delay_action: str, delayed_until: str, source_type: str, card_details: map, cash_details: map, bank_account_details: map, external_details: map, wallet_details: map, buy_now_pay_later_details: map, square_account_details: map, location_id: str, order_id: str, reference_id: str, customer_id: str, employee_id: str, team_member_id: str, refund_ids: [str], risk_evaluation: map, terminal_checkout_id: str, buyer_email_address: str, billing_address: map, shipping_address: map, note: str, statement_description_identifier: str, capabilities: [str], receipt_number: str, receipt_url: str, device_details: map, application_details: map, is_offline_payment: bool, offline_payment_details: map, version_token: str}}
@returns(200) {errors: [map], payment: map{id: str, created_at: str, updated_at: str, amount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, total_money: map{amount: int(int64)?, currency: str}, app_fee_money: map{amount: int(int64)?, currency: str}, approved_money: map{amount: int(int64)?, currency: str}, processing_fee: [map], refunded_money: map{amount: int(int64)?, currency: str}, status: str, delay_duration: str, delay_action: str?, delayed_until: str, source_type: str, card_details: map{status: str, card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}, entry_method: str, cvv_status: str, avs_status: str, auth_result_code: str, application_identifier: str, application_name: str, application_cryptogram: str, verification_method: str, verification_results: str, statement_description: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, card_payment_timeline: map{authorized_at: str?, captured_at: str?, voided_at: str?}, refund_requires_card_presence: bool, errors: [map]}, cash_details: map{buyer_supplied_money: map{amount: int(int64)?, currency: str}, change_back_money: map{amount: int(int64)?, currency: str}}, bank_account_details: map{bank_name: str?, transfer_type: str?, account_ownership_type: str?, fingerprint: str?, country: str?, statement_description: str?, ach_details: map{routing_number: str?, account_number_suffix: str?, account_type: str?}, errors: [map]?}, external_details: map{type: str, source: str, source_id: str?, source_fee_money: map{amount: int(int64)?, currency: str}}, wallet_details: map{status: str?, brand: str?, cash_app_details: map{buyer_full_name: str?, buyer_country_code: str?, buyer_cashtag: str}}, buy_now_pay_later_details: map{brand: str?, afterpay_details: map{email_address: str?}, clearpay_details: map{email_address: str?}}, square_account_details: map{payment_source_token: str?, errors: [map]?}, location_id: str, order_id: str, reference_id: str, customer_id: str, employee_id: str, team_member_id: str?, refund_ids: [str], risk_evaluation: map{created_at: str, risk_level: str}, terminal_checkout_id: str, buyer_email_address: str, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, note: str, statement_description_identifier: str, capabilities: [str], receipt_number: str, receipt_url: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, application_details: map{square_product: str, application_id: str?}, is_offline_payment: bool, offline_payment_details: map{client_created_at: str}, version_token: str?}}

@endpoint POST /v2/payments/{payment_id}/cancel
@required {payment_id: str}
@returns(200) {errors: [map], payment: map{id: str, created_at: str, updated_at: str, amount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, total_money: map{amount: int(int64)?, currency: str}, app_fee_money: map{amount: int(int64)?, currency: str}, approved_money: map{amount: int(int64)?, currency: str}, processing_fee: [map], refunded_money: map{amount: int(int64)?, currency: str}, status: str, delay_duration: str, delay_action: str?, delayed_until: str, source_type: str, card_details: map{status: str, card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}, entry_method: str, cvv_status: str, avs_status: str, auth_result_code: str, application_identifier: str, application_name: str, application_cryptogram: str, verification_method: str, verification_results: str, statement_description: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, card_payment_timeline: map{authorized_at: str?, captured_at: str?, voided_at: str?}, refund_requires_card_presence: bool, errors: [map]}, cash_details: map{buyer_supplied_money: map{amount: int(int64)?, currency: str}, change_back_money: map{amount: int(int64)?, currency: str}}, bank_account_details: map{bank_name: str?, transfer_type: str?, account_ownership_type: str?, fingerprint: str?, country: str?, statement_description: str?, ach_details: map{routing_number: str?, account_number_suffix: str?, account_type: str?}, errors: [map]?}, external_details: map{type: str, source: str, source_id: str?, source_fee_money: map{amount: int(int64)?, currency: str}}, wallet_details: map{status: str?, brand: str?, cash_app_details: map{buyer_full_name: str?, buyer_country_code: str?, buyer_cashtag: str}}, buy_now_pay_later_details: map{brand: str?, afterpay_details: map{email_address: str?}, clearpay_details: map{email_address: str?}}, square_account_details: map{payment_source_token: str?, errors: [map]?}, location_id: str, order_id: str, reference_id: str, customer_id: str, employee_id: str, team_member_id: str?, refund_ids: [str], risk_evaluation: map{created_at: str, risk_level: str}, terminal_checkout_id: str, buyer_email_address: str, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, note: str, statement_description_identifier: str, capabilities: [str], receipt_number: str, receipt_url: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, application_details: map{square_product: str, application_id: str?}, is_offline_payment: bool, offline_payment_details: map{client_created_at: str}, version_token: str?}}

@endpoint POST /v2/payments/{payment_id}/complete
@required {payment_id: str}
@optional {version_token: str}
@returns(200) {errors: [map], payment: map{id: str, created_at: str, updated_at: str, amount_money: map{amount: int(int64)?, currency: str}, tip_money: map{amount: int(int64)?, currency: str}, total_money: map{amount: int(int64)?, currency: str}, app_fee_money: map{amount: int(int64)?, currency: str}, approved_money: map{amount: int(int64)?, currency: str}, processing_fee: [map], refunded_money: map{amount: int(int64)?, currency: str}, status: str, delay_duration: str, delay_action: str?, delayed_until: str, source_type: str, card_details: map{status: str, card: map{id: str, card_brand: str, last_4: str, exp_month: int(int64)?, exp_year: int(int64)?, cardholder_name: str?, billing_address: map, fingerprint: str, customer_id: str?, merchant_id: str, reference_id: str?, enabled: bool, card_type: str, prepaid_type: str, bin: str, version: int(int64), card_co_brand: str, issuer_alert: str, issuer_alert_at: str, hsa_fsa: bool}, entry_method: str, cvv_status: str, avs_status: str, auth_result_code: str, application_identifier: str, application_name: str, application_cryptogram: str, verification_method: str, verification_results: str, statement_description: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, card_payment_timeline: map{authorized_at: str?, captured_at: str?, voided_at: str?}, refund_requires_card_presence: bool, errors: [map]}, cash_details: map{buyer_supplied_money: map{amount: int(int64)?, currency: str}, change_back_money: map{amount: int(int64)?, currency: str}}, bank_account_details: map{bank_name: str?, transfer_type: str?, account_ownership_type: str?, fingerprint: str?, country: str?, statement_description: str?, ach_details: map{routing_number: str?, account_number_suffix: str?, account_type: str?}, errors: [map]?}, external_details: map{type: str, source: str, source_id: str?, source_fee_money: map{amount: int(int64)?, currency: str}}, wallet_details: map{status: str?, brand: str?, cash_app_details: map{buyer_full_name: str?, buyer_country_code: str?, buyer_cashtag: str}}, buy_now_pay_later_details: map{brand: str?, afterpay_details: map{email_address: str?}, clearpay_details: map{email_address: str?}}, square_account_details: map{payment_source_token: str?, errors: [map]?}, location_id: str, order_id: str, reference_id: str, customer_id: str, employee_id: str, team_member_id: str?, refund_ids: [str], risk_evaluation: map{created_at: str, risk_level: str}, terminal_checkout_id: str, buyer_email_address: str, billing_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, shipping_address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, note: str, statement_description_identifier: str, capabilities: [str], receipt_number: str, receipt_url: str, device_details: map{device_id: str?, device_installation_id: str?, device_name: str?}, application_details: map{square_product: str, application_id: str?}, is_offline_payment: bool, offline_payment_details: map{client_created_at: str}, version_token: str?}}

@endgroup

@group payouts
@endpoint GET /v2/payouts
@optional {location_id: str, status: str, begin_time: str, end_time: str, sort_order: str, cursor: str, limit: int}
@returns(200) {payouts: [map], cursor: str, errors: [map]}

@endpoint GET /v2/payouts/{payout_id}
@required {payout_id: str}
@returns(200) {payout: map{id: str, status: str, location_id: str, created_at: str, updated_at: str, amount_money: map{amount: int(int64)?, currency: str}, destination: map{type: str, id: str}, version: int, type: str, payout_fee: [map]?, arrival_date: str?, end_to_end_id: str?}, errors: [map]}

@endpoint GET /v2/payouts/{payout_id}/payout-entries
@required {payout_id: str}
@optional {sort_order: str, cursor: str, limit: int}
@returns(200) {payout_entries: [map], cursor: str, errors: [map]}

@endgroup

@group refunds
@endpoint GET /v2/refunds
@optional {begin_time: str, end_time: str, sort_order: str, cursor: str, location_id: str, status: str, source_type: str, limit: int, updated_at_begin_time: str, updated_at_end_time: str, sort_field: str}
@returns(200) {errors: [map], refunds: [map], cursor: str}

@endpoint POST /v2/refunds
@required {idempotency_key: str, amount_money: map{amount: int(int64), currency: str}}
@optional {app_fee_money: map{amount: int(int64), currency: str}, payment_id: str, destination_id: str, unlinked: bool, location_id: str, customer_id: str, reason: str, payment_version_token: str, team_member_id: str, cash_details: map{seller_supplied_money!: map, change_back_money: map}, external_details: map{type!: str, source!: str, source_id: str}}
@returns(200) {errors: [map], refund: map{id: str, status: str?, location_id: str?, unlinked: bool, destination_type: str?, destination_details: map{card_details: map{card: map, entry_method: str?, auth_result_code: str?}, cash_details: map{seller_supplied_money: map, change_back_money: map}, external_details: map{type: str, source: str, source_id: str?}}, amount_money: map{amount: int(int64)?, currency: str}, app_fee_money: map{amount: int(int64)?, currency: str}, processing_fee: [map]?, payment_id: str?, order_id: str?, reason: str?, created_at: str, updated_at: str, team_member_id: str, terminal_refund_id: str}}

@endpoint GET /v2/refunds/{refund_id}
@required {refund_id: str}
@returns(200) {errors: [map], refund: map{id: str, status: str?, location_id: str?, unlinked: bool, destination_type: str?, destination_details: map{card_details: map{card: map, entry_method: str?, auth_result_code: str?}, cash_details: map{seller_supplied_money: map, change_back_money: map}, external_details: map{type: str, source: str, source_id: str?}}, amount_money: map{amount: int(int64)?, currency: str}, app_fee_money: map{amount: int(int64)?, currency: str}, processing_fee: [map]?, payment_id: str?, order_id: str?, reason: str?, created_at: str, updated_at: str, team_member_id: str, terminal_refund_id: str}}

@endgroup

@group sites
@endpoint GET /v2/sites
@returns(200) {errors: [map], sites: [map]}

@endpoint DELETE /v2/sites/{site_id}/snippet
@required {site_id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/sites/{site_id}/snippet
@required {site_id: str}
@returns(200) {errors: [map], snippet: map{id: str, site_id: str, content: str, created_at: str, updated_at: str}}

@endpoint POST /v2/sites/{site_id}/snippet
@required {site_id: str, snippet: map{id: str, site_id: str, content!: str, created_at: str, updated_at: str}}
@returns(200) {errors: [map], snippet: map{id: str, site_id: str, content: str, created_at: str, updated_at: str}}

@endgroup

@group subscriptions
@endpoint POST /v2/subscriptions
@required {location_id: str, customer_id: str}
@optional {idempotency_key: str, plan_variation_id: str, start_date: str, canceled_date: str, tax_percentage: str, price_override_money: map{amount: int(int64), currency: str}, card_id: str, timezone: str, source: map{name: str}, monthly_billing_anchor_date: int, phases: [map{uid: str, ordinal: int(int64), order_template_id: str, plan_phase_uid: str}]}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}}

@endpoint POST /v2/subscriptions/bulk-swap-plan
@required {new_plan_variation_id: str, old_plan_variation_id: str, location_id: str}
@returns(200) {errors: [map], affected_subscriptions: int}

@endpoint POST /v2/subscriptions/search
@optional {cursor: str, limit: int, query: map{filter: map}, include: [str]}
@returns(200) {errors: [map], subscriptions: [map], cursor: str}

@endpoint GET /v2/subscriptions/{subscription_id}
@required {subscription_id: str}
@optional {include: str}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}}

@endpoint PUT /v2/subscriptions/{subscription_id}
@required {subscription_id: str}
@optional {subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str, charged_through_date: str, status: str, tax_percentage: str, invoice_ids: [str], price_override_money: map, version: int(int64), created_at: str, card_id: str, timezone: str, source: map, actions: [map], monthly_billing_anchor_date: int, phases: [map], completed_date: str}}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}}

@endpoint DELETE /v2/subscriptions/{subscription_id}/actions/{action_id}
@required {subscription_id: str, action_id: str}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}}

@endpoint POST /v2/subscriptions/{subscription_id}/billing-anchor
@required {subscription_id: str}
@optional {monthly_billing_anchor_date: int, effective_date: str}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}, actions: [map]}

@endpoint POST /v2/subscriptions/{subscription_id}/cancel
@required {subscription_id: str}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}, actions: [map]}

@endpoint GET /v2/subscriptions/{subscription_id}/events
@required {subscription_id: str}
@optional {cursor: str, limit: int}
@returns(200) {errors: [map], subscription_events: [map], cursor: str}

@endpoint POST /v2/subscriptions/{subscription_id}/pause
@required {subscription_id: str}
@optional {pause_effective_date: str, pause_cycle_duration: int(int64), resume_effective_date: str, resume_change_timing: str(IMMEDIATE/END_OF_BILLING_CYCLE), pause_reason: str}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}, actions: [map]}

@endpoint POST /v2/subscriptions/{subscription_id}/resume
@required {subscription_id: str}
@optional {resume_effective_date: str, resume_change_timing: str(IMMEDIATE/END_OF_BILLING_CYCLE)}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}, actions: [map]}

@endpoint POST /v2/subscriptions/{subscription_id}/swap-plan
@required {subscription_id: str}
@optional {new_plan_variation_id: str, phases: [map{ordinal!: int(int64), order_template_id: str}]}
@returns(200) {errors: [map], subscription: map{id: str, location_id: str, plan_variation_id: str, customer_id: str, start_date: str, canceled_date: str?, charged_through_date: str, status: str, tax_percentage: str?, invoice_ids: [str], price_override_money: map{amount: int(int64)?, currency: str}, version: int(int64), created_at: str, card_id: str?, timezone: str, source: map{name: str?}, actions: [map]?, monthly_billing_anchor_date: int, phases: [map], completed_date: str?}, actions: [map]}

@endgroup

@group team-members
@endpoint POST /v2/team-members
@optional {idempotency_key: str, team_member: map{id: str, reference_id: str, is_owner: bool, status: str, given_name: str, family_name: str, email_address: str, phone_number: str, created_at: str, updated_at: str, assigned_locations: map, wage_setting: map}}
@returns(200) {team_member: map{id: str, reference_id: str?, is_owner: bool, status: str, given_name: str?, family_name: str?, email_address: str?, phone_number: str?, created_at: str, updated_at: str, assigned_locations: map{assignment_type: str, location_ids: [str]?}, wage_setting: map{team_member_id: str?, job_assignments: [map]?, is_overtime_exempt: bool?, version: int, created_at: str, updated_at: str}}, errors: [map]}

@endpoint POST /v2/team-members/bulk-create
@required {team_members: map}
@returns(200) {team_members: map, errors: [map]}

@endpoint POST /v2/team-members/bulk-update
@required {team_members: map}
@returns(200) {team_members: map, errors: [map]}

@endpoint GET /v2/team-members/jobs
@optional {cursor: str}
@returns(200) {jobs: [map], cursor: str, errors: [map]}

@endpoint POST /v2/team-members/jobs
@required {job: map{id: str, title: str, is_tip_eligible: bool, created_at: str, updated_at: str, version: int}, idempotency_key: str}
@returns(200) {job: map{id: str, title: str?, is_tip_eligible: bool?, created_at: str, updated_at: str, version: int}, errors: [map]}

@endpoint GET /v2/team-members/jobs/{job_id}
@required {job_id: str}
@returns(200) {job: map{id: str, title: str?, is_tip_eligible: bool?, created_at: str, updated_at: str, version: int}, errors: [map]}

@endpoint PUT /v2/team-members/jobs/{job_id}
@required {job_id: str, job: map{id: str, title: str, is_tip_eligible: bool, created_at: str, updated_at: str, version: int}}
@returns(200) {job: map{id: str, title: str?, is_tip_eligible: bool?, created_at: str, updated_at: str, version: int}, errors: [map]}

@endpoint POST /v2/team-members/search
@optional {query: map{filter: map}, limit: int, cursor: str}
@returns(200) {team_members: [map], cursor: str, errors: [map]}

@endpoint GET /v2/team-members/{team_member_id}
@required {team_member_id: str}
@returns(200) {team_member: map{id: str, reference_id: str?, is_owner: bool, status: str, given_name: str?, family_name: str?, email_address: str?, phone_number: str?, created_at: str, updated_at: str, assigned_locations: map{assignment_type: str, location_ids: [str]?}, wage_setting: map{team_member_id: str?, job_assignments: [map]?, is_overtime_exempt: bool?, version: int, created_at: str, updated_at: str}}, errors: [map]}

@endpoint PUT /v2/team-members/{team_member_id}
@required {team_member_id: str}
@optional {team_member: map{id: str, reference_id: str, is_owner: bool, status: str, given_name: str, family_name: str, email_address: str, phone_number: str, created_at: str, updated_at: str, assigned_locations: map, wage_setting: map}}
@returns(200) {team_member: map{id: str, reference_id: str?, is_owner: bool, status: str, given_name: str?, family_name: str?, email_address: str?, phone_number: str?, created_at: str, updated_at: str, assigned_locations: map{assignment_type: str, location_ids: [str]?}, wage_setting: map{team_member_id: str?, job_assignments: [map]?, is_overtime_exempt: bool?, version: int, created_at: str, updated_at: str}}, errors: [map]}

@endpoint GET /v2/team-members/{team_member_id}/wage-setting
@required {team_member_id: str}
@returns(200) {wage_setting: map{team_member_id: str?, job_assignments: [map]?, is_overtime_exempt: bool?, version: int, created_at: str, updated_at: str}, errors: [map]}

@endpoint PUT /v2/team-members/{team_member_id}/wage-setting
@required {team_member_id: str, wage_setting: map{team_member_id: str, job_assignments: [map], is_overtime_exempt: bool, version: int, created_at: str, updated_at: str}}
@returns(200) {wage_setting: map{team_member_id: str?, job_assignments: [map]?, is_overtime_exempt: bool?, version: int, created_at: str, updated_at: str}, errors: [map]}

@endgroup

@group terminals
@endpoint POST /v2/terminals/actions
@required {idempotency_key: str, action: map{id: str, device_id: str, deadline_duration: str, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str, type: str, qr_code_options: map, save_card_options: map, signature_options: map, confirmation_options: map, receipt_options: map, data_collection_options: map, select_options: map, device_metadata: map, await_next_action: bool, await_next_action_duration: str}}
@returns(200) {errors: [map], action: map{id: str, device_id: str?, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str, type: str, qr_code_options: map{title: str, body: str, barcode_contents: str}, save_card_options: map{customer_id: str, card_id: str, reference_id: str?}, signature_options: map{title: str, body: str, signature: [map]}, confirmation_options: map{title: str, body: str, agree_button_text: str, disagree_button_text: str?, decision: map{has_agreed: bool}}, receipt_options: map{payment_id: str, print_only: bool?, is_duplicate: bool?}, data_collection_options: map{title: str, body: str, input_type: str, collected_data: map{input_text: str}}, select_options: map{title: str, body: str, options: [map], selected_option: map{reference_id: str, title: str}}, device_metadata: map{battery_percentage: str?, charging_state: str?, location_id: str?, merchant_id: str?, network_connection_type: str?, payment_region: str?, serial_number: str?, os_version: str?, app_version: str?, wifi_network_name: str?, wifi_network_strength: str?, ip_address: str?}, await_next_action: bool?, await_next_action_duration: str?}}

@endpoint POST /v2/terminals/actions/search
@optional {query: map{filter: map, sort: map}, cursor: str, limit: int}
@returns(200) {errors: [map], action: [map], cursor: str}

@endpoint GET /v2/terminals/actions/{action_id}
@required {action_id: str}
@returns(200) {errors: [map], action: map{id: str, device_id: str?, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str, type: str, qr_code_options: map{title: str, body: str, barcode_contents: str}, save_card_options: map{customer_id: str, card_id: str, reference_id: str?}, signature_options: map{title: str, body: str, signature: [map]}, confirmation_options: map{title: str, body: str, agree_button_text: str, disagree_button_text: str?, decision: map{has_agreed: bool}}, receipt_options: map{payment_id: str, print_only: bool?, is_duplicate: bool?}, data_collection_options: map{title: str, body: str, input_type: str, collected_data: map{input_text: str}}, select_options: map{title: str, body: str, options: [map], selected_option: map{reference_id: str, title: str}}, device_metadata: map{battery_percentage: str?, charging_state: str?, location_id: str?, merchant_id: str?, network_connection_type: str?, payment_region: str?, serial_number: str?, os_version: str?, app_version: str?, wifi_network_name: str?, wifi_network_strength: str?, ip_address: str?}, await_next_action: bool?, await_next_action_duration: str?}}

@endpoint POST /v2/terminals/actions/{action_id}/cancel
@required {action_id: str}
@returns(200) {errors: [map], action: map{id: str, device_id: str?, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str, type: str, qr_code_options: map{title: str, body: str, barcode_contents: str}, save_card_options: map{customer_id: str, card_id: str, reference_id: str?}, signature_options: map{title: str, body: str, signature: [map]}, confirmation_options: map{title: str, body: str, agree_button_text: str, disagree_button_text: str?, decision: map{has_agreed: bool}}, receipt_options: map{payment_id: str, print_only: bool?, is_duplicate: bool?}, data_collection_options: map{title: str, body: str, input_type: str, collected_data: map{input_text: str}}, select_options: map{title: str, body: str, options: [map], selected_option: map{reference_id: str, title: str}}, device_metadata: map{battery_percentage: str?, charging_state: str?, location_id: str?, merchant_id: str?, network_connection_type: str?, payment_region: str?, serial_number: str?, os_version: str?, app_version: str?, wifi_network_name: str?, wifi_network_strength: str?, ip_address: str?}, await_next_action: bool?, await_next_action_duration: str?}}

@endpoint POST /v2/terminals/actions/{action_id}/dismiss
@required {action_id: str}
@returns(200) {errors: [map], action: map{id: str, device_id: str?, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str, type: str, qr_code_options: map{title: str, body: str, barcode_contents: str}, save_card_options: map{customer_id: str, card_id: str, reference_id: str?}, signature_options: map{title: str, body: str, signature: [map]}, confirmation_options: map{title: str, body: str, agree_button_text: str, disagree_button_text: str?, decision: map{has_agreed: bool}}, receipt_options: map{payment_id: str, print_only: bool?, is_duplicate: bool?}, data_collection_options: map{title: str, body: str, input_type: str, collected_data: map{input_text: str}}, select_options: map{title: str, body: str, options: [map], selected_option: map{reference_id: str, title: str}}, device_metadata: map{battery_percentage: str?, charging_state: str?, location_id: str?, merchant_id: str?, network_connection_type: str?, payment_region: str?, serial_number: str?, os_version: str?, app_version: str?, wifi_network_name: str?, wifi_network_strength: str?, ip_address: str?}, await_next_action: bool?, await_next_action_duration: str?}}

@endpoint POST /v2/terminals/checkouts
@required {idempotency_key: str, checkout: map{id: str, amount_money!: map, reference_id: str, note: str, order_id: str, payment_options: map, device_options!: map, deadline_duration: str, status: str, cancel_reason: str, payment_ids: [str], created_at: str, updated_at: str, app_id: str, location_id: str, payment_type: str, team_member_id: str, customer_id: str, app_fee_money: map, statement_description_identifier: str, tip_money: map}}
@returns(200) {errors: [map], checkout: map{id: str, amount_money: map{amount: int(int64)?, currency: str}, reference_id: str?, note: str?, order_id: str?, payment_options: map{autocomplete: bool?, delay_duration: str?, accept_partial_authorization: bool?, delay_action: str}, device_options: map{device_id: str, skip_receipt_screen: bool?, collect_signature: bool?, tip_settings: map{allow_tipping: bool?, separate_tip_screen: bool?, custom_tip_field: bool?, tip_percentages: [int]?, smart_tipping: bool?}, show_itemized_cart: bool?}, deadline_duration: str?, status: str, cancel_reason: str, payment_ids: [str], created_at: str, updated_at: str, app_id: str, location_id: str, payment_type: str, team_member_id: str?, customer_id: str?, app_fee_money: map{amount: int(int64)?, currency: str}, statement_description_identifier: str?, tip_money: map{amount: int(int64)?, currency: str}}}

@endpoint POST /v2/terminals/checkouts/search
@optional {query: map{filter: map, sort: map}, cursor: str, limit: int}
@returns(200) {errors: [map], checkouts: [map], cursor: str}

@endpoint GET /v2/terminals/checkouts/{checkout_id}
@required {checkout_id: str}
@returns(200) {errors: [map], checkout: map{id: str, amount_money: map{amount: int(int64)?, currency: str}, reference_id: str?, note: str?, order_id: str?, payment_options: map{autocomplete: bool?, delay_duration: str?, accept_partial_authorization: bool?, delay_action: str}, device_options: map{device_id: str, skip_receipt_screen: bool?, collect_signature: bool?, tip_settings: map{allow_tipping: bool?, separate_tip_screen: bool?, custom_tip_field: bool?, tip_percentages: [int]?, smart_tipping: bool?}, show_itemized_cart: bool?}, deadline_duration: str?, status: str, cancel_reason: str, payment_ids: [str], created_at: str, updated_at: str, app_id: str, location_id: str, payment_type: str, team_member_id: str?, customer_id: str?, app_fee_money: map{amount: int(int64)?, currency: str}, statement_description_identifier: str?, tip_money: map{amount: int(int64)?, currency: str}}}

@endpoint POST /v2/terminals/checkouts/{checkout_id}/cancel
@required {checkout_id: str}
@returns(200) {errors: [map], checkout: map{id: str, amount_money: map{amount: int(int64)?, currency: str}, reference_id: str?, note: str?, order_id: str?, payment_options: map{autocomplete: bool?, delay_duration: str?, accept_partial_authorization: bool?, delay_action: str}, device_options: map{device_id: str, skip_receipt_screen: bool?, collect_signature: bool?, tip_settings: map{allow_tipping: bool?, separate_tip_screen: bool?, custom_tip_field: bool?, tip_percentages: [int]?, smart_tipping: bool?}, show_itemized_cart: bool?}, deadline_duration: str?, status: str, cancel_reason: str, payment_ids: [str], created_at: str, updated_at: str, app_id: str, location_id: str, payment_type: str, team_member_id: str?, customer_id: str?, app_fee_money: map{amount: int(int64)?, currency: str}, statement_description_identifier: str?, tip_money: map{amount: int(int64)?, currency: str}}}

@endpoint POST /v2/terminals/checkouts/{checkout_id}/dismiss
@required {checkout_id: str}
@returns(200) {errors: [map], checkout: map{id: str, amount_money: map{amount: int(int64)?, currency: str}, reference_id: str?, note: str?, order_id: str?, payment_options: map{autocomplete: bool?, delay_duration: str?, accept_partial_authorization: bool?, delay_action: str}, device_options: map{device_id: str, skip_receipt_screen: bool?, collect_signature: bool?, tip_settings: map{allow_tipping: bool?, separate_tip_screen: bool?, custom_tip_field: bool?, tip_percentages: [int]?, smart_tipping: bool?}, show_itemized_cart: bool?}, deadline_duration: str?, status: str, cancel_reason: str, payment_ids: [str], created_at: str, updated_at: str, app_id: str, location_id: str, payment_type: str, team_member_id: str?, customer_id: str?, app_fee_money: map{amount: int(int64)?, currency: str}, statement_description_identifier: str?, tip_money: map{amount: int(int64)?, currency: str}}}

@endpoint POST /v2/terminals/refunds
@required {idempotency_key: str}
@optional {refund: map{id: str, refund_id: str, payment_id!: str, order_id: str, amount_money!: map, reason!: str, device_id!: str, deadline_duration: str, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str}}
@returns(200) {errors: [map], refund: map{id: str, refund_id: str, payment_id: str, order_id: str, amount_money: map{amount: int(int64)?, currency: str}, reason: str, device_id: str, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str}}

@endpoint POST /v2/terminals/refunds/search
@optional {query: map{filter: map, sort: map}, cursor: str, limit: int}
@returns(200) {errors: [map], refunds: [map], cursor: str}

@endpoint GET /v2/terminals/refunds/{terminal_refund_id}
@required {terminal_refund_id: str}
@returns(200) {errors: [map], refund: map{id: str, refund_id: str, payment_id: str, order_id: str, amount_money: map{amount: int(int64)?, currency: str}, reason: str, device_id: str, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str}}

@endpoint POST /v2/terminals/refunds/{terminal_refund_id}/cancel
@required {terminal_refund_id: str}
@returns(200) {errors: [map], refund: map{id: str, refund_id: str, payment_id: str, order_id: str, amount_money: map{amount: int(int64)?, currency: str}, reason: str, device_id: str, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str}}

@endpoint POST /v2/terminals/refunds/{terminal_refund_id}/dismiss
@required {terminal_refund_id: str}
@returns(200) {errors: [map], refund: map{id: str, refund_id: str, payment_id: str, order_id: str, amount_money: map{amount: int(int64)?, currency: str}, reason: str, device_id: str, deadline_duration: str?, status: str, cancel_reason: str, created_at: str, updated_at: str, app_id: str, location_id: str}}

@endgroup

@group transfer-orders
@endpoint POST /v2/transfer-orders
@required {idempotency_key: str, transfer_order: map{source_location_id!: str, destination_location_id!: str, expected_at: str, notes: str, tracking_number: str, created_by_team_member_id: str, line_items: [map]}}
@returns(200) {transfer_order: map{id: str, source_location_id: str?, destination_location_id: str?, status: str, created_at: str, updated_at: str, expected_at: str?, completed_at: str, notes: str?, tracking_number: str?, created_by_team_member_id: str, line_items: [map]?, version: int(int64)}, errors: [map]}

@endpoint POST /v2/transfer-orders/search
@optional {query: map{filter: map, sort: map}, cursor: str, limit: int}
@returns(200) {transfer_orders: [map], cursor: str, errors: [map]}

@endpoint DELETE /v2/transfer-orders/{transfer_order_id}
@required {transfer_order_id: str}
@optional {version: int(int64)}
@returns(200) {errors: [map]}

@endpoint GET /v2/transfer-orders/{transfer_order_id}
@required {transfer_order_id: str}
@returns(200) {transfer_order: map{id: str, source_location_id: str?, destination_location_id: str?, status: str, created_at: str, updated_at: str, expected_at: str?, completed_at: str, notes: str?, tracking_number: str?, created_by_team_member_id: str, line_items: [map]?, version: int(int64)}, errors: [map]}

@endpoint PUT /v2/transfer-orders/{transfer_order_id}
@required {transfer_order_id: str, idempotency_key: str, transfer_order: map{source_location_id: str, destination_location_id: str, expected_at: str, notes: str, tracking_number: str, line_items: [map]}}
@optional {version: int(int64)}
@returns(200) {transfer_order: map{id: str, source_location_id: str?, destination_location_id: str?, status: str, created_at: str, updated_at: str, expected_at: str?, completed_at: str, notes: str?, tracking_number: str?, created_by_team_member_id: str, line_items: [map]?, version: int(int64)}, errors: [map]}

@endpoint POST /v2/transfer-orders/{transfer_order_id}/cancel
@required {transfer_order_id: str, idempotency_key: str}
@optional {version: int(int64)}
@returns(200) {transfer_order: map{id: str, source_location_id: str?, destination_location_id: str?, status: str, created_at: str, updated_at: str, expected_at: str?, completed_at: str, notes: str?, tracking_number: str?, created_by_team_member_id: str, line_items: [map]?, version: int(int64)}, errors: [map]}

@endpoint POST /v2/transfer-orders/{transfer_order_id}/receive
@required {transfer_order_id: str, idempotency_key: str, receipt: map{line_items: [map]}}
@optional {version: int(int64)}
@returns(200) {transfer_order: map{id: str, source_location_id: str?, destination_location_id: str?, status: str, created_at: str, updated_at: str, expected_at: str?, completed_at: str, notes: str?, tracking_number: str?, created_by_team_member_id: str, line_items: [map]?, version: int(int64)}, errors: [map]}

@endpoint POST /v2/transfer-orders/{transfer_order_id}/start
@required {transfer_order_id: str, idempotency_key: str}
@optional {version: int(int64)}
@returns(200) {transfer_order: map{id: str, source_location_id: str?, destination_location_id: str?, status: str, created_at: str, updated_at: str, expected_at: str?, completed_at: str, notes: str?, tracking_number: str?, created_by_team_member_id: str, line_items: [map]?, version: int(int64)}, errors: [map]}

@endgroup

@group vendors
@endpoint POST /v2/vendors/bulk-create
@required {vendors: map}
@returns(200) {errors: [map], responses: map}

@endpoint POST /v2/vendors/bulk-retrieve
@optional {vendor_ids: [str]}
@returns(200) {errors: [map], responses: map}

@endpoint PUT /v2/vendors/bulk-update
@required {vendors: map}
@returns(200) {errors: [map], responses: map}

@endpoint POST /v2/vendors/create
@required {idempotency_key: str}
@optional {vendor: map{id: str, created_at: str, updated_at: str, name: str, address: map, contacts: [map], account_number: str, note: str, version: int, status: str}}
@returns(200) {errors: [map], vendor: map{id: str, created_at: str, updated_at: str, name: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, contacts: [map]?, account_number: str?, note: str?, version: int, status: str}}

@endpoint POST /v2/vendors/search
@optional {filter: map{name: [str], status: [str]}, sort: map{field: str, order: str}, cursor: str}
@returns(200) {errors: [map], vendors: [map], cursor: str}

@endpoint GET /v2/vendors/{vendor_id}
@required {vendor_id: str}
@returns(200) {errors: [map], vendor: map{id: str, created_at: str, updated_at: str, name: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, contacts: [map]?, account_number: str?, note: str?, version: int, status: str}}

@endpoint PUT /v2/vendors/{vendor_id}
@required {vendor: map{id: str, created_at: str, updated_at: str, name: str, address: map, contacts: [map], account_number: str, note: str, version: int, status: str}}
@optional {idempotency_key: str}
@returns(200) {errors: [map], vendor: map{id: str, created_at: str, updated_at: str, name: str?, address: map{address_line_1: str?, address_line_2: str?, address_line_3: str?, locality: str?, sublocality: str?, sublocality_2: str?, sublocality_3: str?, administrative_district_level_1: str?, administrative_district_level_2: str?, administrative_district_level_3: str?, postal_code: str?, country: str, first_name: str?, last_name: str?}, contacts: [map]?, account_number: str?, note: str?, version: int, status: str}}

@endgroup

@group webhooks
@endpoint GET /v2/webhooks/event-types
@optional {api_version: str}
@returns(200) {errors: [map], event_types: [str], metadata: [map]}

@endpoint GET /v2/webhooks/subscriptions
@optional {cursor: str, include_disabled: bool=false, sort_order: str, limit: int}
@returns(200) {errors: [map], subscriptions: [map], cursor: str}

@endpoint POST /v2/webhooks/subscriptions
@required {subscription: map{id: str, name: str, enabled: bool, event_types: [str], notification_url: str, api_version: str, signature_key: str, created_at: str, updated_at: str}}
@optional {idempotency_key: str}
@returns(200) {errors: [map], subscription: map{id: str, name: str?, enabled: bool?, event_types: [str]?, notification_url: str?, api_version: str?, signature_key: str, created_at: str, updated_at: str}}

@endpoint DELETE /v2/webhooks/subscriptions/{subscription_id}
@required {subscription_id: str}
@returns(200) {errors: [map]}

@endpoint GET /v2/webhooks/subscriptions/{subscription_id}
@required {subscription_id: str}
@returns(200) {errors: [map], subscription: map{id: str, name: str?, enabled: bool?, event_types: [str]?, notification_url: str?, api_version: str?, signature_key: str, created_at: str, updated_at: str}}

@endpoint PUT /v2/webhooks/subscriptions/{subscription_id}
@required {subscription_id: str}
@optional {subscription: map{id: str, name: str, enabled: bool, event_types: [str], notification_url: str, api_version: str, signature_key: str, created_at: str, updated_at: str}}
@returns(200) {errors: [map], subscription: map{id: str, name: str?, enabled: bool?, event_types: [str]?, notification_url: str?, api_version: str?, signature_key: str, created_at: str, updated_at: str}}

@endpoint POST /v2/webhooks/subscriptions/{subscription_id}/signature-key
@required {subscription_id: str}
@optional {idempotency_key: str}
@returns(200) {errors: [map], signature_key: str}

@endpoint POST /v2/webhooks/subscriptions/{subscription_id}/test
@required {subscription_id: str}
@optional {event_type: str}
@returns(200) {errors: [map], subscription_test_result: map{id: str, status_code: int?, payload: str?, created_at: str, updated_at: str}}

@endgroup

@end
