NextGenText / NGT Studio
PricingGet API key →

NGT API

The NGT API turns a plain-English prompt into a complete document specification and renders each section as pixel-perfect SVG. Built on Claude Sonnet (structure) and Claude Haiku (per-element rendering).

Base URL: https://nextgentext.online/api/ngt

Authentication

All requests require a Bearer API key in the Authorization header. Generate keys from your dashboard.

# Every request needs this header Authorization: Bearer ngt_your_key_here

Keys start with ngt_. Treat them as secrets — do not expose in client-side code.

Errors

The API uses standard HTTP status codes. Error responses contain a JSON body with an error key.

CodeMeaning
401Missing or invalid API key
403Account has no active subscription
422Request validation failed or model returned invalid output
429Daily rate limit exceeded
503Server Anthropic key not configured

Rate limits

PlanCalls / day
Trial20
NGT Studio Monthly500
NGT Studio Yearly2,000
NGT API5,000

Limits reset at midnight UTC. Exceeded requests receive a 429 response with limit and reset fields.


POST /generate

Generate a complete document specification from a prompt. Uses Claude Sonnet. Returns a JSON spec you can render yourself or pass to /element for SVG output.

POST/api/ngt/generate

Request body

FieldTypeRequiredDescription
promptstringYesPlain-English description of the document. Max 2,000 chars.
formatstringNoFormat preset key, e.g. a4p, ig_sq. Overrides auto-detect.

Example

curl https://nextgentext.online/api/ngt/generate \ -H "Authorization: Bearer ngt_..." \ -H "Content-Type: application/json" \ -d '{ "prompt": "A4 sustainability report for Birchwood Coffee 2024", "format": "a4p" }'

Response

{ "spec": { "documentType": "business_doc", "title": "Birchwood Coffee — Sustainability Report 2024", "format": { "preset": "a4p", "width": 1240, "height": 1754 }, "palette": { /* 8 colour roles */ }, "typography": { /* 6 type roles */ }, "layout": { /* margins and gaps */ }, "sections": [ /* array of section objects */ ] }, "model": "NGT-1", "engine": "ngt-sonnet" }

POST /edit

Apply iterative changes to an existing spec. Pass the current spec and a plain-English instruction. Returns an array of mutation commands you apply to the spec on your side.

POST/api/ngt/edit
FieldTypeRequiredDescription
specobjectYesCurrent document spec (from /generate or your own).
instructionstringYesChange instruction. Max 1,000 chars.
# Example instruction "instruction": "Make the accent colour darker and switch body font to Lora" # Response — array of mutation commands { "mutations": [ { "action": "set_palette", "key": "accent", "value": "#8b3a0f" }, { "action": "set_typography", "role": "body", "prop": "family", "value": "Lora" } ] }

POST /element

Generate a raw SVG fragment for a single section within exact pixel bounds. Uses Claude Haiku. This is the primitive that powers AI Elements mode in NGT Studio.

POST/api/ngt/element
FieldRequiredDescription
sectionYesSection object (type + content).
boundsYes{"w": 1072, "h": 200} — pixel dimensions.
paletteYes8-key colour palette object.
typographyYesTypography roles object.
contextNoOne-line summary of other sections for layout context.
instructionNoOptional variation instruction.

Response

{ "svg_fragment": "<rect width=\"1072\" height=\"200\" .../>\n<text ...", "bounds": { "w": 1072, "h": 200 }, "model": "NGT-1-mini" }

Wrap the fragment in a <g transform="translate(x,y)"> with a clipPath to assemble multiple elements into a full document SVG.

POST /validate

Validate a spec for common layout problems. Returns warnings without making any AI calls — instant, no tokens consumed.

POST/api/ngt/validate
{ "warnings": [ { "severity": "error", "message": "display font is 6px — below 8px minimum." }, { "severity": "warning", "message": "Section 3 table row 1: cell count ≠ header count." } ], "valid": false }

Spec schema

The document spec is the central data structure. Generate it with /generate, modify it with mutation commands from /edit, and render sections with /element.

{ "documentType": "business_doc", // infographic | social_post | poster | research_doc | ... "title": "Document Title", "format": { "preset": "a4p", // see /formats for all keys "width": 1240, "height": 1754, "dpi": 150 }, "palette": { "background": "#fff", "surface": "#f4f4f4", "surfaceAlt": "#e8e8e8", "accent": "#c8633a", "accentLight": "#fde8de", "text": "#1a1a18", "textMuted": "#6f6f6f", "border": "#e0d8cc" }, "typography": { "display": { "family": "Playfair Display", "size": 72, "weight": 700, "lineHeight": 1.1 }, "heading": { "family": "Playfair Display", "size": 36, "weight": 600, "lineHeight": 1.2 }, "subheading": { "family": "Inter", "size": 22, "weight": 400, "lineHeight": 1.3 }, "body": { "family": "Inter", "size": 16, "weight": 400, "lineHeight": 1.6 }, "caption": { "family": "Inter", "size": 12, "weight": 400, "lineHeight": 1.4 }, "label": { "family": "Inter", "size": 11, "weight": 600, "lineHeight": 1.2 } }, "layout": { "marginTop": 64, "marginRight": 64, "marginBottom": 64, "marginLeft": 64, "columnGap": 32, "sectionGap": 40 }, "sections": [ /* array of section objects */ ] }

Section types

TypeKey fields
heroheading, subheading, align (left|center)
headingcontent, level (1|2|3)
bodycontent, columns (1|2)
featureicon (emoji), heading, body
stat_rowitems: [{value, label}]
quotecontent, attribution
listitems: [string]
columnsitems: [{heading, body}]
image_blockimageId, caption, aspectRatio, altText
calloutlabel, content, labelColor
timelineitems: [{date, heading, body}]
tableheaders: [], rows: [[]]
divider
captioncontent
footercontent

Any section can include "bg": "#hex" for a full-bleed background colour behind that section.

Common format presets

KeyNameDimensions
a4pA4 Portrait1240 × 1754
a4lA4 Landscape1754 × 1240
letpUS Letter Portrait1275 × 1650
pres169Presentation 16:91920 × 1080
ig_sqInstagram Post1080 × 1080
ig_stInstagram Story1080 × 1920
li_pLinkedIn Post1200 × 628
tw_pX (Twitter) Post1200 × 675
bcardBusiness Card1050 × 600

50+ formats available. See full list in NGT Studio format selector.