Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Mathpix

Scalekit connector
Open markdown

The Mathpix connector lets your AI agent act in each user's Mathpix account. Each user connects their own Mathpix API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 15 tools.

Tools
15
What they doRead · write · destructive
11 · 2 · 211 read2 write2 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Mathpix connection

    In AgentKit > Connections, create a Mathpix connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'mathpix'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Mathpix:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'mathpix_list_ocr_results',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Mathpix credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • mathpix_get_conversion_resultDownload the text output of a Mathpix Markdown conversion: Markdown, HTML or the source Mathpix Markdown.Read-only

    Get Conversion Result

    Download the text output of a Mathpix Markdown conversion: Markdown, HTML or the source Mathpix Markdown. Returns the converted content as text. Use this after mathpix_get_conversion_status shows the format completed. Use mathpix_get_pdf_result for a processed document. Requires a conversion_id from mathpix_convert_markdown.

    Inputs

    conversion_idstringrequired
    The conversion_id returned by mathpix_convert_markdown. Example: 2024_01_15_abc123def456
    formatstringrequired
    Output to download: md (plain Markdown) or html must have been requested in formats and show completed; mmd returns the submitted Mathpix Markdown.one of mdhtmlmmd
  • mathpix_get_conversion_statusCheck the progress of each output format of a Mathpix conversion.Read-only

    Get Conversion Status

    Check the progress of each output format of a Mathpix conversion. Returns status and conversion_status, a map from format (docx, md, pdf and so on) to received, loaded, processing, completed or error, with error_info on failure. Use this after mathpix_convert_markdown, or with a pdf_id to track the conversion_formats of mathpix_submit_pdf. Use mathpix_get_pdf_status for a document's OCR progress.

    Inputs

    conversion_idstringrequired
    The conversion_id returned by mathpix_convert_markdown, or a pdf_id from mathpix_submit_pdf to check that document's conversion formats. Example: 2024_01_15_abc123def456
  • mathpix_get_ocr_usageGet Mathpix API usage counts over a date range, grouped by usage type, request settings or app.Read-only

    Get OCR Usage

    Get Mathpix API usage counts over a date range, grouped by usage type, request settings or app. Returns ocr_usage, one record per period and group with from_date, app_id, usage_type, request_args_hash and count. Use this to track consumption or reconcile billing. Use mathpix_list_ocr_results to see the individual results.

    Inputs

    group_bystringrequired
    How to aggregate the counts: usage_type (image, image-async, pdf pages and so on), request_args_hash (identical request settings) or app_id.one of usage_typerequest_args_hashapp_id
    timespanstringrequired
    Length of each aggregation period. Mathpix's documentation shows month; it does not list other values. Example: month
    from_datestring
    Only include results at or after this ISO 8601 date-time (inclusive). Example: 2026-07-01T00:00:00.000Z
    to_datestring
    Only include results before this ISO 8601 date-time (exclusive). Example: 2026-08-01T00:00:00.000Z
  • mathpix_get_pdf_linesDownload line-by-line data for a processed document.Read-only

    Get PDF Lines

    Download line-by-line data for a processed document. Returns pages, each with page number, size and lines carrying type, text, Mathpix Markdown (text_display), bounding region, contour and confidence. Use this to locate content on the page or filter by confidence. Use mathpix_get_pdf_result for the document as one Markdown or HTML text. Requires a pdf_id whose status is completed.

    Inputs

    pdf_idstringrequired
    The pdf_id returned by mathpix_submit_pdf, or the id field from mathpix_list_pdf_results. Example: 2024_01_15_abc123def456
  • mathpix_get_pdf_resultDownload the text output of a processed document: Mathpix Markdown, plain Markdown or HTML.Read-only

    Get PDF Result

    Download the text output of a processed document: Mathpix Markdown, plain Markdown or HTML. Returns the document content as text. Use this to read a document after mathpix_get_pdf_status shows completed. Use mathpix_get_pdf_lines for per-line positions and confidence. Requires a pdf_id from mathpix_submit_pdf.

    Inputs

    formatstringrequired
    Output to download: mmd is Mathpix Markdown (always available once processing completes), md is plain Markdown, html is HTML. md and html are converted on demand if they were not requested at submission; while that runs Mathpix answers 202 with a status object instead of the content. A 404 with a status object means the document is not finished yet.one of mmdmdhtml
    pdf_idstringrequired
    The pdf_id returned by mathpix_submit_pdf, or the id field from mathpix_list_pdf_results. Example: 2024_01_15_abc123def456
  • mathpix_get_pdf_statusCheck the processing status of a document submitted with mathpix_submit_pdf.Read-only

    Get PDF Status

    Check the processing status of a document submitted with mathpix_submit_pdf. Returns status (received, loaded, split, completed or error), num_pages, num_pages_completed, percent_done and conversion_status for each requested format. Poll this until status is completed before calling mathpix_get_pdf_result; percent_done reaches 100 before the output is ready. Use mathpix_get_conversion_status for conversion progress only.

    Inputs

    pdf_idstringrequired
    The pdf_id returned by mathpix_submit_pdf, or the id field from mathpix_list_pdf_results. Example: 2024_01_15_abc123def456
  • mathpix_list_ocr_resultsList past Mathpix image results (from image, equation, strokes and document requests), newest first, with filters for date, tags, text and content type.Read-only

    List OCR Results

    List past Mathpix image results (from image, equation, strokes and document requests), newest first, with filters for date, tags, text and content type. Returns ocr_results, each with timestamp, endpoint, image_id, request_args, the full result and detections such as is_handwritten or contains_table. Use this to find earlier image OCR results. Use mathpix_list_pdf_results for document jobs. Results sent with improve_mathpix set to false are not listed.

    Inputs

    app_idstring
    Only include results from this Mathpix app ID, for accounts with several apps. Example: mycompany_abc123
    contains_chemistryboolean
    Set to true to include only results that contain a chemistry diagram.
    contains_diagramboolean
    Set to true to include only results that contain a diagram.
    contains_tableboolean
    Set to true to include only results that contain a table.
    from_datestring
    Only include results at or after this ISO 8601 date-time (inclusive). Example: 2026-07-01T00:00:00.000Z
    is_handwrittenboolean
    Set to true to include only results that contain handwritten text or math.
    is_printedboolean
    Set to true to include only results that contain printed text or math.
    latex_styledstring
    Only include results whose latex_styled output contains this string. Example: \frac
    pageinteger
    Page of results to return, starting at 1 (maximum 10000). Mathpix default: 1.
    per_pageinteger
    Number of results per page. Mathpix default: 100.
    tagsarray
    Only include results that carry these tags (set with the tags input of the processing tools). Example: ["homework"]
    textstring
    Only include results whose text output contains this string. Example: x^{2}
    to_datestring
    Only include results before this ISO 8601 date-time (exclusive). Example: 2026-08-01T00:00:00.000Z
  • mathpix_list_pdf_resultsList documents previously submitted to Mathpix, with an optional date range.Read-only

    List PDF Results

    List documents previously submitted to Mathpix, with an optional date range. Returns pdfs, each with id, input_file, status, created_at, modified_at, num_pages, num_pages_completed and request_args. Use this to find a pdf_id you no longer have. Use mathpix_get_pdf_status for one document's current status, and mathpix_list_ocr_results for image results.

    Inputs

    app_idstring
    Only include results from this Mathpix app ID, for accounts with several apps. Example: mycompany_abc123
    from_datestring
    Only include results at or after this ISO 8601 date-time (inclusive). Example: 2026-07-01T00:00:00.000Z
    pageinteger
    Page of results to return, starting at 1 (maximum 10000). Mathpix default: 1.
    per_pageinteger
    Number of results per page. Mathpix default: 100.
    to_datestring
    Only include results before this ISO 8601 date-time (exclusive). Example: 2026-08-01T00:00:00.000Z