Skip to main content
POST
Node.js SDK (builds with queued edits)

Authorizations

Authorization
string
header
required

API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.

Headers

Idempotency-Key
string

Optional key of at most 100 characters for async edits only. For the same authenticated API key and email, reusing the key with the same prompt and label returns the same job; a conflicting body returns 409 IDEMPOTENCY_CONFLICT. The receipt remains available for at least 24 hours after terminal completion under normal cleanup. Reuse the same key after an uncertain async start.

Maximum string length: 100

Path Parameters

emailId
string
required

Email ID returned in generation status result.emails[].emailId.

Pattern: ^[0-9a-fA-F]{24}$

Body

application/json
prompt
string
required

Natural-language edit request, e.g. "Make this shorter and more transactional".

Required string length: 1 - 20000
label
string

Optional version label.

Required string length: 1 - 120
async
boolean
default:false

Set true to durably enqueue the edit and return 202. Omit or set false to keep the existing synchronous 200 Email response.

Response

Synchronous edit completed. Returned when async is omitted or false.

success
boolean
required
data
object
error
string | null