API Documentation

The markdown.market REST API lets agents and automation tools search, browse, purchase, and download assets programmatically.

Authentication

All API requests require an API key passed in the Authorization header.

Header Format
Authorization: Bearer mk_live_your_api_key_here

Generate your API key in Dashboard Settings.

Rate Limits

API requests are limited to 60 requests per minute per API key. Rate limit status is returned in response headers:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1708891200

Response Format

Success

{
  "data": { ... },
  "meta": { "page": 1, "total": 42 }
}

Error

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Asset not found"
  }
}

Endpoints

GET/api/v1/me

Get your profile information.

Request
curl -H "Authorization: Bearer mk_live_..." \
  https://markdown.market/api/v1/me
Response
{
  "data": {
    "id": "user_abc123",
    "displayName": "Agent Smith",
    "role": "buyer"
  }
}
GET/api/v1/assets

Search and browse published assets.

Parameters: q, fileType, minPrice, maxPrice, sort (newest|popular|price_asc|price_desc), page

Request
curl -H "Authorization: Bearer mk_live_..." \
  "https://markdown.market/api/v1/assets?q=stripe&fileType=mcp_protocol"
Response
{
  "data": [
    {
      "slug": "stripe-mcp-server-a1b2c3d4",
      "title": "Stripe MCP Protocol",
      "price": "$4.00",
      "avgRating": 4.8,
      "downloads": 342
    }
  ],
  "meta": { "page": 1, "pageSize": 24, "total": 12 }
}
GET/api/v1/assets/:slug

Get detailed information about a specific asset.

Request
curl -H "Authorization: Bearer mk_live_..." \
  https://markdown.market/api/v1/assets/stripe-mcp-server-a1b2c3d4
Response
{
  "data": {
    "slug": "stripe-mcp-server-a1b2c3d4",
    "title": "Stripe MCP Protocol",
    "description": "Full Stripe integration...",
    "price": "$4.00",
    "tags": ["stripe", "payments"],
    "verificationPassed": true,
    "previewContent": "{ \"tools\": [..."
  }
}
POST/api/v1/assets/:slug/purchase

Initiate a purchase. Returns a Stripe Checkout URL.

Request
curl -X POST -H "Authorization: Bearer mk_live_..." \
  https://markdown.market/api/v1/assets/stripe-mcp-server-a1b2c3d4/purchase
Response
{
  "data": {
    "checkoutUrl": "https://checkout.stripe.com/c/pay/..."
  }
}
GET/api/v1/assets/:slug/download

Get a signed download URL for a purchased asset.

Request
curl -H "Authorization: Bearer mk_live_..." \
  https://markdown.market/api/v1/assets/stripe-mcp-server-a1b2c3d4/download
Response
{
  "data": {
    "downloadUrl": "https://...r2.cloudflarestorage.com/..."
  }
}
GET/api/v1/purchases

List your purchase history.

Request
curl -H "Authorization: Bearer mk_live_..." \
  https://markdown.market/api/v1/purchases
Response
{
  "data": [
    {
      "id": "purchase_abc",
      "assetSlug": "stripe-mcp-server-a1b2c3d4",
      "assetTitle": "Stripe MCP Protocol",
      "price": "$4.00",
      "purchasedAt": "2025-06-15T..."
    }
  ],
  "meta": { "total": 3 }
}

Error Codes

CodeStatusDescription
UNAUTHORIZED401Missing or invalid API key
FORBIDDEN403Insufficient permissions
NOT_FOUND404Resource not found
RATE_LIMITED429Too many requests
VALIDATION_ERROR400Invalid request parameters
STRIPE_UNAVAILABLE503Payment service not configured