Muro
API reference

API: get started

Create and manage Muro Links from code with the public REST API.

The Muro API lets you create, update and delete short links, manage tags and UTM templates, and read link click stats from your own code. Use it to generate tracked links in bulk, from a CMS or newsletter tool, or from a script.

What the API covers

The public API is the Muro Links API:

  • Links: create, list, fetch, update and delete short links, including an idempotent upsert and lookups by your own ID.
  • Tags: create, list, rename, recolour and delete tags.
  • UTM templates: create, list, update and delete saved UTM presets.
  • Stats: click analytics for one link, one tag, or your whole account.

There's no API for website analytics (pageviews, visitors, goals or insights) yet. The API covers Muro Links only.

Plan requirement

API access needs the Team plan or a free trial. On Starter, Settings → API Keys shows API access not included and an Upgrade button. See Plans.

Base URL

https://app.muroanalytics.com/api/v1

All requests and responses use JSON. Timestamps are Unix time in milliseconds.

Generate an API key

Open API Keys

In Muro, go to Settings → API Keys.

Generate the key

Click Generate API Key.

Copy it now

Copy the key from the dialog. Copy this key now — it will not be shown again. Store it like a password, for example in your server's environment, never in browser code or a public repository.

Keys start with muro_lnk_. Your account has one key at a time, and it has full access to your account's links, tags and UTM templates. See Authentication, limits and errors for revoking and replacing a key.

Make your first request

List your links:

curl https://app.muroanalytics.com/api/v1/links \
  -H "Authorization: Bearer muro_lnk_xxxxxxxxxxxx"
{
  "links": [],
  "page": 1,
  "per_page": 20,
  "total": 0,
  "link_limit": 500
}
curl -X POST https://app.muroanalytics.com/api/v1/links \
  -H "Authorization: Bearer muro_lnk_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Product Hunt launch",
    "destination_url": "https://yourapp.com",
    "slug": "ph-launch",
    "utm": { "source": "producthunt", "medium": "community", "campaign": "launch" },
    "tag_names": ["launch"]
  }'
const res = await fetch("https://app.muroanalytics.com/api/v1/links", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MURO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    title: "Product Hunt launch",
    destination_url: "https://yourapp.com",
    slug: "ph-launch",
    utm: { source: "producthunt", medium: "community", campaign: "launch" },
    tag_names: ["launch"],
  }),
});

if (!res.ok) {
  const { error } = await res.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const link = await res.json();
console.log(link.short_url);

The response is 201 Created with the new link:

{
  "id": "lnk_3f2c9a1e-8b7d-4c61-9e0a-5d4b2f1c7a90",
  "short_url": "https://muro.ink/ph-launch",
  "destination_url": "https://yourapp.com/?utm_source=producthunt&utm_medium=community&utm_campaign=launch",
  "title": "Product Hunt launch",
  "slug": "ph-launch",
  "tags": [{ "id": "tag_6a1d0c2b-4e8f-4b3a-9c7d-1e2f3a4b5c6d", "name": "launch", "color": "indigo" }],
  "click_count": 0,
  "created_at": 1791734400000
}

Verify it works

  1. Open the short_url from the response in a browser. You land on the destination.
  2. In Muro, open Links. The new link is in the table with its tag.

Next steps

On this page