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).
https://nextgentext.online/api/ngtAuthentication
All requests require a Bearer API key in the Authorization header. Generate keys from your dashboard.
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.
| Code | Meaning |
|---|---|
| 401 | Missing or invalid API key |
| 403 | Account has no active subscription |
| 422 | Request validation failed or model returned invalid output |
| 429 | Daily rate limit exceeded |
| 503 | Server Anthropic key not configured |
Rate limits
| Plan | Calls / day |
|---|---|
| Trial | 20 |
| NGT Studio Monthly | 500 |
| NGT Studio Yearly | 2,000 |
| NGT API | 5,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.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Plain-English description of the document. Max 2,000 chars. |
| format | string | No | Format preset key, e.g. a4p, ig_sq. Overrides auto-detect. |
Example
Response
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.
| Field | Type | Required | Description |
|---|---|---|---|
| spec | object | Yes | Current document spec (from /generate or your own). |
| instruction | string | Yes | Change instruction. Max 1,000 chars. |
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.
| Field | Required | Description |
|---|---|---|
| section | Yes | Section object (type + content). |
| bounds | Yes | {"w": 1072, "h": 200} — pixel dimensions. |
| palette | Yes | 8-key colour palette object. |
| typography | Yes | Typography roles object. |
| context | No | One-line summary of other sections for layout context. |
| instruction | No | Optional variation instruction. |
Response
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.
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.
Section types
| Type | Key fields |
|---|---|
| hero | heading, subheading, align (left|center) |
| heading | content, level (1|2|3) |
| body | content, columns (1|2) |
| feature | icon (emoji), heading, body |
| stat_row | items: [{value, label}] |
| quote | content, attribution |
| list | items: [string] |
| columns | items: [{heading, body}] |
| image_block | imageId, caption, aspectRatio, altText |
| callout | label, content, labelColor |
| timeline | items: [{date, heading, body}] |
| table | headers: [], rows: [[]] |
| divider | — |
| caption | content |
| footer | content |
Any section can include "bg": "#hex" for a full-bleed background colour behind that section.
Common format presets
| Key | Name | Dimensions |
|---|---|---|
| a4p | A4 Portrait | 1240 × 1754 |
| a4l | A4 Landscape | 1754 × 1240 |
| letp | US Letter Portrait | 1275 × 1650 |
| pres169 | Presentation 16:9 | 1920 × 1080 |
| ig_sq | Instagram Post | 1080 × 1080 |
| ig_st | Instagram Story | 1080 × 1920 |
| li_p | LinkedIn Post | 1200 × 628 |
| tw_p | X (Twitter) Post | 1200 × 675 |
| bcard | Business Card | 1050 × 600 |
50+ formats available. See full list in NGT Studio format selector.