Skip to main content
POST
/
v1
/
components
/
generate
Generate a new component
curl --request POST \
  --url https://api.yalg.ai/v1/components/generate \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "prompt": "Create a clean animated metric card for a 9:16 video.",
  "category": "metric"
}
'
{
  "id": "018f9f51-4b89-778f-9c0b-fd4626f47326",
  "name": "Metric comparison card",
  "category": "metric",
  "isPublic": false,
  "isValidated": true,
  "createdAt": "2026-06-20T17:24:39.000Z",
  "updatedAt": "2026-06-20T17:24:39.000Z"
}

Authorizations

x-api-key
string
header
default:yalg_live_your_api_key
required

YALG Developer API key. Send it in the x-api-key header from a server-side environment only.

Body

application/json
prompt
string
required

Natural language description of the component to generate

Required string length: 10 - 2000
Example:

"A stat card that displays a percentage with a circular progress indicator"

category
enum<string>
required

Category for the component

Available options:
text,
stat,
transition,
cta,
custom
Example:

"stat"

name
string

Name for the component

Maximum string length: 200
Example:

"Circular Progress Card"

tags
string[]

Tags for searchability

Example:
["stat", "progress", "circular"]
themeId
string<uuid>

Theme ID to use for generation context

isPublic
boolean
default:false

Whether the component should be public

Response

Component generated successfully

Generated visual component.

id
string<uuid>

Component identifier.

Example:

"018f9f40-7d7b-7712-9b0f-2e5d9fd5df3f"

name
string
Example:

"Metric counter"

category
string
Example:

"chart"

code
string

Generated component source code.

isPublic
boolean
Example:

false

isValidated
boolean
Example:

true

createdAt
string<date-time>
Example:

"2026-06-20T17:24:39.000Z"

updatedAt
string<date-time>
Example:

"2026-06-20T17:24:39.000Z"