Skip to content

Getting started

Markdown API quickstart

Make your first authenticated Markdown Viewer API call in under a minute. This guide walks you through creating a key, sending a request, and reading the response — with copy-paste snippets for curl, JavaScript, TypeScript, and Python.

No SDK to install. No webhooks to configure. Just HTTPS, JSON, and a Bearer token.

Step 1

Create an API key

Sign in to your account and head to the API Keys page. Click “New key”, give it a label that identifies the environment (eg. production-web), and copy the secret. We only display the full key once — store it in your secrets manager or environment variables right away.

Production keys look like mdv_live_…. They're hashed on our side with a salted SHA-256, so we can't recover the raw value after creation — keep them safe.

Step 2

Send your first request

Authenticate every request with the Authorization header and pass the markdown in the JSON body. Pick your language:

curl -X POST 'https://trymarkdownviewer.com/api/v1/render' \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"markdown":"# Hello world\n\nWelcome to **Markdown Viewer**."}'

Replace YOUR_API_KEY with the value you copied in step 1. In production, read it from process.env or your secrets manager — never hard-code it.

Step 3

Read the response

Successful responses are always wrapped in a data field:

{
  "data": {
    "html": "<h1 id=\"hello\">Hello</h1>\n<p>Welcome to <strong>Markdown Viewer</strong>.</p>",
    "characters": 78
  }
}

Errors use the same shape with an error field instead:

{
  "error": {
    "code": "unauthorized",
    "message": "Missing or invalid API key."
  }
}

The code field is stable — switch on it in your code. See the full error reference for every code and how to recover.

What to explore next

Quickstart FAQ

Do I need an SDK to call the Markdown Viewer API?
No — it's a plain REST API. Anything that speaks HTTPS works: curl, fetch in JavaScript or TypeScript, requests in Python, Go's net/http, Ruby's Net::HTTP, etc. We give you snippets for all the common languages.
Where do I find my API key?
Sign in and open the API Keys page from your dashboard. Click 'New key', give it a label, and copy the secret. The full key is shown exactly once — store it in a secrets manager.
Can I test the API without writing code?
Yes. The playground at /api/playground lets you call any endpoint with your own key. Errors there link straight back to the matching docs entry.
What's the request format?
Send a POST with Content-Type: application/json, an Authorization: Bearer <YOUR_KEY> header, and a JSON body containing the markdown field. The response is always wrapped in { data: … } on success or { error: { code, message } } on failure.
Is the API safe to expose from a browser?
Treat API keys like passwords — never embed them in client-side code. For browser use cases, call your own backend which holds the key and forwards requests to the Markdown Viewer API.