> ## Documentation Index
> Fetch the complete documentation index at: https://docs.melso.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Melso MCP: https://mcp.melso.ai/mcp (OAuth; one company per connection). Documentation-search MCP: https://docs.melso.ai/mcp; it does not act on customer accounts. Melso API: https://api.melso.ai/v1, with a company API key or a partner key (early access); invoicing is live and the other operations are marked beta.
>
> Use the live tool list and respect company membership. Ask the person to approve the exact invoice or tax return version in the signed-in app. Melso's professionals prepare and file included returns after approval; an AI assistant does not file. A prepared file or an approval is not evidence of filing: only the AEAT's reference and receipt are. Keep credentials out of chat and logs.

# payroll MCP

> MCP payroll: employees, contracts, monthly payslips, Contrat@ and SILTRA files. Approve only when the person asks.

Payroll: employees (contract, modelo 145), contracts, labour settings; contract\_submit sends one to Contrat\@. run\_create opens a draft; payslip\_update records changes. approve, reopen, paid, unpaid only when the person asks. siltra\_file\_generate writes a SILTRA file. red\_response\_import, fie\_import take no file: share web\_upload\_url. Melso sends nothing to SILTRA or banks. Required fields: employee\_create(name, start\_date); employee\_update/run\_delete/contract\_delete/contract\_submit/siltra\_file\_generate/red\_response\_import/strike\_delete(id); run\_create(period); payslip\_update(id, payslip\_id, expected\_version, incidents); recalculate/approve/reopen/paid/unpaid(id, expected\_version); contract\_create(employee\_id, contract); contract\_update(id, contract); settings\_update(expected\_version, settings); document\_record(id, kind); strike\_record(strike).

**Availability:** Self-employed / Company / Gestoría.

Listed to a company and to a self-employed person on Pro or Plus, unless the company switched Nóminas off in Settings → Modules. Melso sends nothing to SILTRA or a bank: the company or its gestoría sends the files.

**Gestoría:** every action, in the client the call names: add `client`, the client's `id` from [`clients_read`](https://docs.melso.ai/mcp/tools/clients-read) `list`. [Melso for gestorías](https://docs.melso.ai/mcp/gestorias.md) explains what a firm's connection does.

The live tool list is authoritative: the company's plan and your role can narrow this contract. [Understand access](https://docs.melso.ai/mcp/permissions.md).

## When to use

Use `payroll` for `approve`, `contract_create`, `contract_delete`, `contract_submit`, `contract_update`, `document_record`, `employee_create`, `employee_update`, `fie_import`, `paid`, `payslip_update`, `recalculate`, `red_response_import`, `reopen`, `run_create`, `run_delete`, `settings_update`, `siltra_file_generate`, `strike_delete`, `strike_record`, `unpaid`. Use [`payroll_read`](https://docs.melso.ai/mcp/tools/payroll-read) for the companion actions. The live tool list determines availability.

## Input

```json theme={null}
{
  "additionalProperties": false,
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "employee_create"
        },
        "end_date": {
          "description": "The agreed end of a fixed-term contract, YYYY-MM-DD; empty for none. Never a baja.",
          "type": "string"
        },
        "name": {
          "description": "The employee's full name, at most 200 characters.",
          "type": "string"
        },
        "profile": {
          "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
          "type": "object"
        },
        "start_date": {
          "description": "The day the contract started, YYYY-MM-DD.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "name",
        "start_date"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "employee_update"
        },
        "active": {
          "description": "false leaves the employee out of the months to come, with no finiquito: it is not a baja. A resignation, dismissal or end of contract is the termination of that month's payroll (payslip_update with its date and cause); keep active true until that month is approved.",
          "type": "boolean"
        },
        "end_date": {
          "description": "The agreed end of a fixed-term contract, YYYY-MM-DD; empty for none. Never a baja.",
          "type": "string"
        },
        "id": {
          "description": "The employee's id, from employees.",
          "type": "string"
        },
        "name": {
          "description": "The employee's full name, at most 200 characters.",
          "type": "string"
        },
        "profile": {
          "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
          "type": "object"
        },
        "start_date": {
          "description": "The day the contract started, YYYY-MM-DD.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "run_create"
        },
        "pay_date": {
          "description": "The day the payroll is paid, YYYY-MM-DD, in the month or the next; the month's last day by default.",
          "type": "string"
        },
        "period": {
          "description": "The month, YYYY-MM.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "period"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "payslip_update"
        },
        "expected_version": {
          "description": "version of the month's payroll from run.",
          "minimum": 1,
          "type": "integer"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        },
        "incidents": {
          "description": "What changed in the month, {} for nothing: overtime, overtime_force_majeure, bonus (incentives accrued in the month) and advance (already paid, deducted) as EUR decimal strings; periodic_bonuses [{concept, amount, from, to, source (convenio when the collective agreement sets it, else other)}], pay accrued over a longer period (YYYY-MM-DD, at most two years), taxed now and contributed by each month's share; unpaid_days; per_diems [{kind (overnight_spain, overnight_abroad, day_spain, day_abroad, flight_spain, flight_abroad), days (of the trips), amount (paid for meals), lodging (the hotel, with invoices; overnight only), long_stay (true past nine months in a row in the same place: nothing exempt)}], exempt up to art. 9 RIRPF's daily limit, the rest taxed and contributed; travel {km (driven in the employee's vehicle), mileage (paid for them, exempt up to 0.26 €/km), tolls (and parking, with receipts), public_transport (with tickets)}; in_kind [{kind (housing, rented_housing, car, car_delivery, loan, health_insurance, meal_vouchers, canteen, transport, nursery, training, other), concept, amount (its cost this month: rent, premium, vouchers, card, canteen cost, nursery, training, the car given; for other its market value), cadastral_value and cadastral_revised (revised in the last ten years) or property_value (without one) for housing and rented_housing, vehicle_value (cost with taxes, or market value new when vehicle_leased), private_use (percentage), efficiency (euro6, hybrid, electric, plug_in) and value_before_tax for a car, principal and interest_rate for a loan, persons and disabled for health_insurance, days (working days without exempt per diem) for meal_vouchers, cost (to the company, what it contributes) for other}], valued by art. 43 LIRPF with art. 42.3's exemptions, ask what each kind needs, never guess it; leaves [{kind (common or professional), start, end (the discharge; omit while it lasts), daily_base (omit: the law's, from earlier payslips), accident (true if from an accident), special (a common leave's art. 169.1.a situation: menstruation, pregnancy_interruption, pregnancy_week_39, donation, menopause, gender_violence), process_days (a relapse's days already in its process)}]; adjustments [{concept, amount (negative deducts), salary, contributes, taxable}]; arrears [{year, month (an earlier month it belongs to), amount, concept}], taxed now and contributed in that month's complementary liquidation (L03), the employee's share deducted now; termination {date, cause (resignation, trial_period, disciplinary, end_of_term, objective, objective_worker, collective, unfair), vacation_days (not taken), notice_days (not given: positive by the company, negative by the employee), agreed_severance (above the legal one)}, which makes the payslip the finiquito with its legal severance.",
          "type": "object"
        },
        "payslip_id": {
          "description": "The payslip's id, from run.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "payslip_id",
        "expected_version",
        "incidents"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "recalculate"
        },
        "expected_version": {
          "description": "version of the month's payroll from run.",
          "minimum": 1,
          "type": "integer"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "expected_version"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "run_delete"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "approve"
        },
        "expected_version": {
          "description": "version of the month's payroll from run.",
          "minimum": 1,
          "type": "integer"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "expected_version"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "reopen"
        },
        "expected_version": {
          "description": "version of the month's payroll from run.",
          "minimum": 1,
          "type": "integer"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "expected_version"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "paid"
        },
        "expected_version": {
          "description": "version of the month's payroll from run.",
          "minimum": 1,
          "type": "integer"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "expected_version"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "unpaid"
        },
        "expected_version": {
          "description": "version of the month's payroll from run.",
          "minimum": 1,
          "type": "integer"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "expected_version"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "contract_create"
        },
        "contract": {
          "description": "A contract as the SEPE and the Seguridad Social know it. Keys: event (initial, extension or conversion) with previous_id (the contract extended or converted); start_date and end_date (a fixed-term contract's agreed end, YYYY-MM-DD); code, the SEPE clave of 3 digits (100 indefinite full time, 200 part time, 300 fijo discontinuo, 402 or 502 circumstances of production, 410 or 510 replacement, 420 or 520 professional practice, 441 or 541 relief, 189 or 289 conversions…); account (the id of a settings account, the CCC and work centre); occupation (CNO-11, 4 digits); position; duties (what the INSS reads, at most 260 characters); group (1 to 11, the grupo de cotización); weekly_hours and full_time_hours; annual_hours (fijo discontinuo, or the hours a year a part-time contract agrees, art. 12.4.a ET, with weekly_hours their weekly average under the agreement's annual working time, which contract_document checks); temporality_cause (a fixed-term contract's cause, linked to its duration); foreseeable; replacement_cause and replaced {naf, given_name, first_surname, second_surname}; relief_worker_type; bonus_group; qualification; professional_certificate; ere; prtr; basic_copy_signature (only when the company has workers' representatives and the contract is initial or a conversion: signed or refused, what the representatives did with its copia básica, which goes to the SEPE with the contract; the file is not written until it is set); sepe_key (E and 13 digits, once the SEPE answered); document, the written contract's terms that contract_pdf prints, as contract_document asks for them: classification {group, level, area, technician, graduate, category, territory} (the employee's place in the collective agreement, as its text writes it: the grupo profesional and, when the agreement uses them, the salary level, the VI ALEH's área funcional, whether the employee is técnico o titulado (true or false), whether the employee has a university degree or a title officially recognised as equivalent (graduate, true or false), the establishment's category and the territory whose salary table applies; it sets the trial period, the salary table and the notice), functions (the job's tasks, one each), schedule and schedule_rows [{days, hours}], signing_place and signing_date, trial {months, days} (absent: the longest the agreement allows; zero: none), remote_work, remote_agreement when remote_work is true (Ley 10/2021 art. 7, asked for and never assumed: place, percent from 1 to 100, distribution, inventory [{item, useful_life}], expenses {items, compensation, when, form}, availability, reversibility_notice, control, technical_difficulties, data_protection, information_security, duration; percent at most 50 for a practice contract or a worker under 18, art. 3), non_compete {months, compensation}, permanence {months, training, amount}, full_dedication {compensation}, variable_pay, algorithmic_systems with algorithmic_description, degree, policies_location, duration_link (402/502: how the circumstances connect with the duration, as the SEPE's model asks), replaced_nif (410/510: the NIF or NIE of the employee replaced), studies_completed (420/520: the day the degree's studies ended) and training_plan {content, tutoring, tutor_name, tutor_position} (420/520: the individual training plan), complementary_hours {hours, notice_days, voluntary} (part time: hours a year the company may ask for, days of notice, and voluntary hours a year a permanent contract may be offered; its SEPE annex), public_employee {condition, requested, granted} when the employee also holds a public post (Ley 53/1984 art. 14: the private activity needs the prior recognition of compatibility; condition is what the parties choose and is never assumed: suspensive, the contract takes effect once it is granted, or resolutory, it ends if it is refused, art. 49.1.b ET; requested and granted are the days of the request and the resolution, YYYY-MM-DD), irregular_distribution {notice_days} (the working time distributed irregularly over the year by a calendar the company gives with notice_days of notice of each day and hour, 5 to 60, art. 34.2 ET; only when the parties agree it). A change sent without document keeps the terms the contract has.",
          "type": "object"
        },
        "employee_id": {
          "description": "The employee's id, from employees.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "employee_id",
        "contract"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "contract_update"
        },
        "contract": {
          "description": "A contract as the SEPE and the Seguridad Social know it. Keys: event (initial, extension or conversion) with previous_id (the contract extended or converted); start_date and end_date (a fixed-term contract's agreed end, YYYY-MM-DD); code, the SEPE clave of 3 digits (100 indefinite full time, 200 part time, 300 fijo discontinuo, 402 or 502 circumstances of production, 410 or 510 replacement, 420 or 520 professional practice, 441 or 541 relief, 189 or 289 conversions…); account (the id of a settings account, the CCC and work centre); occupation (CNO-11, 4 digits); position; duties (what the INSS reads, at most 260 characters); group (1 to 11, the grupo de cotización); weekly_hours and full_time_hours; annual_hours (fijo discontinuo, or the hours a year a part-time contract agrees, art. 12.4.a ET, with weekly_hours their weekly average under the agreement's annual working time, which contract_document checks); temporality_cause (a fixed-term contract's cause, linked to its duration); foreseeable; replacement_cause and replaced {naf, given_name, first_surname, second_surname}; relief_worker_type; bonus_group; qualification; professional_certificate; ere; prtr; basic_copy_signature (only when the company has workers' representatives and the contract is initial or a conversion: signed or refused, what the representatives did with its copia básica, which goes to the SEPE with the contract; the file is not written until it is set); sepe_key (E and 13 digits, once the SEPE answered); document, the written contract's terms that contract_pdf prints, as contract_document asks for them: classification {group, level, area, technician, graduate, category, territory} (the employee's place in the collective agreement, as its text writes it: the grupo profesional and, when the agreement uses them, the salary level, the VI ALEH's área funcional, whether the employee is técnico o titulado (true or false), whether the employee has a university degree or a title officially recognised as equivalent (graduate, true or false), the establishment's category and the territory whose salary table applies; it sets the trial period, the salary table and the notice), functions (the job's tasks, one each), schedule and schedule_rows [{days, hours}], signing_place and signing_date, trial {months, days} (absent: the longest the agreement allows; zero: none), remote_work, remote_agreement when remote_work is true (Ley 10/2021 art. 7, asked for and never assumed: place, percent from 1 to 100, distribution, inventory [{item, useful_life}], expenses {items, compensation, when, form}, availability, reversibility_notice, control, technical_difficulties, data_protection, information_security, duration; percent at most 50 for a practice contract or a worker under 18, art. 3), non_compete {months, compensation}, permanence {months, training, amount}, full_dedication {compensation}, variable_pay, algorithmic_systems with algorithmic_description, degree, policies_location, duration_link (402/502: how the circumstances connect with the duration, as the SEPE's model asks), replaced_nif (410/510: the NIF or NIE of the employee replaced), studies_completed (420/520: the day the degree's studies ended) and training_plan {content, tutoring, tutor_name, tutor_position} (420/520: the individual training plan), complementary_hours {hours, notice_days, voluntary} (part time: hours a year the company may ask for, days of notice, and voluntary hours a year a permanent contract may be offered; its SEPE annex), public_employee {condition, requested, granted} when the employee also holds a public post (Ley 53/1984 art. 14: the private activity needs the prior recognition of compatibility; condition is what the parties choose and is never assumed: suspensive, the contract takes effect once it is granted, or resolutory, it ends if it is refused, art. 49.1.b ET; requested and granted are the days of the request and the resolution, YYYY-MM-DD), irregular_distribution {notice_days} (the working time distributed irregularly over the year by a calendar the company gives with notice_days of notice of each day and hour, 5 to 60, art. 34.2 ET; only when the parties agree it). A change sent without document keeps the terms the contract has.",
          "type": "object"
        },
        "id": {
          "description": "The contract's id, from contracts.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "contract"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "contract_delete"
        },
        "id": {
          "description": "The contract's id, from contracts.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "contract_submit"
        },
        "id": {
          "description": "The contract's id, from contracts.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "settings_update"
        },
        "expected_version": {
          "description": "version from settings, 0 before the first save.",
          "minimum": 0,
          "type": "integer"
        },
        "settings": {
          "description": "Only the keys that change. Keys: red_holder (company or gestoria, sent with the number); red_authorization (8 digits); red_ccc_assigned (its CCCs assigned to it); cnae (4 digits); accounts [{id, regime (0111), province (2 digits), number (9 digits), name, address, postal_code, municipality (INE, 5 digits), agreement (the collective agreement's REGCON code, 14 digits), at_ep_insurer (who covers its accidents at work: the mutua's number from mutual_insurers, as 151, or inss), common_contingencies_insurer (who pays its sick leave of common contingencies: inss or the same mutua)}], the whole list; payer_iban and payer_bic (the account salaries leave from); worker_representatives (the staff has legal representatives, who sign each contract's copia básica before it goes to the SEPE with the contract); representative {nif, given_name, first_surname, second_surname, position}, who signs the company's contracts and certificates; pay_day, the day the collective agreement, the contracts or custom set for paying each month, which decides the tax year of a month paid late: month_end (by the month's last day), month_day_1 to month_day_30 (that day of the month itself, the last in a shorter month, taxed as month_end; a month's payroll is created with it as its pay_date), or empty when not known; a day of the next month (day_1 to day_10) is refused with payroll_pay_day_next_month, since Melso does not calculate it yet.",
          "type": "object"
        }
      },
      "required": [
        "action",
        "expected_version",
        "settings"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "document_record"
        },
        "channel": {
          "description": "information_notice: how it was delivered, paper or electronic.",
          "type": "string"
        },
        "contract_id": {
          "description": "The contract's id, from documents or contracts.",
          "type": "string"
        },
        "delivered_on": {
          "description": "information_notice: the day it was delivered, YYYY-MM-DD.",
          "type": "string"
        },
        "file_id": {
          "description": "The file's id in Documentos.",
          "type": "string"
        },
        "id": {
          "description": "The employee's id, from employees.",
          "type": "string"
        },
        "kind": {
          "enum": [
            "information_notice",
            "signed_contract"
          ],
          "type": "string"
        },
        "requested_on": {
          "description": "information_notice: the day the employee asked for it, YYYY-MM-DD.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id",
        "kind"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "siltra_file_generate"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        },
        "kind": {
          "description": "bases, vacation-bases, arrears-bases, rectification-bases, l90-bases or l91-bases; next_kind by default.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "red_response_import"
        },
        "attachment_id": {
          "description": "In the Melso chat: the attachment_id of the SILTRA file the person sent, at most 16 MB.",
          "type": "string"
        },
        "id": {
          "description": "The month's payroll id, from runs.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "fie_import"
        },
        "attachment_id": {
          "description": "In the Melso chat: the attachment_id of the FIE file the person sent, at most 4 MB.",
          "type": "string"
        }
      },
      "required": [
        "action"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "strike_record"
        },
        "employee_id": {
          "description": "A new strike's employee, from employees.",
          "type": "string"
        },
        "id": {
          "description": "The strike's id, from strikes, to correct it; omit to record a new one.",
          "type": "string"
        },
        "strike": {
          "description": "The strike whole. Keys: kind (total or partial); start, its first day, YYYY-MM-DD; end, its last day, omitted while it lasts; worked, only for a partial one: the part of the usual day the employee worked on each strike day, in thousandths from 1 to 999 (500 is half the day).",
          "type": "object"
        }
      },
      "required": [
        "action",
        "strike"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "action": {
          "const": "strike_delete"
        },
        "id": {
          "description": "The strike's id, from strikes.",
          "type": "string"
        }
      },
      "required": [
        "action",
        "id"
      ],
      "type": "object"
    }
  ],
  "properties": {
    "action": {
      "enum": [
        "employee_create",
        "employee_update",
        "run_create",
        "payslip_update",
        "recalculate",
        "run_delete",
        "approve",
        "reopen",
        "paid",
        "unpaid",
        "contract_create",
        "contract_update",
        "contract_delete",
        "contract_submit",
        "settings_update",
        "document_record",
        "siltra_file_generate",
        "red_response_import",
        "fie_import",
        "strike_record",
        "strike_delete"
      ],
      "type": "string"
    },
    "active": {
      "description": "false leaves the employee out of the months to come, with no finiquito: it is not a baja. A resignation, dismissal or end of contract is the termination of that month's payroll (payslip_update with its date and cause); keep active true until that month is approved.",
      "type": "boolean"
    },
    "attachment_id": {
      "anyOf": [
        {
          "description": "In the Melso chat: the attachment_id of the SILTRA file the person sent, at most 16 MB.",
          "type": "string"
        },
        {
          "description": "In the Melso chat: the attachment_id of the FIE file the person sent, at most 4 MB.",
          "type": "string"
        }
      ]
    },
    "channel": {
      "description": "information_notice: how it was delivered, paper or electronic.",
      "type": "string"
    },
    "confirmation_token": {
      "type": "string"
    },
    "contract": {
      "description": "A contract as the SEPE and the Seguridad Social know it. Keys: event (initial, extension or conversion) with previous_id (the contract extended or converted); start_date and end_date (a fixed-term contract's agreed end, YYYY-MM-DD); code, the SEPE clave of 3 digits (100 indefinite full time, 200 part time, 300 fijo discontinuo, 402 or 502 circumstances of production, 410 or 510 replacement, 420 or 520 professional practice, 441 or 541 relief, 189 or 289 conversions…); account (the id of a settings account, the CCC and work centre); occupation (CNO-11, 4 digits); position; duties (what the INSS reads, at most 260 characters); group (1 to 11, the grupo de cotización); weekly_hours and full_time_hours; annual_hours (fijo discontinuo, or the hours a year a part-time contract agrees, art. 12.4.a ET, with weekly_hours their weekly average under the agreement's annual working time, which contract_document checks); temporality_cause (a fixed-term contract's cause, linked to its duration); foreseeable; replacement_cause and replaced {naf, given_name, first_surname, second_surname}; relief_worker_type; bonus_group; qualification; professional_certificate; ere; prtr; basic_copy_signature (only when the company has workers' representatives and the contract is initial or a conversion: signed or refused, what the representatives did with its copia básica, which goes to the SEPE with the contract; the file is not written until it is set); sepe_key (E and 13 digits, once the SEPE answered); document, the written contract's terms that contract_pdf prints, as contract_document asks for them: classification {group, level, area, technician, graduate, category, territory} (the employee's place in the collective agreement, as its text writes it: the grupo profesional and, when the agreement uses them, the salary level, the VI ALEH's área funcional, whether the employee is técnico o titulado (true or false), whether the employee has a university degree or a title officially recognised as equivalent (graduate, true or false), the establishment's category and the territory whose salary table applies; it sets the trial period, the salary table and the notice), functions (the job's tasks, one each), schedule and schedule_rows [{days, hours}], signing_place and signing_date, trial {months, days} (absent: the longest the agreement allows; zero: none), remote_work, remote_agreement when remote_work is true (Ley 10/2021 art. 7, asked for and never assumed: place, percent from 1 to 100, distribution, inventory [{item, useful_life}], expenses {items, compensation, when, form}, availability, reversibility_notice, control, technical_difficulties, data_protection, information_security, duration; percent at most 50 for a practice contract or a worker under 18, art. 3), non_compete {months, compensation}, permanence {months, training, amount}, full_dedication {compensation}, variable_pay, algorithmic_systems with algorithmic_description, degree, policies_location, duration_link (402/502: how the circumstances connect with the duration, as the SEPE's model asks), replaced_nif (410/510: the NIF or NIE of the employee replaced), studies_completed (420/520: the day the degree's studies ended) and training_plan {content, tutoring, tutor_name, tutor_position} (420/520: the individual training plan), complementary_hours {hours, notice_days, voluntary} (part time: hours a year the company may ask for, days of notice, and voluntary hours a year a permanent contract may be offered; its SEPE annex), public_employee {condition, requested, granted} when the employee also holds a public post (Ley 53/1984 art. 14: the private activity needs the prior recognition of compatibility; condition is what the parties choose and is never assumed: suspensive, the contract takes effect once it is granted, or resolutory, it ends if it is refused, art. 49.1.b ET; requested and granted are the days of the request and the resolution, YYYY-MM-DD), irregular_distribution {notice_days} (the working time distributed irregularly over the year by a calendar the company gives with notice_days of notice of each day and hour, 5 to 60, art. 34.2 ET; only when the parties agree it). A change sent without document keeps the terms the contract has.",
      "type": "object"
    },
    "contract_id": {
      "description": "The contract's id, from documents or contracts.",
      "type": "string"
    },
    "delivered_on": {
      "description": "information_notice: the day it was delivered, YYYY-MM-DD.",
      "type": "string"
    },
    "employee_id": {
      "anyOf": [
        {
          "description": "The employee's id, from employees.",
          "type": "string"
        },
        {
          "description": "A new strike's employee, from employees.",
          "type": "string"
        }
      ]
    },
    "end_date": {
      "description": "The agreed end of a fixed-term contract, YYYY-MM-DD; empty for none. Never a baja.",
      "type": "string"
    },
    "expected_version": {
      "anyOf": [
        {
          "description": "version of the month's payroll from run.",
          "minimum": 1,
          "type": "integer"
        },
        {
          "description": "version from settings, 0 before the first save.",
          "minimum": 0,
          "type": "integer"
        }
      ]
    },
    "file_id": {
      "description": "The file's id in Documentos.",
      "type": "string"
    },
    "id": {
      "anyOf": [
        {
          "anyOf": [
            {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "anyOf": [
                                {
                                  "anyOf": [
                                    {
                                      "anyOf": [
                                        {
                                          "anyOf": [
                                            {
                                              "anyOf": [
                                                {
                                                  "anyOf": [
                                                    {
                                                      "anyOf": [
                                                        {
                                                          "anyOf": [
                                                            {
                                                              "anyOf": [
                                                                {
                                                                  "description": "The employee's id, from employees.",
                                                                  "type": "string"
                                                                },
                                                                {
                                                                  "description": "The month's payroll id, from runs.",
                                                                  "type": "string"
                                                                }
                                                              ]
                                                            },
                                                            {
                                                              "description": "The month's payroll id, from runs.",
                                                              "type": "string"
                                                            }
                                                          ]
                                                        },
                                                        {
                                                          "description": "The month's payroll id, from runs.",
                                                          "type": "string"
                                                        }
                                                      ]
                                                    },
                                                    {
                                                      "description": "The month's payroll id, from runs.",
                                                      "type": "string"
                                                    }
                                                  ]
                                                },
                                                {
                                                  "description": "The month's payroll id, from runs.",
                                                  "type": "string"
                                                }
                                              ]
                                            },
                                            {
                                              "description": "The month's payroll id, from runs.",
                                              "type": "string"
                                            }
                                          ]
                                        },
                                        {
                                          "description": "The month's payroll id, from runs.",
                                          "type": "string"
                                        }
                                      ]
                                    },
                                    {
                                      "description": "The contract's id, from contracts.",
                                      "type": "string"
                                    }
                                  ]
                                },
                                {
                                  "description": "The contract's id, from contracts.",
                                  "type": "string"
                                }
                              ]
                            },
                            {
                              "description": "The contract's id, from contracts.",
                              "type": "string"
                            }
                          ]
                        },
                        {
                          "description": "The employee's id, from employees.",
                          "type": "string"
                        }
                      ]
                    },
                    {
                      "description": "The month's payroll id, from runs.",
                      "type": "string"
                    }
                  ]
                },
                {
                  "description": "The month's payroll id, from runs.",
                  "type": "string"
                }
              ]
            },
            {
              "description": "The strike's id, from strikes, to correct it; omit to record a new one.",
              "type": "string"
            }
          ]
        },
        {
          "description": "The strike's id, from strikes.",
          "type": "string"
        }
      ],
      "description": "employee_update and changes: the employee's id, from employees; run actions, red_responses and red_response_import: the month's payroll id, from runs; contract_update, contract_delete, contract_document, contract_submit and contract_submissions: the contract's id, from contracts; strike_record (to correct one) and strike_delete: the strike's id, from strikes; file with scope strike: the strike's id."
    },
    "incidents": {
      "description": "What changed in the month, {} for nothing: overtime, overtime_force_majeure, bonus (incentives accrued in the month) and advance (already paid, deducted) as EUR decimal strings; periodic_bonuses [{concept, amount, from, to, source (convenio when the collective agreement sets it, else other)}], pay accrued over a longer period (YYYY-MM-DD, at most two years), taxed now and contributed by each month's share; unpaid_days; per_diems [{kind (overnight_spain, overnight_abroad, day_spain, day_abroad, flight_spain, flight_abroad), days (of the trips), amount (paid for meals), lodging (the hotel, with invoices; overnight only), long_stay (true past nine months in a row in the same place: nothing exempt)}], exempt up to art. 9 RIRPF's daily limit, the rest taxed and contributed; travel {km (driven in the employee's vehicle), mileage (paid for them, exempt up to 0.26 €/km), tolls (and parking, with receipts), public_transport (with tickets)}; in_kind [{kind (housing, rented_housing, car, car_delivery, loan, health_insurance, meal_vouchers, canteen, transport, nursery, training, other), concept, amount (its cost this month: rent, premium, vouchers, card, canteen cost, nursery, training, the car given; for other its market value), cadastral_value and cadastral_revised (revised in the last ten years) or property_value (without one) for housing and rented_housing, vehicle_value (cost with taxes, or market value new when vehicle_leased), private_use (percentage), efficiency (euro6, hybrid, electric, plug_in) and value_before_tax for a car, principal and interest_rate for a loan, persons and disabled for health_insurance, days (working days without exempt per diem) for meal_vouchers, cost (to the company, what it contributes) for other}], valued by art. 43 LIRPF with art. 42.3's exemptions, ask what each kind needs, never guess it; leaves [{kind (common or professional), start, end (the discharge; omit while it lasts), daily_base (omit: the law's, from earlier payslips), accident (true if from an accident), special (a common leave's art. 169.1.a situation: menstruation, pregnancy_interruption, pregnancy_week_39, donation, menopause, gender_violence), process_days (a relapse's days already in its process)}]; adjustments [{concept, amount (negative deducts), salary, contributes, taxable}]; arrears [{year, month (an earlier month it belongs to), amount, concept}], taxed now and contributed in that month's complementary liquidation (L03), the employee's share deducted now; termination {date, cause (resignation, trial_period, disciplinary, end_of_term, objective, objective_worker, collective, unfair), vacation_days (not taken), notice_days (not given: positive by the company, negative by the employee), agreed_severance (above the legal one)}, which makes the payslip the finiquito with its legal severance.",
      "type": "object"
    },
    "kind": {
      "anyOf": [
        {
          "enum": [
            "information_notice",
            "signed_contract"
          ],
          "type": "string"
        },
        {
          "description": "bases, vacation-bases, arrears-bases, rectification-bases, l90-bases or l91-bases; next_kind by default.",
          "type": "string"
        }
      ]
    },
    "name": {
      "description": "The employee's full name, at most 200 characters.",
      "type": "string"
    },
    "pay_date": {
      "description": "The day the payroll is paid, YYYY-MM-DD, in the month or the next; the month's last day by default.",
      "type": "string"
    },
    "payslip_id": {
      "description": "The payslip's id, from run.",
      "type": "string"
    },
    "period": {
      "description": "The month, YYYY-MM.",
      "type": "string"
    },
    "profile": {
      "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
      "type": "object"
    },
    "requested_on": {
      "description": "information_notice: the day the employee asked for it, YYYY-MM-DD.",
      "type": "string"
    },
    "settings": {
      "description": "Only the keys that change. Keys: red_holder (company or gestoria, sent with the number); red_authorization (8 digits); red_ccc_assigned (its CCCs assigned to it); cnae (4 digits); accounts [{id, regime (0111), province (2 digits), number (9 digits), name, address, postal_code, municipality (INE, 5 digits), agreement (the collective agreement's REGCON code, 14 digits), at_ep_insurer (who covers its accidents at work: the mutua's number from mutual_insurers, as 151, or inss), common_contingencies_insurer (who pays its sick leave of common contingencies: inss or the same mutua)}], the whole list; payer_iban and payer_bic (the account salaries leave from); worker_representatives (the staff has legal representatives, who sign each contract's copia básica before it goes to the SEPE with the contract); representative {nif, given_name, first_surname, second_surname, position}, who signs the company's contracts and certificates; pay_day, the day the collective agreement, the contracts or custom set for paying each month, which decides the tax year of a month paid late: month_end (by the month's last day), month_day_1 to month_day_30 (that day of the month itself, the last in a shorter month, taxed as month_end; a month's payroll is created with it as its pay_date), or empty when not known; a day of the next month (day_1 to day_10) is refused with payroll_pay_day_next_month, since Melso does not calculate it yet.",
      "type": "object"
    },
    "start_date": {
      "description": "The day the contract started, YYYY-MM-DD.",
      "type": "string"
    },
    "strike": {
      "description": "The strike whole. Keys: kind (total or partial); start, its first day, YYYY-MM-DD; end, its last day, omitted while it lasts; worked, only for a partial one: the part of the usual day the employee worked on each strike day, in thousandths from 1 to 999 (500 is half the day).",
      "type": "object"
    }
  },
  "required": [
    "action"
  ],
  "type": "object"
}
```

## Actions

The tool's schema combines the fields of every action. Each action accepts only its own fields below; send `action` with them.

### Payroll actions

These actions change employees, contracts, labour settings or a month. `approve`, `reopen`, `paid` and `unpaid` take the version the person reviewed, only when they ask. Melso sends nothing to SILTRA or a bank; `contract_submit` sends a contract to Contrat@ when the person asks.

> [accordion] approve
>
> Approve a draft month at the version the person reviewed, when they ask for it: its payslips freeze and feed the 111, the 190 and the books' journal proposal. Refused while an employee has no payslip (payroll\_issues), an earlier month of the year is a draft (previous\_run\_not\_approved), or a 111 or 190 already approved or filed covers its pay date (fiscal\_period\_locked).
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "expected_version": {
>       "description": "version of the month's payroll from run.",
>       "minimum": 1,
>       "type": "integer"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "expected_version"
>   ],
>   "type": "object"
> }
> ```

> [accordion] contract\_create
>
> Register an employee's contract, extension or conversion, with what Contrat@, the affiliation files and the written contract need. Only what the person confirmed; ask for what you do not know (the clave, the CNO-11 occupation, the group).
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "contract": {
>       "description": "A contract as the SEPE and the Seguridad Social know it. Keys: event (initial, extension or conversion) with previous_id (the contract extended or converted); start_date and end_date (a fixed-term contract's agreed end, YYYY-MM-DD); code, the SEPE clave of 3 digits (100 indefinite full time, 200 part time, 300 fijo discontinuo, 402 or 502 circumstances of production, 410 or 510 replacement, 420 or 520 professional practice, 441 or 541 relief, 189 or 289 conversions…); account (the id of a settings account, the CCC and work centre); occupation (CNO-11, 4 digits); position; duties (what the INSS reads, at most 260 characters); group (1 to 11, the grupo de cotización); weekly_hours and full_time_hours; annual_hours (fijo discontinuo, or the hours a year a part-time contract agrees, art. 12.4.a ET, with weekly_hours their weekly average under the agreement's annual working time, which contract_document checks); temporality_cause (a fixed-term contract's cause, linked to its duration); foreseeable; replacement_cause and replaced {naf, given_name, first_surname, second_surname}; relief_worker_type; bonus_group; qualification; professional_certificate; ere; prtr; basic_copy_signature (only when the company has workers' representatives and the contract is initial or a conversion: signed or refused, what the representatives did with its copia básica, which goes to the SEPE with the contract; the file is not written until it is set); sepe_key (E and 13 digits, once the SEPE answered); document, the written contract's terms that contract_pdf prints, as contract_document asks for them: classification {group, level, area, technician, graduate, category, territory} (the employee's place in the collective agreement, as its text writes it: the grupo profesional and, when the agreement uses them, the salary level, the VI ALEH's área funcional, whether the employee is técnico o titulado (true or false), whether the employee has a university degree or a title officially recognised as equivalent (graduate, true or false), the establishment's category and the territory whose salary table applies; it sets the trial period, the salary table and the notice), functions (the job's tasks, one each), schedule and schedule_rows [{days, hours}], signing_place and signing_date, trial {months, days} (absent: the longest the agreement allows; zero: none), remote_work, remote_agreement when remote_work is true (Ley 10/2021 art. 7, asked for and never assumed: place, percent from 1 to 100, distribution, inventory [{item, useful_life}], expenses {items, compensation, when, form}, availability, reversibility_notice, control, technical_difficulties, data_protection, information_security, duration; percent at most 50 for a practice contract or a worker under 18, art. 3), non_compete {months, compensation}, permanence {months, training, amount}, full_dedication {compensation}, variable_pay, algorithmic_systems with algorithmic_description, degree, policies_location, duration_link (402/502: how the circumstances connect with the duration, as the SEPE's model asks), replaced_nif (410/510: the NIF or NIE of the employee replaced), studies_completed (420/520: the day the degree's studies ended) and training_plan {content, tutoring, tutor_name, tutor_position} (420/520: the individual training plan), complementary_hours {hours, notice_days, voluntary} (part time: hours a year the company may ask for, days of notice, and voluntary hours a year a permanent contract may be offered; its SEPE annex), public_employee {condition, requested, granted} when the employee also holds a public post (Ley 53/1984 art. 14: the private activity needs the prior recognition of compatibility; condition is what the parties choose and is never assumed: suspensive, the contract takes effect once it is granted, or resolutory, it ends if it is refused, art. 49.1.b ET; requested and granted are the days of the request and the resolution, YYYY-MM-DD), irregular_distribution {notice_days} (the working time distributed irregularly over the year by a calendar the company gives with notice_days of notice of each day and hour, 5 to 60, art. 34.2 ET; only when the parties agree it). A change sent without document keeps the terms the contract has.",
>       "type": "object"
>     },
>     "employee_id": {
>       "description": "The employee's id, from employees.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "employee_id",
>     "contract"
>   ],
>   "type": "object"
> }
> ```

> [accordion] contract\_delete
>
> Delete a registered contract; the employee's terms follow the contracts left. Only when the person asks for it. A contract sent to Contrat@ and not rejected (a send pending, received or unknown) is refused with contract\_sent\_to\_contrata: a change is a correction, made in Contrat\@. One whose alta was recorded as done in Sistema RED is refused with contract\_alta\_in\_red while RED still lets that alta be deleted: the person deletes it in RED and undoes its record in the Seguridad Social tab first.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The contract's id, from contracts.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] contract\_submit
>
> Send a registered contract, extension or conversion to the SEPE's Contrat@ as the company's own Contrat@ user, which Melso keeps sealed (its CIF, NIF or NIE and the clave personal of its SEPE authorization for Contrat@), within the 10 days art. 8.3 ET gives, when the person asks: the answer is the shipment's number, or the error the SEPE refused the file with (fix the data and send it again). A contract the SEPE received is not sent twice. A pending send blocks a repeat; contrata\_outcome\_unknown requires checking Contrat@, never an automatic resend. Only an explicit rejection permits a corrected retry. contrata\_credentials\_missing means the company has not saved that user: whoever manages its payroll saves it in the payroll settings of the Melso web app, and never tells you the key; a company with no authorization for Contrat@ asks the SEPE for it first. contrata\_unavailable means this deployment sends nothing. In both cases the person may upload the contrata file (file, scope contract) in Contrat@ themselves.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The contract's id, from contracts.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] contract\_update
>
> Replace a registered contract whole: read it with contracts and send every key with your change (without document, its written terms stay as they are). The drafts of the months it reaches are calculated again. Only what the person confirmed.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "contract": {
>       "description": "A contract as the SEPE and the Seguridad Social know it. Keys: event (initial, extension or conversion) with previous_id (the contract extended or converted); start_date and end_date (a fixed-term contract's agreed end, YYYY-MM-DD); code, the SEPE clave of 3 digits (100 indefinite full time, 200 part time, 300 fijo discontinuo, 402 or 502 circumstances of production, 410 or 510 replacement, 420 or 520 professional practice, 441 or 541 relief, 189 or 289 conversions…); account (the id of a settings account, the CCC and work centre); occupation (CNO-11, 4 digits); position; duties (what the INSS reads, at most 260 characters); group (1 to 11, the grupo de cotización); weekly_hours and full_time_hours; annual_hours (fijo discontinuo, or the hours a year a part-time contract agrees, art. 12.4.a ET, with weekly_hours their weekly average under the agreement's annual working time, which contract_document checks); temporality_cause (a fixed-term contract's cause, linked to its duration); foreseeable; replacement_cause and replaced {naf, given_name, first_surname, second_surname}; relief_worker_type; bonus_group; qualification; professional_certificate; ere; prtr; basic_copy_signature (only when the company has workers' representatives and the contract is initial or a conversion: signed or refused, what the representatives did with its copia básica, which goes to the SEPE with the contract; the file is not written until it is set); sepe_key (E and 13 digits, once the SEPE answered); document, the written contract's terms that contract_pdf prints, as contract_document asks for them: classification {group, level, area, technician, graduate, category, territory} (the employee's place in the collective agreement, as its text writes it: the grupo profesional and, when the agreement uses them, the salary level, the VI ALEH's área funcional, whether the employee is técnico o titulado (true or false), whether the employee has a university degree or a title officially recognised as equivalent (graduate, true or false), the establishment's category and the territory whose salary table applies; it sets the trial period, the salary table and the notice), functions (the job's tasks, one each), schedule and schedule_rows [{days, hours}], signing_place and signing_date, trial {months, days} (absent: the longest the agreement allows; zero: none), remote_work, remote_agreement when remote_work is true (Ley 10/2021 art. 7, asked for and never assumed: place, percent from 1 to 100, distribution, inventory [{item, useful_life}], expenses {items, compensation, when, form}, availability, reversibility_notice, control, technical_difficulties, data_protection, information_security, duration; percent at most 50 for a practice contract or a worker under 18, art. 3), non_compete {months, compensation}, permanence {months, training, amount}, full_dedication {compensation}, variable_pay, algorithmic_systems with algorithmic_description, degree, policies_location, duration_link (402/502: how the circumstances connect with the duration, as the SEPE's model asks), replaced_nif (410/510: the NIF or NIE of the employee replaced), studies_completed (420/520: the day the degree's studies ended) and training_plan {content, tutoring, tutor_name, tutor_position} (420/520: the individual training plan), complementary_hours {hours, notice_days, voluntary} (part time: hours a year the company may ask for, days of notice, and voluntary hours a year a permanent contract may be offered; its SEPE annex), public_employee {condition, requested, granted} when the employee also holds a public post (Ley 53/1984 art. 14: the private activity needs the prior recognition of compatibility; condition is what the parties choose and is never assumed: suspensive, the contract takes effect once it is granted, or resolutory, it ends if it is refused, art. 49.1.b ET; requested and granted are the days of the request and the resolution, YYYY-MM-DD), irregular_distribution {notice_days} (the working time distributed irregularly over the year by a calendar the company gives with notice_days of notice of each day and hour, 5 to 60, art. 34.2 ET; only when the parties agree it). A change sent without document keeps the terms the contract has.",
>       "type": "object"
>     },
>     "id": {
>       "description": "The contract's id, from contracts.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "contract"
>   ],
>   "type": "object"
> }
> ```

> [accordion] document\_record
>
> Record what the person says happened, replacing a contract's earlier record of the kind: information\_notice (requested\_on; delivered\_on with channel; file\_id, the copy received, needs delivered\_on; the law asks for proof, not a signature) or signed\_contract (file\_id, to contract\_id or the employee). Keep the file first with documents save. Answers documents
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "channel": {
>       "description": "information_notice: how it was delivered, paper or electronic.",
>       "type": "string"
>     },
>     "contract_id": {
>       "description": "The contract's id, from documents or contracts.",
>       "type": "string"
>     },
>     "delivered_on": {
>       "description": "information_notice: the day it was delivered, YYYY-MM-DD.",
>       "type": "string"
>     },
>     "file_id": {
>       "description": "The file's id in Documentos.",
>       "type": "string"
>     },
>     "id": {
>       "description": "The employee's id, from employees.",
>       "type": "string"
>     },
>     "kind": {
>       "enum": [
>         "information_notice",
>         "signed_contract"
>       ],
>       "type": "string"
>     },
>     "requested_on": {
>       "description": "information_notice: the day the employee asked for it, YYYY-MM-DD.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "kind"
>   ],
>   "type": "object"
> }
> ```

> [accordion] employee\_create
>
> Add an employee with their contract and modelo 145 (profile). Without a profile the employee is saved and each month's payroll lists them as incomplete. Only what the person confirmed.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "end_date": {
>       "description": "The agreed end of a fixed-term contract, YYYY-MM-DD; empty for none. Never a baja.",
>       "type": "string"
>     },
>     "name": {
>       "description": "The employee's full name, at most 200 characters.",
>       "type": "string"
>     },
>     "profile": {
>       "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
>       "type": "object"
>     },
>     "start_date": {
>       "description": "The day the contract started, YYYY-MM-DD.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "name",
>     "start_date"
>   ],
>   "type": "object"
> }
> ```

> [accordion] employee\_update
>
> Change an employee: only the fields supplied change, and in profile only the keys supplied (tax replaces the whole modelo 145). An employee with contracts registered in the web app keeps their terms and dates: contract, group, the hours, category, start\_date and end\_date follow those contracts, and a start\_date or end\_date none of them gives is refused (payroll\_dates\_from\_contract). end\_date is only the agreed end of a fixed-term contract, never a baja: a resignation, dismissal or end of contract is the termination of that month's payroll (payslip\_update), and active stays true until that month is approved, since an inactive employee is left out of the month. Draft months take the change on recalculate; approved ones keep what they were calculated with. Only what the person confirmed.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "active": {
>       "description": "false leaves the employee out of the months to come, with no finiquito: it is not a baja. A resignation, dismissal or end of contract is the termination of that month's payroll (payslip_update with its date and cause); keep active true until that month is approved.",
>       "type": "boolean"
>     },
>     "end_date": {
>       "description": "The agreed end of a fixed-term contract, YYYY-MM-DD; empty for none. Never a baja.",
>       "type": "string"
>     },
>     "id": {
>       "description": "The employee's id, from employees.",
>       "type": "string"
>     },
>     "name": {
>       "description": "The employee's full name, at most 200 characters.",
>       "type": "string"
>     },
>     "profile": {
>       "description": "The contract and the modelo 145. Keys: nif; naf; category; group (1 to 11, the grupo de cotización); contract (indefinido, fijo_discontinuo, temporal, sustitucion, practicas, relevo); special_relationship; reta (true for a partner who controls the company and works in it, in the RETA as an autónomo societario: no Régimen General contributions, no group, no contract with the SEPE); administrator (true for pay for the office of administrator of such a partner: a fixed 35 %, or 19 % when last year's turnover was under 100.000 €, 190 key E); mutual_insurer (only such a partner's own mutua, its number from settings mutual_insurers; an employee's is the one of their contract's account; employee_update with reta false drops it and administrator); weekly_hours and full_time_hours (e.g. \"40\"; fewer weekly hours is part time); annual_salary (the year's base salary); salary_type (monthly, the default, or daily: daily_salary for each calendar day in alta and extra_days, the days of it each extra payment pays, with no annual_salary); payments (12 to 16) with extra_months, one per payment beyond 12 (e.g. [6, 12]); prorate_extra; complements [{concept, amount, optional compensation_type (salary or expense for the SMI check)}] a month; at_ep_rate (1.50 for office work); leave_complement (percent of the salary a leave is topped up to); tax, the modelo 145 {birth_year, family_situation (1 single parent, 2 spouse earning at most 1.500 €, 3 other), spouse_nif, disability (0, 33 or 65), reduced_mobility, geographic_mobility, ceuta_melilla, descendants [{birth_year, adoption_year, disability, reduced_mobility, whole}], ascendants [{birth_year, disability, reduced_mobility, cohabitants}], spousal_support, child_support, housing_loan, voluntary_rate}; year_to_date {year (required), paid, withheld, contributions}, what was paid earlier in the year, by another payroll of the company or another employer: the next payslip withholds the year's tax less what was already withheld, at most 47 %; irpf_mode, as the employee asks: annual (the default, counts year_to_date; another company's needs the employee's signed request, art. 88.5 RIRPF) or since_start (only what the company pays since the contract started); person, what the official files need {given_name, first_surname, second_surname, sex (F or M), birth_date, nationality (ISO code, ES), municipality (INE code, 5 digits), education (SEPE nivel formativo), iban (where the net is paid)}; seniority {years (the period, e.g. 3 for trienios), amount (a month per period), max, since, in_extras}; garnishments [{concept, debt (the total claimed), monthly (a fixed sum, as child support; otherwise the art. 607 LEC scale), reduction (0, 10 or 15 for family charges)}], withheld each month until the debt is paid. A new employee needs nif, group (but a partner in the RETA), contract, the hours, annual_salary (daily_salary when daily), payments, at_ep_rate and tax; employee_update takes only the keys that change. Amounts, hours and rates are decimal strings.",
>       "type": "object"
>     },
>     "start_date": {
>       "description": "The day the contract started, YYYY-MM-DD.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] fie\_import
>
> Import an FIE file the person downloaded from SILTRA (the INSS's Mensaje de I.N.S.S. Empresa, version 5.0): each sick leave it reports is kept for its employee, matched by NAF or NIF, and a later file brings its confirmations, its discharge or its annulment; a newer file that gives a kept leave another Fecha baja IT (the employee's leave whose days it overlaps) corrects it, the newest file's date prevailing (corrected: each leave's from and to); the same file again changes nothing (duplicate). The draft months the leaves touch are calculated again (recalculated); approved months stay as they were. Answers created, updated, unchanged, the leaves, and unmatched (the NAF or NIF of workers who are no employee: add them and import the file again). In the Melso chat, name the file the person sent with attachment\_id. Another client cannot send it: the answer carries web\_upload\_url, the payroll's Bajas page, where the person imports it with Importar FIE.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "attachment_id": {
>       "description": "In the Melso chat: the attachment_id of the FIE file the person sent, at most 4 MB.",
>       "type": "string"
>     }
>   },
>   "type": "object"
> }
> ```

> [accordion] paid
>
> Record that an approved month's net pay was paid, at its version, when the person says the transfers went out. Melso sends no money.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "expected_version": {
>       "description": "version of the month's payroll from run.",
>       "minimum": 1,
>       "type": "integer"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "expected_version"
>   ],
>   "type": "object"
> }
> ```

> [accordion] payslip\_update
>
> Record what changed in a draft month for one employee and calculate the month again: incidents replaces the payslip's incidents whole, so read them with payslip and send the full set. An employee's baja (resignation, dismissal, end of contract) is recorded here, as the termination of the month it happens in (its date and cause): the payslip becomes the finiquito, employees lists it as leaving\_on, and approving the month sets settled\_on and leaves the employee out of later months. Only what the person confirmed.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "expected_version": {
>       "description": "version of the month's payroll from run.",
>       "minimum": 1,
>       "type": "integer"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     },
>     "incidents": {
>       "description": "What changed in the month, {} for nothing: overtime, overtime_force_majeure, bonus (incentives accrued in the month) and advance (already paid, deducted) as EUR decimal strings; periodic_bonuses [{concept, amount, from, to, source (convenio when the collective agreement sets it, else other)}], pay accrued over a longer period (YYYY-MM-DD, at most two years), taxed now and contributed by each month's share; unpaid_days; per_diems [{kind (overnight_spain, overnight_abroad, day_spain, day_abroad, flight_spain, flight_abroad), days (of the trips), amount (paid for meals), lodging (the hotel, with invoices; overnight only), long_stay (true past nine months in a row in the same place: nothing exempt)}], exempt up to art. 9 RIRPF's daily limit, the rest taxed and contributed; travel {km (driven in the employee's vehicle), mileage (paid for them, exempt up to 0.26 €/km), tolls (and parking, with receipts), public_transport (with tickets)}; in_kind [{kind (housing, rented_housing, car, car_delivery, loan, health_insurance, meal_vouchers, canteen, transport, nursery, training, other), concept, amount (its cost this month: rent, premium, vouchers, card, canteen cost, nursery, training, the car given; for other its market value), cadastral_value and cadastral_revised (revised in the last ten years) or property_value (without one) for housing and rented_housing, vehicle_value (cost with taxes, or market value new when vehicle_leased), private_use (percentage), efficiency (euro6, hybrid, electric, plug_in) and value_before_tax for a car, principal and interest_rate for a loan, persons and disabled for health_insurance, days (working days without exempt per diem) for meal_vouchers, cost (to the company, what it contributes) for other}], valued by art. 43 LIRPF with art. 42.3's exemptions, ask what each kind needs, never guess it; leaves [{kind (common or professional), start, end (the discharge; omit while it lasts), daily_base (omit: the law's, from earlier payslips), accident (true if from an accident), special (a common leave's art. 169.1.a situation: menstruation, pregnancy_interruption, pregnancy_week_39, donation, menopause, gender_violence), process_days (a relapse's days already in its process)}]; adjustments [{concept, amount (negative deducts), salary, contributes, taxable}]; arrears [{year, month (an earlier month it belongs to), amount, concept}], taxed now and contributed in that month's complementary liquidation (L03), the employee's share deducted now; termination {date, cause (resignation, trial_period, disciplinary, end_of_term, objective, objective_worker, collective, unfair), vacation_days (not taken), notice_days (not given: positive by the company, negative by the employee), agreed_severance (above the legal one)}, which makes the payslip the finiquito with its legal severance.",
>       "type": "object"
>     },
>     "payslip_id": {
>       "description": "The payslip's id, from run.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "payslip_id",
>     "expected_version",
>     "incidents"
>   ],
>   "type": "object"
> }
> ```

> [accordion] recalculate
>
> Calculate a draft month again with the employees' contracts as they are now, keeping each payslip's incidents.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "expected_version": {
>       "description": "version of the month's payroll from run.",
>       "minimum": 1,
>       "type": "integer"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "expected_version"
>   ],
>   "type": "object"
> }
> ```

> [accordion] red\_response\_import
>
> Import a file the person downloaded from SILTRA into its month, an approved one: a Fichero de Respuesta (to any file sent) or the month's Fichero de Cálculos, told by its content, never by its name. Answers the file read (duplicate: the same file was imported before, and its first import stands) and the month as red\_responses reads it. In the Melso chat, name the file the person sent with attachment\_id. Another client cannot send it: the answer carries web\_upload\_url, the month's page, where the person imports it with Importar respuesta de SILTRA. Melso sends nothing to SILTRA.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "attachment_id": {
>       "description": "In the Melso chat: the attachment_id of the SILTRA file the person sent, at most 16 MB.",
>       "type": "string"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] reopen
>
> Take an approved or paid month back to draft at its version, when the person asks for it, to change it: its payment record goes too. Refused for a draft (payroll\_not\_approved), while a later month of the year is approved or its journal entry is posted, or when a 111 or 190 already approved or filed covers its pay date (fiscal\_period\_locked).
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "expected_version": {
>       "description": "version of the month's payroll from run.",
>       "minimum": 1,
>       "type": "integer"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "expected_version"
>   ],
>   "type": "object"
> }
> ```

> [accordion] run\_create
>
> Open a month's payroll as a draft: a payslip for each employee employed in it, with the leaves still open the month before carried over. A month missing before later ones is added too: the year's later drafts are calculated again and the next one regularizes the withholding. Refused while an earlier month of the year is a draft (previous\_run\_not\_approved), or when a 111 or 190 already approved or filed covers its pay date (fiscal\_period\_locked).
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "pay_date": {
>       "description": "The day the payroll is paid, YYYY-MM-DD, in the month or the next; the month's last day by default.",
>       "type": "string"
>     },
>     "period": {
>       "description": "The month, YYYY-MM.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "period"
>   ],
>   "type": "object"
> }
> ```

> [accordion] run\_delete
>
> Delete a draft month and its payslips. Only when the person asks for it.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] settings\_update
>
> Change the company's labour data at its version: only the keys supplied change (accounts replaces the whole list, so send every account). Only what the person confirmed.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "expected_version": {
>       "description": "version from settings, 0 before the first save.",
>       "minimum": 0,
>       "type": "integer"
>     },
>     "settings": {
>       "description": "Only the keys that change. Keys: red_holder (company or gestoria, sent with the number); red_authorization (8 digits); red_ccc_assigned (its CCCs assigned to it); cnae (4 digits); accounts [{id, regime (0111), province (2 digits), number (9 digits), name, address, postal_code, municipality (INE, 5 digits), agreement (the collective agreement's REGCON code, 14 digits), at_ep_insurer (who covers its accidents at work: the mutua's number from mutual_insurers, as 151, or inss), common_contingencies_insurer (who pays its sick leave of common contingencies: inss or the same mutua)}], the whole list; payer_iban and payer_bic (the account salaries leave from); worker_representatives (the staff has legal representatives, who sign each contract's copia básica before it goes to the SEPE with the contract); representative {nif, given_name, first_surname, second_surname, position}, who signs the company's contracts and certificates; pay_day, the day the collective agreement, the contracts or custom set for paying each month, which decides the tax year of a month paid late: month_end (by the month's last day), month_day_1 to month_day_30 (that day of the month itself, the last in a shorter month, taxed as month_end; a month's payroll is created with it as its pay_date), or empty when not known; a day of the next month (day_1 to day_10) is refused with payroll_pay_day_next_month, since Melso does not calculate it yet.",
>       "type": "object"
>     }
>   },
>   "required": [
>     "expected_version",
>     "settings"
>   ],
>   "type": "object"
> }
> ```

> [accordion] siltra\_file\_generate
>
> Generate a new attempt of an approved month's file for SILTRA, when the person asks. kind is the cycle's next\_kind by default: the Fichero de Bases first, the file red\_responses' proposal names to mend the month, and once SILTRA says the L00 is confirmed (R9566), its rectification within the term: its bases are refused (siltra\_liquidation\_confirmed). Written in the background from the approved payslips and employees' data as they are now, so correct what the TGSS refused first (employee\_update, or reopen, fix and approve the month). Answers the attempt queued. Refused for a draft (payroll\_not\_approved) or while another is queued (siltra\_file\_pending). Melso sends nothing to SILTRA: the person sends the file and, once it cuadra, confirms the liquidation there.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     },
>     "kind": {
>       "description": "bases, vacation-bases, arrears-bases, rectification-bases, l90-bases or l91-bases; next_kind by default.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] strike\_delete
>
> Delete a strike recorded by mistake; the draft months it touched are calculated again and approved\_months keep it until reopened. What was sent to SILTRA stays there: an inactivity already communicated is removed in SILTRA. Only when the person asks for it.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "id": {
>       "description": "The strike's id, from strikes.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id"
>   ],
>   "type": "object"
> }
> ```

> [accordion] strike\_record
>
> Record that an employee went on strike, with employee\_id and the strike, or correct a recorded one with its id (the strike whole: its end once it is over). The person says the days and whether they stopped the whole day or part of it; for a partial one ask the part of the day worked. Never record a strike as unpaid days: this is what the payroll and the AFI read. The draft months it touches are calculated again; approved\_months are the approved ones it touches, which keep what they were approved with until the person reopens them; unpaid\_days\_months are draft months whose payslip also has unpaid days: if one was this strike, as the chat recorded strikes before, remove it with payslip\_update, or the day is taken off twice. Refused when it overlaps another of the employee's strikes (strike\_overlaps), starts or ends outside the employment (strike\_outside\_employment) or is a partner in the RETA's (payroll\_strike\_reta). Then give the person the strike's AFI file (file or file\_attach with scope strike) to send through SILTRA, by the term the guides' strike rule gives (fiscal\_reference); Melso sends nothing. Only what the person confirmed.
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "employee_id": {
>       "description": "A new strike's employee, from employees.",
>       "type": "string"
>     },
>     "id": {
>       "description": "The strike's id, from strikes, to correct it; omit to record a new one.",
>       "type": "string"
>     },
>     "strike": {
>       "description": "The strike whole. Keys: kind (total or partial); start, its first day, YYYY-MM-DD; end, its last day, omitted while it lasts; worked, only for a partial one: the part of the usual day the employee worked on each strike day, in thousandths from 1 to 999 (500 is half the day).",
>       "type": "object"
>     }
>   },
>   "required": [
>     "strike"
>   ],
>   "type": "object"
> }
> ```

> [accordion] unpaid
>
> Undo a month's payment record at its version, when the person says it was not paid: the month is approved again. Refused unless the month is paid (payroll\_not\_paid).
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "expected_version": {
>       "description": "version of the month's payroll from run.",
>       "minimum": 1,
>       "type": "integer"
>     },
>     "id": {
>       "description": "The month's payroll id, from runs.",
>       "type": "string"
>     }
>   },
>   "required": [
>     "id",
>     "expected_version"
>   ],
>   "type": "object"
> }
> ```

## Output

Each action returns the saved employee, contract, settings or month. `run_create` returns a draft month; `payslip_update` and `recalculate` the month calculated again. `approve`, `reopen`, `paid` and `unpaid` return the month at its new status and version, or a refusal code such as `previous_run_not_approved` or `fiscal_period_locked`. `contract_submit` returns the Contrat@ shipment number or the SEPE's error. `siltra_file_generate` returns the attempt queued. `red_response_import` and `fie_import` return a `web_upload_url` where the person imports the file in the web app. Melso sends nothing to SILTRA or a bank.

The result uses MCP `content` blocks; JSON payloads are encoded in text and may also appear in `structuredContent`. Check `isError` before reading a success payload. When the server declares an `outputSchema`, it is reproduced below. Check the action result and its declared fields before reporting success.

## Example

Use the actions of this tool in the order shown; its companion tool covers the other actions. These are the `arguments` of each call, in order.

**1. Open October as a draft**

```json theme={null}
{
  "action": "run_create",
  "period": "2026-10"
}
```

The first call as a request. Use an OAuth access token issued for this MCP resource and replace the example identifiers with values from your own company. Write actions change data.

```bash theme={null}
curl --fail-with-body https://mcp.melso.ai/mcp \
  -H "Authorization: Bearer $MELSO_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  --data-binary @- <<'JSON'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "payroll",
    "arguments": {
      "action": "run_create",
      "period": "2026-10"
    }
  }
}
JSON
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.