SyntaxdocSyntaxdoc

Billing & Plans

Understand SyntaxDoc plans, usage limits, and billing

SyntaxDoc offers three plans to fit your needs, from hobby projects to enterprise-scale applications.

Plans Overview

FeatureHobby (Free)Pro ($29/mo)Enterprise ($99/mo)
Conversions/month10010,000Unlimited
Hosted PDFs1050010,000
PDF Retention1 day7 days30 days
API KeysUp to 10Up to 10Up to 10
SupportCommunityEmailPriority 24/7

All plans include the same PDF generation features. The difference is in volume limits and retention periods.


Understanding Limits

Conversions

A conversion is counted each time you successfully generate a PDF using the /pdf/generate, /pdf/merge, or /pdf/generate-batch endpoints.

  • Only successful requests (HTTP 2xx) count against your quota
  • Failed requests (4xx, 5xx errors) do not count
  • Batch requests: Each PDF in the batch counts as 1 conversion (e.g., generating 50 PDFs = 50 conversions)
  • The API validates you have enough conversions available before starting a batch

Important: When using /pdf/generate-batch, each document counts as a separate conversion. A batch of 100 PDFs will use 100 conversions from your limit.

Hosted PDFs

Hosted PDFs are PDFs stored on our servers with shareable URLs. The limit is the maximum number of PDFs you can have hosted at any given time.

  • Generating a PDF with host: true creates a hosted PDF
  • Expired PDFs are automatically deleted and don't count against your limit
  • You can manually delete hosted PDFs to free up space

Retention Period

The retention period is how long hosted PDFs remain accessible before automatic deletion.

PlanRetention
Hobby1 day
Pro7 days
Enterprise30 days

Billing API

Get Current Subscription

View your current plan and usage statistics.

Endpoint: GET /api/billing/subscription

Authentication: Session cookie (logged-in user)

Response:

{
  "success": true,
  "data": {
    "plan": "pro",
    "planName": "Pro",
    "status": "active",
    "price": 29,
    "conversionsLimit": 10000,
    "conversionsUsed": 1234,
    "conversionsRemaining": 8766,
    "usagePercentage": 12,
    "hostedPdfsLimit": 500,
    "hostedPdfsUsed": 45,
    "hostedPdfsPercentage": 9,
    "retentionDays": 7,
    "currentPeriodStart": "2024-12-01T00:00:00.000Z",
    "currentPeriodEnd": "2024-12-31T23:59:59.000Z",
    "daysRemaining": 25,
    "cancelAtPeriodEnd": false
  }
}

Get Usage Analytics

Get detailed usage statistics for your account.

Endpoint: GET /api/billing/usage

Query Parameters:

ParameterTypeDefaultDescription
periodstring"7d"Time period: 7d, 30d, 90d
pagenumber1Page number for recent usage
limitnumber10Items per page

Response:

{
  "success": true,
  "data": {
    "period": "7d",
    "totalConversions": 156,
    "dailyUsage": {
      "2024-12-01": 25,
      "2024-12-02": 32,
      "2024-12-03": 18,
      "2024-12-04": 41,
      "2024-12-05": 40
    },
    "endpointBreakdown": {
      "/pdf/generate": 120,
      "/pdf/generate-batch": 30,
      "/pdf/merge": 6
    },
    "recentUsage": [
      {
        "name": "invoice-december",
        "endpoint": "/pdf/generate",
        "method": "POST",
        "statusCode": 200,
        "timestamp": "2024-12-05T14:32:00.000Z",
        "metadata": {
          "fileName": "invoice-december"
        }
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 10,
      "total": 156,
      "totalPages": 16
    }
  }
}

Get Available Plans

List all available plans and their features.

Endpoint: GET /api/billing/plans

Authentication: None required

Response:

{
  "success": true,
  "data": [
    {
      "id": "hobby",
      "name": "Hobby",
      "price": 0,
      "conversionsLimit": 100,
      "hostedPdfsLimit": 10,
      "retentionDays": 1
    },
    {
      "id": "pro",
      "name": "Pro",
      "price": 29,
      "conversionsLimit": 10000,
      "hostedPdfsLimit": 500,
      "retentionDays": 7
    },
    {
      "id": "enterprise",
      "name": "Enterprise",
      "price": 99,
      "conversionsLimit": 999999,
      "hostedPdfsLimit": 10000,
      "retentionDays": 30
    }
  ]
}

Change Plan

Upgrade or downgrade your subscription.

Endpoint: POST /api/billing/subscription/change-plan

Authentication: Session cookie (logged-in user)

Request Body:

{
  "plan": "pro"
}
ParameterTypeRequiredDescription
planstringYesTarget plan: hobby, pro, or enterprise

Response:

{
  "success": true,
  "data": {
    "plan": "pro",
    "planName": "Pro",
    "status": "active",
    "price": 29,
    "conversionsLimit": 10000,
    "conversionsUsed": 1234,
    "conversionsRemaining": 8766,
    ...
  },
  "message": "Successfully changed plan to Pro"
}

You cannot downgrade if your current usage exceeds the new plan's limits. Delete hosted PDFs or wait for the billing period to reset before downgrading.


Cancel Subscription

Cancel your paid subscription at the end of the billing period.

Endpoint: POST /api/billing/subscription/cancel

Authentication: Session cookie (logged-in user)

Response:

{
  "success": true,
  "message": "Subscription will be canceled at the end of the billing period",
  "data": {
    "cancelAtPeriodEnd": true,
    "endsOn": "2024-12-31T23:59:59.000Z"
  }
}

Cancellation takes effect at the end of your current billing period. You retain access to Pro/Enterprise features until then.


Usage Tracking in Responses

All successful PDF generation endpoints track usage automatically. You can see usage metadata in the response headers or by checking the billing endpoint.

Example: Checking Remaining Quota

// Generate a PDF
const response = await fetch('https://api.syntaxdoc.com/pdf/generate', {
  method: 'POST',
  headers: { 'X-API-Key': 'sk_live_your_api_key' },
  body: formData
});

// Check your usage after
const usageResponse = await fetch('https://api.syntaxdoc.com/api/billing/subscription', {
  credentials: 'include' // Include session cookie
});

const { data } = await usageResponse.json();
console.log(`Used: ${data.conversionsUsed}/${data.conversionsLimit}`);
console.log(`Remaining: ${data.conversionsRemaining}`);

Handling Quota Exceeded

When you exceed your plan limits, the API returns a 429 status code:

{
  "statusCode": 429,
  "code": "QUOTA_EXCEEDED",
  "message": "API usage limit exceeded. Please upgrade your plan."
}

Solutions:

  1. Upgrade your plan via the dashboard or API
  2. Wait for the billing period to reset (usage resets monthly)
  3. Contact support for custom enterprise limits

API Key Management

List API Keys

Endpoint: GET /api/keys

Response:

{
  "success": true,
  "data": [
    {
      "id": "key-id-123",
      "name": "Production Key",
      "prefix": "sk_live",
      "lastFour": "abc1",
      "masked": "sk_live_********************abc1",
      "lastUsed": "2024-12-05T14:32:00.000Z",
      "usageCount": 1234,
      "createdAt": "2024-11-01T00:00:00.000Z",
      "expiresAt": null,
      "isActive": true
    }
  ]
}

Create API Key

Endpoint: POST /api/keys

Request Body:

{
  "name": "Production Key",
  "expiresInDays": 365
}

Response:

{
  "success": true,
  "data": {
    "id": "key-id-456",
    "name": "Production Key",
    "key": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "prefix": "sk_live",
    "createdAt": "2024-12-05T14:32:00.000Z",
    "expiresAt": "2025-12-05T14:32:00.000Z",
    "usageCount": 0,
    "isActive": true
  },
  "message": "API key created successfully. Save this key securely - you won't be able to see it again."
}

The full API key is only shown once at creation time. Store it securely!


Update API Key

Endpoint: PATCH /api/keys/:id

Request Body:

{
  "name": "New Key Name"
}

Revoke API Key

Endpoint: DELETE /api/keys/:id

Response:

{
  "success": true,
  "message": "API key revoked successfully"
}

Billing Period

  • Billing periods are 30 days from your subscription start date
  • Conversions reset at the start of each billing period
  • Hosted PDFs do not reset - they persist until they expire or are deleted
  • Plan changes take effect immediately

On this page