POST
/
pattern
curl --request POST \
  --url https://api.magicpatterns.com/api/pattern \
  --header 'Content-Type: multipart/form-data' \
  --header 'x-mp-api-key: <api-key>' \
  --form 'prompt=Create a login page' \
  --form designSystem=html \
  --form styling=customTailwind \
  --form 'image=<string>' \
  --form shouldAwaitGenerations=true \
  --form numberOfGenerations=2
{
  "id": "123456",
  "snapshots": [
    {
      "prompt": "<string>",
      "activeGenerationId": "<string>",
      "generations": [
        {
          "id": "<string>",
          "status": "NOT_STARTED",
          "type": "NEW",
          "sourceCode": "<string>",
          "error": "<string>",
          "previewJob": {
            "url": "<string>",
            "status": "NOT_STARTED"
          }
        }
      ]
    }
  ],
  "url": "https://www.magicpatterns.com/123456",
  "iFrameUrl": "https://www.magicpatterns.com/iframe/123456"
}

Authorizations

x-mp-api-key
string
headerrequired

Body

prompt
string

The prompt for the new pattern.

designSystem
enum<string>

The design system to use for creating the pattern.

Available options:
html,
radixThemes,
shadcn,
mantine,
chakraUi
styling
enum<string>

The styling approach to apply to the pattern.

Available options:
tailwind,
inline,
customTailwind
image
string

An optional image to inspire or guide the pattern creation.

shouldAwaitGenerations
boolean
default: false

Whether to wait for all generations to complete before responding.

numberOfGenerations
integer
default: 1

The number of generations to process for the pattern. Must be at least 1.

Response

200 - application/json
id
string

The unique ID of the created pattern.

snapshots
object[]
url
string
iFrameUrl
string