POST
/
v2
/
pattern
curl --request POST \
  --url https://api.magicpatterns.com/api/v2/pattern \
  --header 'Content-Type: multipart/form-data' \
  --header 'x-mp-api-key: <api-key>' \
  --form 'prompt=Create a login page' \
  --form presetId=html-tailwind \
  --form 'images=[
  null
]'
{
  "id": "abc123",
  "sourceFiles": [
    {
      "id": "<string>",
      "name": "<string>",
      "code": "<string>",
      "type": "javascript"
    }
  ],
  "compiledFiles": [
    {
      "id": "<string>",
      "fileName": "<string>",
      "hostedUrl": "<string>",
      "type": "javascript"
    }
  ],
  "editorUrl": "https://www.magicpatterns.com/c/abc123",
  "previewUrl": "https://abc123-preview.magicpatterns.app",
  "chatMessages": [
    {
      "role": "assistant",
      "content": "I will create a login page with a centered layout."
    }
  ]
}

Authorizations

x-mp-api-key
string
header
required

Body

multipart/form-data
prompt
string
required

The prompt for the new design.

presetId
string

If nothing is provided, then html-tailwind is used. Can be either a default combination ('html-tailwind', 'shadcn-tailwind', 'chakraUi-inline', 'mantine-inline') or a custom configuration ID.

images
file[]

Optional images to inspire or guide the design creation. Maximum file size is 5MB per image.

Response

200
application/json
Successfully created a new design.
id
string

The unique ID of the created design.

sourceFiles
object[]

The source files for the design.

compiledFiles
object[]

The compiled/processed files for the design.

editorUrl
string

URL to access the editor interface.

previewUrl
string

URL to preview the generated design.

chatMessages
object[]

The conversation history for this design.