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

# Create Message Channel

> Creates a message channel. Required fields depend on membershipType: company channels need membershipEntityId or companyId; individual channels need membershipEntityId or clientId; group channels need memberIds.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/message-channels
openapi: 3.0.0
info:
  contact: {}
  title: Assembly API
  version: 0.0.1
servers:
  - url: https://api.assembly.com
security: []
paths:
  /v1/message-channels:
    post:
      tags:
        - Message Channels
      summary: Create Message Channel
      description: >-
        Creates a message channel. Required fields depend on membershipType:
        company channels need membershipEntityId or companyId; individual
        channels need membershipEntityId or clientId; group channels need
        memberIds.
      operationId: create-message-channel
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/messagechannel.CreateMessageChannelRequest'
        description: Message channel to create
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/messagechannel.MessageChannel'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Invalid request body or membership parameters
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Missing or invalid API key
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Referenced company or client user not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/dispatcher.Error'
          description: Unexpected server error
      security:
        - APIKeyHeader: []
components:
  schemas:
    messagechannel.CreateMessageChannelRequest:
      properties:
        clientId:
          description: >-
            ClientID is the client id for an individual channel. Alternative to
            membershipEntityId.
          example: client_abc123
          type: string
        companyId:
          description: >-
            CompanyID is the company id for a company channel, or to
            disambiguate a client that belongs to multiple companies.
          example: company_abc123
          type: string
        memberIds:
          description: >-
            MemberIds are the client user ids to include. Required for group
            channels.
          example:
            - user_abc123
            - user_def456
          items:
            type: string
          type: array
        membershipEntityId:
          description: >-
            MembershipEntityId is the company id (company channel) or client id
            (individual channel) the channel is scoped to.
          example: client_abc123
          type: string
        membershipType:
          description: MembershipType is the kind of channel to create.
          enum:
            - company
            - individual
            - group
          example: individual
          type: string
      required:
        - membershipType
      type: object
    messagechannel.MessageChannel:
      properties:
        clientId:
          description: >-
            ClientID is the id of the client associated with an individual
            channel.
          example: client_abc123
          type: string
        companyId:
          description: CompanyID is the id of the company associated with the channel.
          example: company_abc123
          type: string
        createdAt:
          description: CreatedAt is the time the channel was created.
          example: '2023-01-01T00:00:00Z'
          format: date-time
          type: string
        id:
          description: ID is the unique identifier of the message channel.
          example: abc123
          format: uuid
          type: string
        lastMessageDate:
          description: >-
            LastMessage is the time the most recent message was sent in the
            channel.
          example: '2023-01-03T00:00:00Z'
          format: date-time
          nullable: true
          type: string
        lastRead:
          description: >-
            LastRead is the time the viewer last read the channel. Populated
            alongside UnreadCount; omitted otherwise.
          example: '2023-01-02T12:00:00Z'
          format: date-time
          type: string
        memberIds:
          description: MemberIds are the user ids that belong to the channel.
          example:
            - user_abc123
            - user_def456
          items:
            type: string
          type: array
        membershipEntityId:
          description: >-
            MembershipEntityId is the id of the entity (company or client) the
            channel is scoped to.
          example: client_abc123
          type: string
        membershipType:
          description: >-
            MembershipType describes whether the channel is scoped to a company,
            a single client, or an ad-hoc group.
          enum:
            - company
            - individual
            - group
          example: individual
          type: string
        object:
          description: Object is the resource type discriminator, always "messageChannel".
          example: messageChannel
          type: string
        unreadCount:
          description: >-
            UnreadCount is the number of unread messages for the viewer.
            Populated by the /unread

            endpoint and by the list endpoint when includeUnread=true; omitted
            otherwise.
          example: 3
          type: integer
        updatedAt:
          description: UpdatedAt is the time the channel was last updated.
          example: '2023-01-02T00:00:00Z'
          format: date-time
          type: string
      type: object
    dispatcher.Error:
      properties:
        code:
          type: string
        data: {}
        message:
          type: string
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-KEY
      type: apiKey

````