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

# Aprobación de una gestión en tu producto — Attest a case approval from your interface

> Aprobación de una gestión en tu producto. Planned preview contract, not callable yet.

> [!NOTE]
>
> **Planned.** A preview contract for design partners. It is not callable yet, and fields can still change. See [Access and pricing](https://docs.melso.ai/api/access.md) and [Availability](https://docs.melso.ai/api/availability.md).

**Access:** REST, not callable yet · manual-assisted.

> [!NOTE]
>
> **Manual-assisted when it ships.** This planned workflow would support work by professionals under the company's mandate. The operation is not callable yet.

You attest that the person who must approve it read exactly
`expected_version` in your interface and approved it, and you send the
evidence. Melso records the attestation with the evidence and treats it
as that person's approval, the same as on Melso's approval page; you
receive `case.approved`. A case whose version changed is refused.

For an incorporation this approves the deed draft. It never stands in
for signing the deed before the notary. Requires a signed partner
agreement that defines who may approve and how evidence is kept.


## OpenAPI

````yaml api/openapi.yaml POST /companies/{company_id}/cases/{case_id}/attested-approvals
openapi: 3.1.0
info:
  title: Melso API
  version: 1.0.0-preview
  summary: Spanish tax and labour compliance for the companies on your platform.
  description: |
    The Melso API lets an HR, payroll, banking or ERP platform run the
    Spanish tax and labour obligations of the companies it serves: invoices,
    books, tax returns, Social Security and employment notifications.

    Melso calculates and prepares. A person at the company approves the exact
    version. Melso's professionals file under the company's representation, and
    the filing is proven only by the administration's reference and receipt.

    Every operation states its availability in `x-melso-status`:

    - `live`: Melso runs this capability in production today. Partner keys
      reach it once a partner account is enabled.
    - `preview`: a contract proposed to design partners. Not callable yet.

    `x-melso-actor: person` marks a decision a signed-in person makes in
    Melso; a partner sends them the approval link instead.
  contact:
    name: Melso partnerships
    email: hello@melso.ai
    url: https://docs.melso.ai/api/overview
servers:
  - url: https://api.melso.ai/v1
    description: API. Keys and access are issued per partner.
security:
  - partnerKey: []
tags:
  - name: Companies
    description: The companies you operate for, their fiscal profile and hosted onboarding.
  - name: Mandates
    description: >-
      The company's representation of Melso before the AEAT, the TGSS and the
      SEPE.
  - name: Webhook endpoints
    description: Where Melso sends signed events about your companies.
  - name: Invoicing setup
    description: Registration of the company as a VERI*FACTU or TicketBAI invoice issuer.
  - name: Customers
    description: The company's invoice customers.
  - name: Invoices
    description: >-
      Drafts, approval, legal registration, delivery and payment of the
      company's invoices.
  - name: Expenses
    description: >-
      Purchase invoices and receipts, with their AEAT category and
      deductibility.
  - name: Income
    description: Income invoiced outside Melso.
  - name: Documents
    description: >-
      Files the company gives Melso, and Melso's structured reading of an
      invoice or receipt.
  - name: Banking
    description: >-
      Bank accounts, movements, statements and reconciliation with invoices and
      expenses.
  - name: Accounting
    description: Journal, imported books and the company's financial statements.
  - name: Tax calendar
    description: The forms the company must file, with their periods and deadlines.
  - name: Tax returns
    description: The returns Melso calculates, their approval and their filing.
  - name: Corporate tax
    description: The year's corporate tax (modelo 200) and its instalments (modelo 202).
  - name: Tax estimates
    description: What the company should set aside for taxes, as of today.
  - name: Cases
    description: Gestiones, the procedures Melso's professionals carry out for the company.
  - name: Administration notifications
    description: Electronic notifications from the administration to the company.
  - name: Certificates
    description: >-
      Official certificates such as being up to date with the AEAT or the Social
      Security.
  - name: Employees
    description: The people the company employs.
  - name: Payroll runs
    description: >-
      The payroll results your platform calculated, for Melso to settle and
      declare.
  - name: Social Security
    description: >-
      Affiliation (altas, bajas and variaciones) and monthly contribution
      settlements.
  - name: Employment notifications
    description: >-
      Contrat@ contract notifications and Certific@2 company certificates to the
      SEPE.
paths:
  /companies/{company_id}/cases/{case_id}/attested-approvals:
    parameters:
      - $ref: '#/components/parameters/CompanyId'
      - $ref: '#/components/parameters/CaseId'
    post:
      tags:
        - Cases
      summary: Attest a case approval from your interface
      description: |
        For partners that show the professional's draft inside their own
        product. You attest that the person who must approve it read exactly
        `expected_version` in your interface and approved it, and you send the
        evidence. Melso records the attestation with the evidence and treats it
        as that person's approval, the same as on Melso's approval page; you
        receive `case.approved`. A case whose version changed is refused.

        For an incorporation this approves the deed draft. It never stands in
        for signing the deed before the notary. Requires a signed partner
        agreement that defines who may approve and how evidence is kept.
      operationId: attestCaseApproval
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttestedApprovalInput'
            example:
              expected_version: 2
              approver:
                name: Pablo Ruiz Ortega
                email: pablo@example.com
                role: owner
                tax_id: 12345678Z
                external_user_id: usr_3k9d2
              evidence:
                approved_at: '2026-11-20T16:03:12Z'
                ip_address: 203.0.113.24
                user_agent: Mozilla/5.0
                authentication: strong_customer_authentication
                shown_document_sha256: >-
                  4b1e7c9a2d5f8e0b3c6a9d2f5e8b1c4a7d0e3f6b9c2a5d8e1f4b7c0a3d6e9f2b
      responses:
        '200':
          description: The case, approved, with the attestation recorded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Case'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  parameters:
    CompanyId:
      name: company_id
      in: path
      required: true
      description: >-
        The company's ID. Every company-scoped call works in exactly this
        company.
      schema:
        type: string
        format: uuid
    CaseId:
      name: case_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: >-
        A unique key, such as a UUID, that makes a retried create safe. Reusing
        a key with a different body is refused.
      schema:
        type: string
        maxLength: 255
  schemas:
    AttestedApprovalInput:
      type: object
      required:
        - expected_version
        - approver
        - evidence
      additionalProperties: false
      properties:
        expected_version:
          type: integer
          minimum: 1
        approver:
          type: object
          required:
            - name
            - email
            - role
          properties:
            name:
              type: string
            email:
              type: string
              format: email
            role:
              type: string
              enum:
                - owner
                - legal_representative
            tax_id:
              type: string
              description: The person's DNI or NIE.
            external_user_id:
              type: string
              description: The person's ID in your product.
        evidence:
          type: object
          required:
            - approved_at
            - ip_address
            - shown_document_sha256
          properties:
            approved_at:
              type: string
              format: date-time
            ip_address:
              type: string
            user_agent:
              type: string
            authentication:
              type: string
              enum:
                - strong_customer_authentication
                - password
                - other
              description: >-
                How your product authenticated the person for this approval. The
                partner agreement says which methods are accepted.
            shown_document_sha256:
              type: string
              description: >-
                SHA-256 of the document as you rendered it to the person, from
                the return's preview document or the case version's draft.
    Case:
      type: object
      required:
        - id
        - kind
        - status
        - created_at
      properties:
        id:
          type: string
          format: uuid
        kind:
          $ref: '#/components/schemas/CaseKindId'
        status:
          $ref: '#/components/schemas/CaseStatus'
        deadline:
          type:
            - string
            - 'null'
          format: date
        current_version:
          type:
            - integer
            - 'null'
        approved_version:
          type:
            - integer
            - 'null'
        approvals:
          type: array
          description: |
            Preview. Who approved which version, and how.
          items:
            type: object
            required:
              - version
              - approver
              - method
              - approved_at
            properties:
              version:
                type: integer
              approver:
                type: object
                properties:
                  name:
                    type: string
                  role:
                    type: string
                    enum:
                      - owner
                      - legal_representative
                  tax_id:
                    type: string
              method:
                type: string
                enum:
                  - melso
                  - attested
                description: >-
                  `melso`: on Melso's approval page. `attested`: attested by
                  your partner account.
              approved_at:
                type: string
                format: date-time
        payment_url:
          type:
            - string
            - 'null'
          format: uri
          description: Where the owner pays a service kind before Melso starts.
        information_request:
          type:
            - object
            - 'null'
          description: >-
            What the professionals need from the company, with the items to
            answer.
          properties:
            id:
              type: string
              format: uuid
            items:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  kind:
                    type: string
                    enum:
                      - document
                      - question
                  label:
                    type: string
        messages:
          type: array
          items:
            type: object
            properties:
              author:
                type: string
                enum:
                  - company
                  - melso
              content:
                type: string
              created_at:
                type: string
                format: date-time
        documents:
          type: array
          description: >-
            The professionals' drafts, the company's documents and the filing
            receipts.
          items:
            $ref: '#/components/schemas/Document'
        external_reference:
          type:
            - string
            - 'null'
          description: >-
            The administration's reference for what was filed. Always present
            once `done`.
        completed_on:
          type:
            - string
            - 'null'
          format: date
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    CaseKindId:
      type: string
      enum:
        - modelo
        - alta
        - renta
        - constitucion_sl
      description: |
        `modelo`: prepare and file one AEAT form for one period (details
        `model`, `period`); an empresa cannot ask for the 130, 131 or 100.
        `alta`: register an autónomo with the AEAT (036) and the Social
        Security (RETA), details in `CaseDetailsAlta`; it has no draft to
        approve. `renta`: an autónomo's annual income tax return, modelo 100
        (details `year`, `joint`). `constitucion_sl`: incorporate an S.L. or
        S.L.U., details in `CaseDetailsConstitucionSL`, paid once before Melso
        starts; the owner approves the deed draft. It opens only in a company
        in incorporation, which holds nothing else until the S.L. is
        registered. More kinds are added over time; read them from List case
        kinds.
    CaseStatus:
      type: string
      enum:
        - draft
        - review
        - info
        - approval
        - filing
        - done
        - cancelled
      description: |
        `draft`: not sent yet. `review`: Melso's professionals are working on
        it. `info`: they asked the company for something
        (`information_request`). `approval`: a draft waits for the company's
        approval. `filing`: approved, being filed. `done`: filed, with the
        administration's `external_reference`. `cancelled`: withdrawn before
        filing.
    Document:
      type: object
      properties:
        id:
          type: string
          format: uuid
        filename:
          type: string
        content_type:
          type: string
        size_bytes:
          type: integer
        url:
          type: string
          format: uri
          description: A short-lived download URL.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: What went wrong, for a person to read.
        code:
          type: string
          description: >-
            A stable code to branch on, such as `invoicing_not_ready` or
            `version_conflict`.
        request_id:
          type: string
          description: Quote it when you contact Melso.
  responses:
    BadRequest:
      description: >-
        The request is malformed or a field is invalid. Unknown fields are
        refused.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: lines[0].vat_rate must be 21, 10, 4 or 0
            code: invalid_invoice
            request_id: req_01JAB3K9X2
    Unauthorized:
      description: The key is missing, revoked or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invalid token
            code: unauthorized
            request_id: req_01JAB3K9X2
    Forbidden:
      description: The key cannot do this in this company, or the step needs a person.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Review and approve in the authenticated web application
            code: person_required
            request_id: req_01JAB3K9X2
    NotFound:
      description: No such object in this company, or the company is not one of yours.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invoice not found
            code: not_found
            request_id: req_01JAB3K9X2
    Conflict:
      description: >-
        The object changed or is not in a state that allows this. Read it again
        and decide.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: The tax return changed or is not ready for approval
            code: version_conflict
            request_id: req_01JAB3K9X2
  securitySchemes:
    partnerKey:
      type: http
      scheme: bearer
      description: |
        Your partner secret key, `mk_live_…` for real companies or `mk_test_…`
        for test companies. Keep it on your servers. See
        [Authentication](/api/authentication).

````

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