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

# Redeem an invitation

> Accepts an invitation as the distributor account of the signed-in session and provisions the distribution. The invitation is spent before anything is provisioned, so a failure part way leaves it used and the publisher reopens it with resend. An account cannot redeem its own invitation. Root and admin roles only.



## OpenAPI

````yaml /api-reference/endpoint/distribution/openapi.json post /accounts/redeem-distribution-invite
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/redeem-distribution-invite:
    post:
      tags:
        - Distribution Invitations
      summary: Redeem an invitation
      description: >-
        Accepts an invitation as the distributor account of the signed-in
        session and provisions the distribution. The invitation is spent before
        anything is provisioned, so a failure part way leaves it used and the
        publisher reopens it with resend. An account cannot redeem its own
        invitation. Root and admin roles only.
      operationId: redeemDistributionInvite
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RedeemDistributionInviteRequest'
      responses:
        '200':
          description: Invitation redeemed
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/RedeemDistributionInviteResponse'
        '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
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    RedeemDistributionInviteRequest:
      type: object
      properties:
        token:
          type: string
          description: Invitation token
        return_flow_subject:
          type: string
        space:
          type: object
          properties:
            mode:
              type: string
              enum:
                - provision
                - link
            space_id:
              type: string
            status_map:
              type: object
              additionalProperties:
                type: string
      required:
        - token
    RedeemDistributionInviteResponse:
      type: object
      properties:
        distribution:
          $ref: '#/components/schemas/Distribution'
        ingress_url:
          type: string
        distributor_space_id:
          type: string
        binding:
          type: object
          additionalProperties: true
        steps:
          type: array
          items:
            $ref: '#/components/schemas/ProvisioningStep'
        outstanding:
          type: array
          items:
            type: string
        distributor_setup:
          type: array
          items:
            $ref: '#/components/schemas/ProvisioningStep'
    Error:
      type: object
      properties:
        error:
          type: string
    Distribution:
      type: object
      description: 'One register entry: a grant from a publisher to a distributor.'
      properties:
        publisher_account_id:
          type: string
        distributor_account_id:
          type: string
        distributor_name:
          type: string
        publisher_name:
          type: string
        distribution_id:
          type: string
        products:
          type: array
          items:
            type: object
            additionalProperties: true
        status:
          type: string
          enum:
            - pending
            - active
            - suspended
            - revoked
          description: Lifecycle state of the grant
        status_reason:
          type: string
        scope:
          type: array
          items:
            type: string
        provisioning_state:
          type: string
        space_id:
          type: string
        publisher_space_id:
          type: string
        distributor_space_id:
          type: string
        record_config_ids:
          type: array
          items:
            type: string
        invite_id:
          type: string
        granted_by:
          type: string
        requested_by:
          type: string
        effective_from:
          type: string
        effective_to:
          type: string
        created_at:
          type: string
        updated_at:
          type: string
      additionalProperties: true
    ProvisioningStep:
      type: object
      properties:
        name:
          type: string
        done:
          type: boolean
        detail:
          type: string
      required:
        - name
        - done
  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.