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

# Get Email Edit Status

> Get the exact queued edit status. Requires email:read and ownership of the email. A completed response includes the current saved Email in result. A failed response includes error and changesMayHaveBeenSaved; inspect the stored email before starting another edit. Failed or stalled jobs are not automatically rewritten. Do not infer this edit's status from conversation generation status.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/emails/{emailId}/edits/{editId}
openapi: 3.1.0
info:
  title: Migma.ai API (v1)
  description: >-
    API for managing brands, contacts, email generation, sending, and
    integrations. API request budgets are plan-based and shared across an
    account's API keys per route group. Sending request allowances support the
    account's recipients/second rate; recipient throughput and daily/monthly
    email quotas remain separate. See
    https://docs.migma.ai/api-reference/introduction#rate-limiting for limits,
    response headers, and retry behavior.
  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: Events
    description: Record customer events and conversions
  - name: Integrations
    description: Third-party platform integrations
  - name: Campaigns
    description: Create, schedule, send, and manage email campaigns
  - name: Billing
    description: View your plan and credits and create billing links
  - name: Project Editing
    description: Edit project assets, logos, images, and knowledge base entries
paths:
  /v1/emails/{emailId}/edits/{editId}:
    get:
      tags:
        - Emails
      summary: Get Email Edit Status
      description: >-
        Get the exact queued edit status. Requires email:read and ownership of
        the email. A completed response includes the current saved Email in
        result. A failed response includes error and changesMayHaveBeenSaved;
        inspect the stored email before starting another edit. Failed or stalled
        jobs are not automatically rewritten. Do not infer this edit's status
        from conversation generation status.
      operationId: GetEmailEditStatus
      parameters:
        - name: emailId
          in: path
          required: true
          description: Email ID used to start the edit.
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
        - name: editId
          in: path
          required: true
          description: Edit job ID returned by the async edit request.
          schema:
            type: string
            pattern: ^[a-f0-9-]{32,64}$
      responses:
        '200':
          description: Current email edit operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseEmailEditOperation'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: >-
            Edit job is missing, expired, or does not belong to this email or
            owner.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: The edit queue is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      x-codeSamples:
        - lang: javascript
          label: Node.js SDK (builds with queued edits)
          source: >
            import Migma from 'migma';


            const migma = new Migma('YOUR_API_KEY');

            const polled = await migma.emails.getEditStatus('EMAIL_ID',
            'EDIT_ID');

            if (polled.error) throw polled.error;

            const status = polled.data;

            if (status.status === 'completed' && status.result)
            console.log(status.result.html);

            if (status.status === 'failed') {
              console.error(status.error, status.changesMayHaveBeenSaved);
              // Inspect the stored email before starting another edit.
            }
        - lang: bash
          label: REST
          source: |
            curl 'https://api.migma.ai/v1/emails/EMAIL_ID/edits/EDIT_ID' \
              -H 'Authorization: Bearer YOUR_API_KEY'
components:
  schemas:
    ApiResponseEmailEditOperation:
      allOf:
        - $ref: '#/components/schemas/ApiResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/EmailEditOperation'
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: string
        code:
          type: string
          description: >-
            Machine-readable error code (e.g., IDEMPOTENCY_CONFLICT,
            DOMAIN_CLAIMABLE).
        data:
          type: object
          description: >-
            Additional structured context for the error, such as the affected
            domain.
          additionalProperties: true
      required:
        - success
        - error
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          nullable: true
        error:
          type: string
          nullable: true
      required:
        - success
    EmailEditOperation:
      type: object
      properties:
        editId:
          type: string
        emailId:
          type: string
        conversationId:
          type: string
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
        stage:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        pollAfterMs:
          type: integer
        error:
          type: string
          description: Present when status is failed.
        changesMayHaveBeenSaved:
          type: boolean
          description: >-
            Present when status is failed. Inspect the stored email before
            starting another edit.
        result:
          $ref: '#/components/schemas/Email'
          description: >-
            Current saved email. Present on a completed status GET; omitted from
            the initial 202 response, including terminal idempotent replays.
      required:
        - editId
        - emailId
        - conversationId
        - status
        - stage
        - createdAt
        - updatedAt
        - pollAfterMs
    Email:
      type: object
      properties:
        id:
          type: string
        emailId:
          type: string
        conversationId:
          type: string
        messageId:
          type:
            - string
            - 'null'
        slotIdx:
          type: integer
        slotUuid:
          type:
            - string
            - 'null'
        status:
          type: string
        subject:
          type: string
        preheader:
          type: string
        html:
          type: string
          description: Production-ready email HTML.
        screenshotUrl:
          type:
            - string
            - 'null'
          format: uri
        thumbnailUrl:
          type:
            - string
            - 'null'
          format: uri
        warnings:
          type: array
          items:
            type: string
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - emailId
        - conversationId
        - messageId
        - slotIdx
        - slotUuid
        - status
        - subject
        - preheader
        - html
        - warnings
        - thumbnailUrl
        - updatedAt
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: Forbidden - Missing required permissions or access denied
      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 →
        Developers → API Keys.

````