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

# Export HubSpot

> Export conversation as HubSpot-compatible HTML and HubL files.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/export/hubspot
openapi: 3.1.0
info:
  title: Migma.ai API (v1)
  description: >-
    API for managing brands, contacts, email generation, sending, and
    integrations.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.migma.ai
    description: Production
security:
  - apiKeyAuth: []
tags:
  - name: Projects/Brands
    description: Manage projects (brands) and import from websites
  - name: Contacts
    description: Manage your contacts, segments, tags, and topics
  - name: Segments
    description: Create and manage dynamic contact segments
  - name: Tags
    description: Organize contacts with tags
  - name: Topics
    description: Manage subscription topics and preferences
  - name: Emails
    description: Generate, send, and export emails
  - name: Email Validation
    description: Validate email content for compatibility and deliverability
  - name: Email Previews
    description: Preview emails across devices and email clients
  - name: Domains
    description: Manage sending domains and verification
  - name: Webhooks
    description: Manage webhook endpoints for real-time event notifications
  - name: Integrations
    description: Third-party platform integrations
  - name: Campaigns
    description: Create, schedule, send, and manage email campaigns
  - name: Project Editing
    description: Edit project assets, logos, images, and knowledge base entries
paths:
  /v1/export/hubspot:
    post:
      tags:
        - Emails
      summary: Export HubSpot
      description: Export conversation as HubSpot-compatible HTML and HubL files.
      operationId: ExportHubSpot
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                conversationId:
                  type: string
                  description: The conversation ID to export
                customOptions:
                  type: object
                  description: Custom options for HubSpot export
                  properties:
                    customInstructions:
                      type: string
                      description: Custom instructions for the export
              required:
                - conversationId
      responses:
        '200':
          description: HubSpot export successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseExport'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      x-codeSamples:
        - lang: javascript
          label: Node.js SDK
          source: |-
            import Migma from 'migma';

            const migma = new Migma('YOUR_API_KEY');

            const { data, error } = await migma.export.hubspot({
              conversationId: 'CONVERSATION_ID'
            });
components:
  schemas:
    ApiResponseExport:
      allOf:
        - $ref: '#/components/schemas/ApiResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/ExportData'
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          nullable: true
        error:
          type: string
          nullable: true
      required:
        - success
    ExportData:
      type: object
      properties:
        files:
          type: array
          items:
            $ref: '#/components/schemas/V1ExportFile'
          description: Array of exported files with download URLs and content
        executionTime:
          type: number
          description: Export execution time in milliseconds
        exportType:
          type: string
          enum:
            - html
            - klaviyo
            - mailchimp
            - mjml
            - hubspot
          description: Type of export performed
      required:
        - files
        - executionTime
        - exportType
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: string
      required:
        - success
        - error
    V1ExportFile:
      type: object
      properties:
        filename:
          type: string
          description: Name of the exported file
        url:
          type: string
          format: uri
          description: Download URL for the exported file
        content:
          type: string
          description: File content
        format:
          type: string
          enum:
            - html
            - hubl
            - json
            - text
            - mjml
          description: Format of the exported file
        description:
          type: string
          description: Description of the exported file
        fileSize:
          type: number
          description: File size in bytes
      required:
        - filename
        - url
        - content
        - format
        - description
        - fileSize
      additionalProperties: false
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where
        YOUR_API_KEY is obtained from the Migma dashboard under Settings → API
        Integration.

````