Quickstart

Get up and running with MacStrong in under a minute.

  1. Create an account and grab your API key from the dashboard.
  2. Make your first request:
curl -X POST https://api.macstrong.net/pdf \
  -H "Authorization: Bearer ms_your_key" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Hello World</h1><p>My first PDF.</p>","options":{"format":"A4"}}' \
  -o output.pdf

The /pdf endpoint returns a binary PDF with Content-Type: application/pdf by default. Use the action field to upload results directly to a signed URL instead.

Authentication

All API requests require an API key. Pass it in the Authorization header:

http
Authorization: Bearer ms_your_key

You can also use X-API-Key: ms_your_key as an alternative header.

Credits

Every API request costs 10 credits. Your plan determines how many credits you get per month.

TierCredits / monthRequests / monthPrice
Free1,000100$0
Pro5,000500$19/mo
Scale50,0005,000$99/mo

When credits are exhausted, requests return 429 Too Many Requests. Check your usage anytime via the dashboard.

Endpoints

All endpoints are at https://api.macstrong.net.

MethodPathDescription
POST/pdfHTML → PDF
POST/pdf-to-imgPDF → Images (PNG/JPEG)

POST /pdf

Generate a PDF from HTML content.

Request Body

FieldTypeRequiredDescription
htmlstringYesHTML content to render
options.formatstringNoA4, A3, A5, Letter, Legal (default: A4)
options.marginobjectNo{ top, right, bottom, left } in mm/px
options.landscapebooleanNoDefault: false
options.printBackgroundbooleanNoDefault: true
options.scalenumberNo0.1–2.0
options.headerTemplatestringNoHTML for page header
options.footerTemplatestringNoHTML for page footer
actionobjectNoOutput action — see Actions section

Response

Binary PDF — Content-Type: application/pdf (with default action)

curl -X POST https://api.macstrong.net/pdf \
  -H "Authorization: Bearer ms_your_key" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Invoice #1042</h1><p>Total: $299</p>","options":{"format":"A4","margin":{"top":"20mm","bottom":"20mm"}}}' \
  -o invoice.pdf

POST /pdf-to-img

Convert a PDF to high-quality images. Provide the PDF via URL or base64 data.

Request Body

FieldTypeRequiredDescription
urlstringNoURL to a PDF (provide url OR data)
datastringNoBase64-encoded PDF
options.formatstringNopng or jpeg (default: png)
options.pagesstringNoe.g. "1", "1-3", "1,3,5" (default: all)
options.scalenumberNoScale factor (default: 2.0)
actionobjectNoOutput action — see Actions section

Response

json
{
  "success": true,
  "pages": [
    { "page": 1, "data": "<base64-encoded image>", "contentType": "image/png" }
  ],
  "metadata": {
    "totalPages": 3,
    "renderedPages": 1,
    "format": "png"
  }
}
curl -X POST https://api.macstrong.net/pdf-to-img \
  -H "Authorization: Bearer ms_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/doc.pdf","options":{"format":"png","pages":"1"}}'

Actions

Control how results are delivered using the action field in any request.

Return (default)

Result is returned directly in the response body.

json
{ "action": { "name": "return" } }

Upload to signed URL

MacStrong PUTs the result to your pre-signed URL (S3, R2, GCS, etc.) and returns a confirmation.

json
{ "action": { "name": "upload", "url": "https://your-bucket.s3.amazonaws.com/output.pdf?X-Amz-..." } }

This is useful for large files or when you want results stored directly in your cloud storage without downloading through your server.

Agent Skills

MacStrong is available as an AgentSkill — a self-describing API package that AI coding agents can discover and use autonomously.

AGENT.md

Point your AI agent at macstrong.net/AGENT.md for a concise API reference optimized for LLM context windows. The agent reads the spec and can immediately use both endpoints.

Compatible Agents

  • Claude Code, Cursor, Codex, OpenClaw
  • Any agent that reads AGENT.md or supports AgentSkills
  • OpenAI function calling (use the skill schema as tool definitions)

Error Codes

All errors return JSON with {"success": false, "error": "message"}.

StatusErrorDescription
400Bad RequestMissing or invalid parameters
401UnauthorizedInvalid or missing API key
403ForbiddenDomain not allowed (public key) or insufficient permissions
429Credit LimitMonthly credit limit exceeded
500Internal ErrorServer error — retry or contact support
json
{
  "success": false,
  "error": "Missing required field: html"
}