> ## Documentation Index
> Fetch the complete documentation index at: https://myco-29fc6df6-sweetmantech-myc-3925-docs-document-the-apiar.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create

> Create a new chat room. Optionally associate it with an artist and/or provide a client-generated chat ID. Organization API keys can create chats on behalf of other accounts within their organization by specifying an accountId.



## OpenAPI

````yaml post /api/chats
openapi: 3.1.0
info:
  title: Recoup API
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://recoup-api.vercel.app
security:
  - apiKeyAuth: []
paths:
  /api/chats:
    post:
      description: >-
        Create a new chat room. Optionally associate it with an artist and/or
        provide a client-generated chat ID. Organization API keys can create
        chats on behalf of other accounts within their organization by
        specifying an accountId.
      requestBody:
        description: Chat creation parameters
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatRequest'
      responses:
        '200':
          description: Chat created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChatResponse'
        '400':
          description: Bad request - failed to create chat
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChatErrorResponse'
        '403':
          description: Forbidden - API key does not have access to the specified accountId
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChatErrorResponse'
components:
  schemas:
    CreateChatRequest:
      type: object
      properties:
        artistId:
          type: string
          format: uuid
          description: UUID of the artist account the chat is associated with
        chatId:
          type: string
          format: uuid
          description: >-
            UUID for the new chat (client-generated). If not provided, one will
            be generated automatically.
        accountId:
          type: string
          format: uuid
          description: >-
            UUID of the account to create the chat for. Only applicable for
            organization API keys - org keys can specify an accountId for any
            account within their organization. The Recoup admin organization can
            specify any accountId. If not provided, the chat is created for the
            API key's own account.
    CreateChatResponse:
      type: object
      required:
        - status
        - chat
      properties:
        status:
          type: string
          enum:
            - success
          description: Status of the request
        chat:
          $ref: '#/components/schemas/ChatRoom'
          description: The created chat room object
    CreateChatErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
          description: Status of the request
        message:
          type: string
          description: Error message describing what went wrong
    ChatRoom:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: UUID of the chat room
        account_id:
          type: string
          format: uuid
          nullable: true
          description: UUID of the associated account (can be null if not set)
        topic:
          type: string
          nullable: true
          description: Optional topic or description of the room (null if not provided)
        updated_at:
          type: string
          format: date-time
          description: ISO timestamp of the last update to the room
        artist_id:
          type: string
          format: uuid
          nullable: true
          description: UUID of the associated artist account (null when not applicable)
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).

````