> ## 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, invoicing only, with a company API key.
>
> 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.

# Constituir una SL o dar de alta un autónomo por API — Create a company

> Opens a company in Melso for your customer: an autónomo to register, an S.L. to incorporate, or one that already exists.

> [!NOTE]
>
> **Early access.** Partner keys are issued on request: write to [hello@melso.ai](mailto:hello@melso.ai). See [Partner API](https://docs.melso.ai/api/partner/overview.md).

Melso's professionals do the registration or the incorporation, and the company becomes `ready` when it is done.

The owner gets an email to sign in to Melso and approve what needs a person. Send an `Idempotency-Key` to retry safely.


## OpenAPI

````yaml api/partner-openapi.yaml POST /partner/companies
openapi: 3.1.0
info:
  title: Melso Partner API
  version: 0.1.0-early-access
  summary: Open companies in Melso for your customers.
  description: |
    Early access. A partner key works across the companies you open for your
    customers. Melso issues partner keys on request: write to
    hello@melso.ai. Melso's professionals carry out each incorporation and
    registration.
  contact:
    name: Melso
    email: hello@melso.ai
    url: https://docs.melso.ai/api/partner/overview
servers:
  - url: https://api.melso.ai/v1
security:
  - partnerApiKey: []
tags:
  - name: Partner companies
    description: Companies you open in Melso for your customers.
paths:
  /partner/companies:
    post:
      tags:
        - Partner companies
      summary: Create a company
      description: >
        Opens a company in Melso for your customer: an autónomo to register, an
        S.L. to incorporate, or one that already exists. Melso's professionals
        do the registration or the incorporation, and the company becomes
        `ready` when it is done.


        The owner gets an email to sign in to Melso and approve what needs a
        person. Send an `Idempotency-Key` to retry safely.
      operationId: createPartnerCompany
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartnerCompanyInput'
            examples:
              incorporate_sl:
                summary: Incorporate an S.L.
                value:
                  setup: incorporate_sl
                  external_id: cus_48213
                  owner:
                    name: Lucía Martín Pérez
                    email: lucia@example.com
                    tax_id: 00000000T
                  details:
                    names:
                      - Talleres Ebro
                      - Ebro Motor
                      - Talleres Martín
                    activity: Reparación de vehículos
                    capital: '3000.00'
              register_autonomo:
                summary: Register an autónomo
                value:
                  setup: register_autonomo
                  external_id: cus_48214
                  owner:
                    name: Pablo Ruiz Gómez
                    email: pablo@example.com
                    tax_id: 00000001R
                  details:
                    activity: Diseño gráfico
                    start_date: '2026-12-01'
      responses:
        '202':
          description: The company, `requested`. Follow it with Get a company.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerCompany'
              example:
                id: 7b1e2c3d-4f5a-4b6c-8d7e-9f0a1b2c3d4e
                status: requested
                setup: incorporate_sl
                express: false
                external_id: cus_48213
                legal_name: null
                tax_id: null
                created_at: '2026-11-21T10:02:11Z'
                ready_at: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/IdempotencyKeyReused'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: >-
        A unique key of yours, such as a UUID. A retry with the same key and
        body gets the first answer again.
      schema:
        type: string
        maxLength: 255
  schemas:
    PartnerCompanyInput:
      type: object
      required:
        - setup
        - owner
      additionalProperties: false
      properties:
        setup:
          type: string
          enum:
            - incorporate_sl
            - register_autonomo
            - existing
          description: >
            `incorporate_sl` incorporates a new S.L.; `register_autonomo`
            registers an autónomo with the AEAT and the Seguridad Social;
            `existing` brings a company or autónomo that already exists.
        external_id:
          type: string
          maxLength: 200
          description: Your own ID for this customer.
        owner:
          $ref: '#/components/schemas/Owner'
        details:
          type: object
          description: >
            What Melso's professionals need. For an S.L.: `names` (up to five,
            in order of preference), `activity` and `capital`. For an autónomo:
            `activity` and `start_date`. For an existing company: its `tax_id`.
    PartnerCompany:
      type: object
      required:
        - id
        - status
        - setup
        - express
        - external_id
        - legal_name
        - tax_id
        - created_at
        - ready_at
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - requested
            - in_progress
            - ready
            - cancelled
          description: >-
            `requested` when you create it, `in_progress` while Melso works on
            it, `ready` once it can invoice.
        setup:
          type: string
          enum:
            - incorporate_sl
            - register_autonomo
            - existing
        express:
          type: boolean
          description: '`true` for a company from Melso''s pool.'
        external_id:
          type:
            - string
            - 'null'
        legal_name:
          type:
            - string
            - 'null'
          description: Set once the company is `ready`.
        tax_id:
          type:
            - string
            - 'null'
          description: The company's NIF, set once it is `ready`.
        created_at:
          type: string
          format: date-time
        ready_at:
          type:
            - string
            - 'null'
          format: date-time
    Owner:
      type: object
      required:
        - name
        - email
      additionalProperties: false
      properties:
        name:
          type: string
          description: The owner's full name.
        email:
          type: string
          format: email
          description: Where Melso invites the owner to sign in.
        tax_id:
          type: string
          description: The owner's DNI or NIE.
        phone:
          type: string
    Error:
      type: object
      required:
        - error
        - code
        - request_id
      properties:
        error:
          type: string
          description: What went wrong
          for a person to read.: null
        code:
          type: string
          description: A stable code to branch on.
        request_id:
          type: string
  responses:
    BadRequest:
      description: The request is malformed or a field is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: The partner key is missing, revoked or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    IdempotencyKeyReused:
      description: This `Idempotency-Key` was sent with another request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Too many requests. Wait `Retry-After` seconds.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    partnerApiKey:
      type: http
      scheme: bearer
      description: |
        A partner key, `mk_partner_…`, that Melso issues on request. Keep it on
        your servers.

````

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