Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/MatthewSabia1/SubPirate-Pro/llms.txt

Use this file to discover all available pages before exploring further.

Overview

These endpoints allow administrators to view and update subscription plan configurations. Access is restricted to users with the is_admin flag set to true in their profile.

Authentication

All admin endpoints require:
  1. Valid authentication via Bearer token (Supabase JWT)
  2. Admin privileges - user must have is_admin = true in the profiles table

Admin Authentication Example

curl https://api.subpirate.com/api/admin/plans \
  -H "Authorization: Bearer YOUR_SUPABASE_JWT_TOKEN"

Get All Plans

GET /api/admin/plans
endpoint
Retrieve all subscription plans including hidden plans

Request

curl https://api.subpirate.com/api/admin/plans \
  -H "Authorization: Bearer YOUR_SUPABASE_JWT_TOKEN"

Response

Returns all plans from the plan_definitions table, ordered by sort_order.
plans
array
required
Array of plan definition objects
plans[].tier
string
required
Plan tier identifier (e.g., "free", "pro", "enterprise")
plans[].name
string
required
Display name of the plan
plans[].description
string
Plan description text
plans[].price_monthly_cents
number
Monthly price in cents (e.g., 2900 for $29.00)
plans[].price_annual_cents
number
Annual price in cents
plans[].max_analyses_per_month
number
Maximum subreddit analyses allowed per month
plans[].max_reddit_accounts
number
Maximum connected Reddit accounts
plans[].max_campaigns
number
Maximum active campaigns
plans[].max_projects
number
Maximum projects
plans[].has_ai_posting_scheduler
boolean
Whether AI posting scheduler is enabled
plans[].has_advanced_competitor_dashboard
boolean
Whether advanced competitor dashboard is enabled
plans[].has_team_access
boolean
Whether team collaboration features are enabled
plans[].features
array
Array of feature descriptions for display
plans[].badge_text
string
Badge text (e.g., "Most Popular")
plans[].cta_text
string
Call-to-action button text
plans[].cta_url
string
Call-to-action URL
plans[].is_contact_only
boolean
Whether this plan requires contacting sales
plans[].is_visible
boolean
Whether plan is visible to public users
plans[].sort_order
number
Display order (lower numbers first)

Success Response (200)

{
  "plans": [
    {
      "tier": "free",
      "name": "Free",
      "description": "Perfect for getting started",
      "price_monthly_cents": 0,
      "price_annual_cents": 0,
      "max_analyses_per_month": 5,
      "max_reddit_accounts": 1,
      "max_campaigns": 1,
      "max_projects": 3,
      "has_ai_posting_scheduler": false,
      "has_advanced_competitor_dashboard": false,
      "has_team_access": false,
      "features": ["5 subreddit analyses/month", "1 Reddit account"],
      "badge_text": null,
      "cta_text": "Get Started",
      "cta_url": "/signup",
      "is_contact_only": false,
      "is_visible": true,
      "sort_order": 1
    },
    {
      "tier": "pro",
      "name": "Pro",
      "description": "For serious Reddit marketers",
      "price_monthly_cents": 2900,
      "price_annual_cents": 29000,
      "max_analyses_per_month": 100,
      "max_reddit_accounts": 5,
      "max_campaigns": 10,
      "max_projects": 20,
      "has_ai_posting_scheduler": true,
      "has_advanced_competitor_dashboard": true,
      "has_team_access": false,
      "features": ["100 analyses/month", "AI posting scheduler"],
      "badge_text": "Most Popular",
      "cta_text": "Start Free Trial",
      "cta_url": "/pricing",
      "is_contact_only": false,
      "is_visible": true,
      "sort_order": 2
    }
  ]
}

Update Plan

PUT /api/admin/plans/:tier
endpoint
Update an existing subscription plan

Path Parameters

tier
string
required
The tier identifier of the plan to update (e.g., "pro", "enterprise")

Request Body

Provide only the fields you want to update. All fields are optional.
name
string
Plan display name
description
string
Plan description
price_monthly_cents
number
Monthly price in cents
price_annual_cents
number
Annual price in cents
max_analyses_per_month
number
Maximum analyses per month
max_reddit_accounts
number
Maximum Reddit accounts
max_campaigns
number
Maximum campaigns
max_projects
number
Maximum projects
has_ai_posting_scheduler
boolean
Enable AI posting scheduler
has_advanced_competitor_dashboard
boolean
Enable advanced competitor dashboard
has_team_access
boolean
Enable team collaboration features
features
array
Array of feature strings for display
badge_text
string
Badge text (e.g., “Most Popular”)
cta_text
string
Call-to-action button text
cta_url
string
Call-to-action URL
is_contact_only
boolean
Whether plan requires contacting sales
is_visible
boolean
Whether plan is visible to public
sort_order
number
Display order

Request Example

curl -X PUT https://api.subpirate.com/api/admin/plans/pro \
  -H "Authorization: Bearer YOUR_SUPABASE_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "price_monthly_cents": 3900,
    "max_analyses_per_month": 150,
    "badge_text": "Best Value"
  }'

Response

Returns the updated plan object.
plan
object
required
The updated plan definition object with all fields

Success Response (200)

{
  "plan": {
    "tier": "pro",
    "name": "Pro",
    "description": "For serious Reddit marketers",
    "price_monthly_cents": 3900,
    "price_annual_cents": 29000,
    "max_analyses_per_month": 150,
    "max_reddit_accounts": 5,
    "max_campaigns": 10,
    "max_projects": 20,
    "has_ai_posting_scheduler": true,
    "has_advanced_competitor_dashboard": true,
    "has_team_access": false,
    "features": ["150 analyses/month", "AI posting scheduler"],
    "badge_text": "Best Value",
    "cta_text": "Start Free Trial",
    "cta_url": "/pricing",
    "is_contact_only": false,
    "is_visible": true,
    "sort_order": 2,
    "updated_at": "2026-03-02T10:35:00.000Z"
  }
}

Error Responses

401 Unauthorized

Returned when no valid authentication token is provided.
{
  "error": "Missing Authorization bearer token"
}

403 Forbidden

Returned when the authenticated user does not have admin privileges.
{
  "error": "Admin access required"
}

400 Bad Request

Returned when the request is malformed or missing required parameters.
{
  "error": "No valid fields to update"
}

404 Not Found

Returned when attempting to update a plan tier that doesn’t exist.
{
  "error": "Plan tier not found"
}

500 Internal Server Error

{
  "error": "Failed to load plans"
}

Notes

  • The tier field cannot be changed via this endpoint (it’s the primary key)
  • The updated_at timestamp is automatically set when updating a plan
  • Changes to plan definitions affect all users immediately
  • Consider caching implications when updating pricing or limits
  • Always test changes in a non-production environment first

Security Considerations

  • Admin endpoints use the service role Supabase client to bypass RLS
  • Ensure the is_admin flag in the profiles table is properly secured
  • Audit all admin actions for compliance and security monitoring
  • Implement additional logging for plan changes in production

Build docs developers (and LLMs) love