curl -X POST https://api.neuraldraft.io/v1/components/register \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d @hero.jsonconst cmp = await nd.components.register({ html, intent: "marketing_hero", pageSlug: "home" });
cmp = requests.post(
"https://api.neuraldraft.io/v1/components/register",
headers={"Authorization": f"Bearer {key}"},
json={"html": html, "intent": "marketing_hero", "page_slug": "home"},
).json()
<?php
$cmp = json_decode((string) $client->post('components/register', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['html' => $html, 'intent' => 'marketing_hero', 'page_slug' => 'home'],
])->getBody(), true);
{
"id": "cmp_2Ngd9KqLmRpW",
"intent": "marketing_hero",
"page_slug": "home",
"html": "<section class=\"hero\" data-nd-component=\"hero\">\n <h1 data-translate=\"hero.headline\">Find your calm</h1>\n <p data-translate=\"hero.subhead\">Boutique yoga in Richmond</p>\n <a href=\"#book\" data-translate=\"hero.cta\">Book a class</a>\n</section>\n",
"keys_created": [
"hero.headline",
"hero.subhead",
"hero.cta"
],
"created_at": "2026-04-19T10:14:02Z",
"updated_at": "2026-04-19T10:14:02Z"
}{
"type": "https://api.neuraldraft.io/errors/bad_request",
"title": "Bad request",
"status": 400,
"detail": "Request body could not be parsed.",
"code": "bad_request",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "API key missing or invalid.",
"code": "unauthorized",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/validation_failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields failed validation.",
"code": "validation_failed",
"instance": "req_2Nh4PqRsTuVw",
"errors": {
"customer_email": [
"The customer email field must be a valid email address."
],
"starts_at": [
"The starts at field must be a date after now."
]
}
}Register an editable HTML component
Used by AI codegen tools (and the MCP server’s register_component
tool) during a build session. The tool says: “I just generated this
hero section — register it as editable in the project’s admin.”
Neural Draft parses the HTML, extracts every data-translate="key"
attribute, creates the corresponding translation keys, and stores
the HTML as a Component. The component then appears in the project
admin as editable, and the MCP server can stream changes back via
content.changed webhooks.
Costs 0 credits — registration itself is free. Future edits invoked through this component go through the standard content/image endpoints with their normal pricing.
curl -X POST https://api.neuraldraft.io/v1/components/register \
-H "Authorization: Bearer ndsk_live_yourkey" \
-H "Content-Type: application/json" \
-d @hero.jsonconst cmp = await nd.components.register({ html, intent: "marketing_hero", pageSlug: "home" });
cmp = requests.post(
"https://api.neuraldraft.io/v1/components/register",
headers={"Authorization": f"Bearer {key}"},
json={"html": html, "intent": "marketing_hero", "page_slug": "home"},
).json()
<?php
$cmp = json_decode((string) $client->post('components/register', [
'headers' => ['Authorization' => 'Bearer '.$key],
'json' => ['html' => $html, 'intent' => 'marketing_hero', 'page_slug' => 'home'],
])->getBody(), true);
{
"id": "cmp_2Ngd9KqLmRpW",
"intent": "marketing_hero",
"page_slug": "home",
"html": "<section class=\"hero\" data-nd-component=\"hero\">\n <h1 data-translate=\"hero.headline\">Find your calm</h1>\n <p data-translate=\"hero.subhead\">Boutique yoga in Richmond</p>\n <a href=\"#book\" data-translate=\"hero.cta\">Book a class</a>\n</section>\n",
"keys_created": [
"hero.headline",
"hero.subhead",
"hero.cta"
],
"created_at": "2026-04-19T10:14:02Z",
"updated_at": "2026-04-19T10:14:02Z"
}{
"type": "https://api.neuraldraft.io/errors/bad_request",
"title": "Bad request",
"status": 400,
"detail": "Request body could not be parsed.",
"code": "bad_request",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "API key missing or invalid.",
"code": "unauthorized",
"instance": "req_2Nh4PqRsTuVw"
}{
"type": "https://api.neuraldraft.io/errors/validation_failed",
"title": "Validation failed",
"status": 422,
"detail": "One or more fields failed validation.",
"code": "validation_failed",
"instance": "req_2Nh4PqRsTuVw",
"errors": {
"customer_email": [
"The customer email field must be a valid email address."
],
"starts_at": [
"The starts at field must be a date after now."
]
}
}Authorizations
Project API key. Pass as Authorization: Bearer ndsk_live_.... Manage
keys via /projects/me/api-keys. Test-mode keys use
the ndsk_test_ prefix.
Body
Response
Component registered.