Overview
Create a new Mathcad Prime (.mcdx) document by defining its structure as a JSON request. Build complete calculation documents element by element without opening Mathcad.Asynchronous Operation: Returns immediately with a job ID. Poll Get Job Status for the download URL.
Authentication
Bearer token (API key from app.stru.ai)
Request Body
Must be
"create_document"Document title (1-200 characters)
Document metadata (optional)
Job configuration options (optional)
Element Types
Text Elements
Add headers, descriptions, and documentation.Must be
"text"Markdown-formatted text content
Text style:
"normal", "heading1", "heading2", "heading3"Variable Elements
Define input values with units.Must be
"variable"Variable name (letters, numbers, underscores)
Numeric value
Unit (e.g.,
"ft", "psi", "kN")Optional description/comment
Formula Elements
Add calculations and equations.Must be
"formula"Mathematical expression (Mathcad syntax)
Optional description
Unit for the result
+, -, *, /, ^, sqrt(), sin(), cos(), tan(), log(), exp()
Image Elements
Embed diagrams and photos.Must be
"image"Image URL or base64 data URI
Optional image caption
Width in pixels
Height in pixels
Response
Returns a job object with status “pending”.Unique job identifier
Job status:
"pending"ISO 8601 creation timestamp
Example Requests
Example Response (Pending)
Status Code:
202 AcceptedExample Response (Completed)
After polling, when job completes:Error Responses
Invalid request structure
Formula parsing error
Best Practices
Structure documents logically - Use text headers to organize sections (Inputs, Calculations, Results)
Define variables before formulas - Ensure all variables used in formulas are defined earlier in the element array
Use descriptive variable names -
beam_length is clearer than lAdd descriptions - Include
description fields to document what each element representsEnable AI formatting - For documents with 10+ elements, use
ai_formatting: true for professional layoutDownload files immediately: Generated .mcdx files expire after 24 hours. Download and store them promptly.
Formula dependencies: Variables must be defined before they’re used in formulas. The API validates this during generation.
Next Steps
1
Poll for Completion
Use Get Job Status to check when the document is ready
2
Download the File
When complete, use the signed URL to download your .mcdx file
3
Open in Mathcad
Open the downloaded .mcdx file in Mathcad Prime for review or editing