Quickstart
Get up and running with MacStrong in under a minute.
- Create an account and grab your API key from the dashboard.
- 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.pdfThe /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:
Authorization: Bearer ms_your_keyYou 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.
| Tier | Credits / month | Requests / month | Price |
|---|---|---|---|
| Free | 1,000 | 100 | $0 |
| Pro | 5,000 | 500 | $19/mo |
| Scale | 50,000 | 5,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.
| Method | Path | Description |
|---|---|---|
| POST | HTML → PDF | |
| POST | /pdf-to-img | PDF → Images (PNG/JPEG) |
POST /pdf
Generate a PDF from HTML content.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| html | string | Yes | HTML content to render |
| options.format | string | No | A4, A3, A5, Letter, Legal (default: A4) |
| options.margin | object | No | { top, right, bottom, left } in mm/px |
| options.landscape | boolean | No | Default: false |
| options.printBackground | boolean | No | Default: true |
| options.scale | number | No | 0.1–2.0 |
| options.headerTemplate | string | No | HTML for page header |
| options.footerTemplate | string | No | HTML for page footer |
| action | object | No | Output 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.pdfPOST /pdf-to-img
Convert a PDF to high-quality images. Provide the PDF via URL or base64 data.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| url | string | No | URL to a PDF (provide url OR data) |
| data | string | No | Base64-encoded PDF |
| options.format | string | No | png or jpeg (default: png) |
| options.pages | string | No | e.g. "1", "1-3", "1,3,5" (default: all) |
| options.scale | number | No | Scale factor (default: 2.0) |
| action | object | No | Output action — see Actions section |
Response
{
"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.
{ "action": { "name": "return" } }Upload to signed URL
MacStrong PUTs the result to your pre-signed URL (S3, R2, GCS, etc.) and returns a confirmation.
{ "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"}.
| Status | Error | Description |
|---|---|---|
| 400 | Bad Request | Missing or invalid parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | Domain not allowed (public key) or insufficient permissions |
| 429 | Credit Limit | Monthly credit limit exceeded |
| 500 | Internal Error | Server error — retry or contact support |
{
"success": false,
"error": "Missing required field: html"
}