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

# Create a webhook endpoint

> Adds an endpoint that receives the events of every company of your firm.

> [!NOTE]
>
> **Early access.** Your firm's owner or an admin creates partner keys in **Settings** › **Developers**. See [Partner API](https://docs.melso.ai/api/partner/overview.md).

> [!WARNING]
>
> **Beta.** Melso does not serve this operation yet, and its fields can still change. See [what is live](https://docs.melso.ai/api/overview.md#what-is-live).

Permission: `webhooks:write`. `secret` appears only in this answer: store it to verify the `Melso-Signature` header. See [Webhooks](https://docs.melso.ai/api/partner/webhooks.md).


## OpenAPI

````yaml api/partner-openapi.yaml POST /partner/webhook-endpoints
openapi: 3.1.0
info:
  title: Melso Partner API
  version: 0.3.0-early-access
  summary: Open Melso companies for your customers and follow every change.
  description: |
    Early access. Your platform is a firm in Melso, and each customer business
    you serve is a company of that firm. The Partner API has only what is
    partner-specific: open the Melso account of a business that has its NIF,
    ask Melso's team to incorporate an S.L. or register a self-employed
    person, and receive webhooks for every change. Everything else, from the
    fiscal profile to books, taxes and payroll, is the Melso API, called with
    your partner key and the company's `id`. The firm's owner or an admin
    creates partner keys in Settings › Developers.
  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: Companies
    description: The Melso account of a business that already has its NIF.
  - name: Incorporations
    description: >-
      Melso's team incorporates a new S.L. or registers a new self-employed
      person.
  - name: Webhooks
    description: >-
      Endpoints of yours that receive an event when something changes in a
      company of your firm.
  - name: Events
    description: >-
      Everything that changed in your firm's companies in the last 30 days, to
      replay and reconcile.
paths:
  /partner/webhook-endpoints:
    post:
      tags:
        - Webhooks
      summary: Create a webhook endpoint
      description: >
        Adds an endpoint that receives the events of every company of your firm.


        Permission: `webhooks:write`. `secret` appears only in this answer:
        store it to verify the `Melso-Signature` header. See
        [Webhooks](/api/partner/webhooks).
      operationId: createPartnerWebhookEndpoint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookEndpointInput'
            example:
              url: https://example.com/melso/webhooks
              events:
                - incorporation.*
                - company.ready
                - tax_return.*
              description: Production
      responses:
        '201':
          description: The endpoint, with its secret.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEndpointCreated'
              example:
                id: we_3f9a1c2b
                url: https://example.com/melso/webhooks
                events:
                  - incorporation.*
                  - company.ready
                  - tax_return.*
                description: Production
                status: enabled
                secret: whsec_7d2f0c4e9b1a
                created_at: '2026-12-01T09:30:00Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    WebhookEndpointInput:
      type: object
      required:
        - url
        - events
      properties:
        url:
          type: string
          format: uri
          description: An HTTPS URL of yours.
        events:
          type: array
          items:
            type: string
          description: >-
            Event types to receive, or families such as `tax_return.*`. See
            [Webhooks](/api/partner/webhooks).
        description:
          type: string
          maxLength: 200
    WebhookEndpointCreated:
      allOf:
        - $ref: '#/components/schemas/WebhookEndpoint'
        - type: object
          required:
            - secret
          properties:
            secret:
              type: string
              description: The signing secret, `whsec_…`. Shown only in this answer.
    WebhookEndpoint:
      type: object
      required:
        - id
        - url
        - events
        - status
        - created_at
      properties:
        id:
          type: string
        url:
          type: string
          format: uri
        events:
          type: array
          items:
            type: string
        description:
          type: string
        status:
          type: string
          enum:
            - enabled
            - disabled
          description: >-
            `disabled` when you turned it off, or when Melso did after 3 days of
            failed deliveries.
        created_at:
          type: string
          format: date-time
    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.
        field:
          type: string
          description: The field at fault
          when there is one.: null
        permission:
          type: string
          description: With `missing_permission`, the permission the key needs.
        request_id:
          type: string
  responses:
    BadRequest:
      description: The request is malformed or a field is invalid; `field` names it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: The key is missing, revoked or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key lacks the permission named in `permission`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Over 600 requests a minute for this key. Wait `Retry-After` seconds.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    partnerApiKey:
      type: http
      scheme: bearer
      description: >
        A partner key of your firm, `mk_live_…`, which reaches every company of

        the firm. Each key carries the permissions chosen when it was created.

        Keep it on your servers. See
        [Authentication](/api/partner/authentication).

````

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