Example Usage

curl -X POST https://n2m.xyz/api/export \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "pageId": "14574963e876806da7bffffdf5592161",
    "frontmatter": {
      "format": "yaml",
      "delimiter": "---",
      "nameMapping": {
        "Title": "title",
        "Categories": "tags"
      }
    }
  }'

API Documentation

Export Endpoint

# The endpoint for exporting Notion pages
POST /api/export

Authentication

# Include your API key in the Authorization header as a Bearer token
Authorization: Bearer <api-key>

Request Body

/// Required: Notion page ID
pageId: string
/// Optional: Frontmatter configuration object
frontmatter: {
  /// Object mapping Notion property names to frontmatter field names
  nameMapping: Record<string, string>
  /// Character(s) used to separate frontmatter from content
  delimiter: string
  /// Format of the frontmatter
  format: "yaml" | "toml"
}

Response

/// Success (200 OK)
{
  /// Markdown content
  markdown: string
  /// Notion properties array
  properties: {
    /// Display name of the property
    name: string
    /// Type of the property
    type: "title" | "rich_text" | "multi_select" | "select" | "number" | "checkbox" | "date"
    /// Value of the property
    value: string | string[] | number | boolean | string | string[] | null
  }[]
}

Error Codes

/// Unauthorized
401
/// Bad Request
400
/// Export Limit Exceeded
403
/// Server Error
500