# Markdown Link Extractor API

> Markdown Link Extractor parses markdown documents and extracts all links including inline, reference, autolinks, and image URLs.

**Endpoint:** `POST https://api.apiverve.com/v1/markdownlinkextractor`  
**Category:** Text Processing  
**Cost:** 2 credits per call  
**Canonical page:** https://apiverve.com/marketplace/markdownlinkextractor

## Overview

Perfect for markdown documentation analysis, link validation, SEO audits, and extracting references from markdown content.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/markdownlinkextractor" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"markdown":"# Sample Document\n\nCheck out [this link](https://example.com) and [another one](https://test.com).\n\n![Image](https://example.com/image.png)\n\nVisit <https://autolink.com> or just https://bare-url.com\n\n[Reference link][ref1]\n\n[ref1]: https://reference.com"}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `markdown` | string | Yes | Markdown text to parse (max 100,000 characters) |

## Response fields

- `totalLinks` — number · Total number of unique links found in the markdown after removing duplicate URLs
  - `links.0.text` — string · The visible label for the link: the link text, the image alt text, or the URL itself for autolinks and bare URLs
  - `links.0.url` — string · The destination the link points to
  - `links.0.type` — string · How the link is written in the markdown: inline ([text](url)), reference ([text][ref]), autolink (<url>), bare (a plain URL with no markdown syntax), or image (![alt](url))
- `categories` — object · Links grouped by destination: internal, external, email, and other
  - `categories.internal` — object · Links whose URL is a page anchor (#) or a relative path (starting with / or ./)
    - `categories.internal.count` — number · Number of internal links found · (premium)
    - `categories.internal.links` — array · The internal links themselves
  - `categories.external` — object · Links whose URL starts with http:// or https://
    - `categories.external.count` — number · Number of external links found · (premium)
      - `categories.external.links.0.text` — string
      - `categories.external.links.0.url` — string
      - `categories.external.links.0.type` — string
  - `categories.email` — object · Links whose URL is a mailto: address
    - `categories.email.count` — number · Number of email links found
    - `categories.email.links` — array · The email links themselves
  - `categories.other` — object · Links that don't match the internal, external, or email patterns
    - `categories.other.count` — number · Number of other links found
    - `categories.other.links` — array · The other links themselves
- `markdownLength` — number · Length of the input markdown string, in characters

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "totalLinks": 6,
    "links": [
      {
        "text": "this link",
        "url": "https://example.com",
        "type": "inline"
      },
      {
        "text": "another one",
        "url": "https://test.com",
        "type": "inline"
      },
      {
        "text": "Image",
        "url": "https://example.com/image.png",
        "type": "inline"
      },
      {
        "text": "Reference link",
        "url": "https://reference.com",
        "type": "reference",
        "reference": "ref1"
      },
      {
        "text": "https://autolink.com",
        "url": "https://autolink.com",
        "type": "autolink"
      },
      {
        "text": "https://bare-url.com",
        "url": "https://bare-url.com",
        "type": "bare"
      }
    ],
    "categories": {
      "internal": {
        "count": 0,
        "links": []
      },
      "external": {
        "count": 6,
        "links": [
          {
            "text": "this link",
            "url": "https://example.com",
            "type": "inline"
          },
          {
            "text": "another one",
            "url": "https://test.com",
            "type": "inline"
          },
          {
            "text": "Image",
            "url": "https://example.com/image.png",
            "type": "inline"
          },
          {
            "text": "Reference link",
            "url": "https://reference.com",
            "type": "reference",
            "reference": "ref1"
          },
          {
            "text": "https://autolink.com",
            "url": "https://autolink.com",
            "type": "autolink"
          },
          {
            "text": "https://bare-url.com",
            "url": "https://bare-url.com",
            "type": "bare"
          }
        ]
      },
      "email": {
        "count": 0,
        "links": []
      },
      "other": {
        "count": 0,
        "links": []
      }
    },
    "markdownLength": 253
  }
}
```

## Use cases

- **Documentation Analysis** — Extract and validate all links from markdown documentation
- **SEO Auditing** — Identify internal and external links in markdown content for SEO optimization
- **Content Migration** — Extract URLs when migrating markdown content between platforms
- **Link Validation** — Generate comprehensive lists of links for automated link checking

## SDKs

- **npm** — `npm install @apiverve/markdownlinkextractor` (https://www.npmjs.com/package/@apiverve/markdownlinkextractor)
- **NuGet** — `dotnet add package APIVerve.API.MarkdownLinkExtractor` (https://www.nuget.org/packages/APIVerve.API.MarkdownLinkExtractor)
- **Source** — https://github.com/apiverve/markdownlinkextractor-api

## More

- Full reference: https://docs.apiverve.com/ref/markdownlinkextractor
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
