Skip to content
HTTP API reference
API, CLI e MCP

HTTP API reference

All routes of NeoMath's local HTTP API, with method, body, parameters and responses, based on the OpenAPI 3.1 specification.

On this page

Server: http://127.0.0.1:8790. Every route, except /v1/saude, requires the token (Authorization: Bearer <token>). Body limited to 16 MB (64 MB in /v1/lote-zip). The full OpenAPI specification is also available to AI models in the MCP resource neomath://api-http.

Route summary#

Method Route What it does Server
GET /v1/saude version, routes, limits and available extensions, no token both
POST /v1/eps generates the EPS both
POST /v1/svg SVG with glyphs as outlines both
POST /v1/png PNG both
POST /v1/normalizar cleans MathML coming from Word or the web both
POST /v1/layout glyph and stroke positions both
POST /v1/latex LaTeX to MathML both
POST /v1/para-latex MathML to LaTeX both
POST /v1/abrir recovers the equation from an EPS, SVG or PNG both
POST /v1/lote folder batch (only inside --raiz) both
POST /v1/lote-zip batch by .zip, without touching the disk both
GET /v1/fontes installed fonts both
POST /v1/vinculos date and size of up to 500 files both
POST /v1/ocr recognizes the equation in an image app
POST /v1/quimica draws a structure or a reaction scheme app
POST /v1/editar opens an .eps in NeoMath for editing app

Generation request#

/v1/eps, /v1/svg and /v1/png take the same body:

JSON
{
  "mathml": "x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}",
  "opcoes": {
    "neqp": "{ … text of a .neqp … }",
    "cor": [0, 100, 100, 0],
    "cor_em_tudo": true,
    "formato": "neof",
    "tamanho": 12,
    "fonte": "Times New Roman"
  }
}
Field Type Description
mathml text, required MathML or LaTeX
opcoes.neqp text content of a style
opcoes.cor text or list #RRGGBB, name, [c,m,y,k] (0 to 100) or [r,g,b] (0 to 255)
opcoes.cmyk list of numbers color in CMYK
opcoes.cor_em_tudo boolean also paints bars and delimiters
opcoes.tamanho number from 1 to 1000 body size in pt
opcoes.fonte text font for text, variables and numbers

POST /v1/eps#

Returns JSON with the EPS and the measurements. With ?bruto=1, it returns the file (application/postscript).

JSON
{
  "status": "ok",
  "eps": "%!PS-Adobe-3.0 EPSF-3.0 …",
  "largura_pt": 61.2,
  "altura_pt": 24.6,
  "linha_base_pt": 7.9,
  "mathml": "<math …>",
  "correcoes": []
}

Errors: 400, 401, 413, 421 and 422.

POST /v1/svg#

Returns image/svg+xml with glyphs as outlines.

POST /v1/png#

Parameter Values Default
dpi 36 to 2400 300
fundo branco transparent

Returns image/png.

Conversions#

Route Body Response
POST /v1/latex the LaTeX MathML
POST /v1/para-latex the MathML LaTeX
POST /v1/normalizar the MathML clean MathML and list of corrections
POST /v1/abrir the EPS, SVG or PNG file MathML, LaTeX, format and preferences
POST /v1/layout generation request glyphs and strokes as JSON

Batch#

POST /v1/lote#

Only inside the server’s --raiz folder; without it, it answers 403.

JSON
{ "pasta": "/caminho/da/entrada", "saida": "/caminho/da/saida", "opcoes": { "formato": "neof" } }

Returns the batch report.

POST /v1/lote-zip#

The exported .zip goes in, the .zip with the equations as EPS comes out. It does not touch the disk. Options go in the opcoes parameter (JSON in the URL).

POST /v1/ocr#

Body: the image (application/octet-stream: PNG, JPEG, BMP, WebP or GIF) or JSON { "imagem": "<base64 or data:image/...>" }.

JSON
{ "status": "ok", "latex": "\\frac{a}{b}", "latex_bruto": "…", "mathml": "<math …>", "provedor": "NeoCR", "milissegundos": 412 }

422 when the image is unreadable or nothing is recognized; 501 on the command-line server.

POST /v1/quimica#

JSON
{ "texto": "aspirina", "opcoes": { "modo": "auto" } }

modo: auto, smiles, nome, chemfig or texto, plus NeoChem’s style options. Returns { ok, svg, tipo, texto, cml, info: { smiles, formula, massa, atomos, ligacoes } }.

POST /v1/editar#

JSON
{ "caminho": "/caminho/eq_1.eps" }

Opens the file in NeoMath and returns { status: "ok", vinculo } with the state before editing. 400 if it is not .eps, 403 outside the root, 404 if the file does not exist.

POST /v1/vinculos#

JSON
{ "caminhos": ["/caminho/eq_1.eps", "/caminho/eq_2.eps"] }

Returns itens with caminho, existe, modificado_ms (ms since 1970), tamanho and, outside the root, erro. Up to 500 paths.

Error schema#

JSON
{ "status": "erro", "codigo": "entrada", "erro": "human-readable message" }