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

# Send a distribution message

> The one door every distribution message goes through. The sender is the token's account and the register decides whether it may send this kind under this grant. Which side may send which kind is enforced server-side (for example record, status, workitem-upsert, comment-upsert and comment-delete). `request_id` is the idempotency key: a repeat answers 200 with `status: duplicate`. Roles: root, admin and developer, plus collaborator for distributor-side kinds.



## OpenAPI

````yaml /api-reference/endpoint/distribution/openapi.json post /accounts/distribution-message
openapi: 3.1.0
info:
  title: quiva.ai Distribution API
  description: >-
    API for distributing products from a publisher account to distributor
    accounts: invitations, the distribution register, product definitions,
    messages between the two sides and config id reservations.
  version: 1.0.0
  contact:
    name: quiva.ai Support
    url: https://app.quiva.ai
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Distribution Invitations
    description: >-
      Mint, deliver, preview and redeem invitations that connect a distributor
      to a publisher
  - name: Distribution Register
    description: The register of distributions between a publisher and its distributors
  - name: Distributor Setup
    description: Distributor features, space template and space bindings
  - name: Distribution Products
    description: Product definitions and the products a distributor may work under
  - name: Distribution Messages
    description: Messages sent between the two sides of a distribution
  - name: Config Reservations
    description: Reservations of record config ids
paths:
  /accounts/distribution-message:
    post:
      tags:
        - Distribution Messages
      summary: Send a distribution message
      description: >-
        The one door every distribution message goes through. The sender is the
        token's account and the register decides whether it may send this kind
        under this grant. Which side may send which kind is enforced server-side
        (for example record, status, workitem-upsert, comment-upsert and
        comment-delete). `request_id` is the idempotency key: a repeat answers
        200 with `status: duplicate`. Roles: root, admin and developer, plus
        collaborator for distributor-side kinds.
      operationId: createDistributionMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DistributionMessageRequest'
      responses:
        '200':
          description: Accepted
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    properties:
                      message_id:
                        type: string
                      status:
                        type: string
                        description: '`accepted` or `duplicate`'
                      sequence:
                        type: integer
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden, or the grant refuses the call (`refusal_code` says why).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DistributionRefusalResponse'
components:
  schemas:
    DistributionMessageRequest:
      type: object
      properties:
        distribution_id:
          type: string
        kind:
          type: string
          description: >-
            Message kind. Which side may send which kind is enforced
            server-side.
        thread_id:
          type: string
          description: >-
            The conversation key the answer comes back on. `quote_id` is
            accepted as an alias.
        quote_id:
          type: string
        version:
          type: integer
        request_id:
          type: string
          description: Idempotency key
        product_id:
          type: string
          description: Required on distributor-side kinds
        config_id:
          type: string
          description: >-
            Where a record message lands. Only a config the grant installed
            there is accepted.
        target_record_id:
          type: string
        saved_at:
          type: string
        payload:
          type: object
          additionalProperties: true
      required:
        - distribution_id
        - kind
        - request_id
    Error:
      type: object
      properties:
        error:
          type: string
    DistributionRefusalResponse:
      type: object
      description: >-
        A refusal by the distribution register. `refusal_code` names the reason
        so a caller can branch on it.
      properties:
        data:
          type: object
          properties:
            status:
              type: string
              description: Always `refused`
            refusal_code:
              type: string
            detail:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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