Templates

Templates

Templates are pre-built paywall schemas that serve as starting points. They provide a complete, valid schema that you can use as-is or customize for your app.

Available Templates

basic-subscription

A simple modal paywall with a title, product picker, CTA button, and footer links. Good for straightforward subscription offers.

Presentation: Modal

{
  "version": "1.0",
  "settings": {
    "presentation": "modal",
    "close_button": true,
    "close_button_delay_ms": 0
  },
  "components": [
    {
      "type": "text",
      "id": "title",
      "props": { "content": "Upgrade to Pro", "text_style": "title" }
    },
    {
      "type": "product_picker",
      "id": "products",
      "props": { "layout": "vertical" }
    },
    {
      "type": "cta_button",
      "id": "cta",
      "props": { "text": "Subscribe", "action": "purchase" }
    },
    {
      "type": "link_row",
      "id": "links",
      "props": {
        "links": [
          { "text": "Restore Purchases", "action": "restore" },
          { "text": "Terms", "action": "open_url", "url": "/terms" }
        ]
      }
    }
  ]
}

feature-gate

A sheet-style paywall for gating specific features. Includes a feature list to show what the user will unlock.

Presentation: Sheet

{
  "version": "1.0",
  "settings": {
    "presentation": "sheet",
    "close_button": true,
    "close_button_delay_ms": 0
  },
  "components": [
    {
      "type": "text",
      "id": "title",
      "props": { "content": "Unlock This Feature", "text_style": "title" }
    },
    {
      "type": "feature_list",
      "id": "features",
      "props": {
        "items": [
          { "icon": "checkmark", "text": "Feature 1" }
        ]
      }
    },
    {
      "type": "cta_button",
      "id": "cta",
      "props": { "text": "Unlock Now", "action": "purchase" }
    }
  ]
}

trial-offer

A fullscreen paywall promoting a free trial. Features a delayed close button (3 seconds) to increase engagement.

Presentation: Fullscreen with delayed close

{
  "version": "1.0",
  "settings": {
    "presentation": "fullscreen",
    "close_button": true,
    "close_button_delay_ms": 3000
  },
  "components": [
    {
      "type": "text",
      "id": "title",
      "props": { "content": "Start Your Free Trial", "text_style": "title" }
    },
    {
      "type": "text",
      "id": "subtitle",
      "props": { "content": "7 days free, then $9.99/month", "text_style": "subtitle" }
    },
    {
      "type": "feature_list",
      "id": "features",
      "props": { "items": [] }
    },
    {
      "type": "cta_button",
      "id": "cta",
      "props": { "text": "Start Free Trial", "action": "purchase" }
    }
  ]
}

Using Templates

Via API

curl -X POST https://agentwallie.com/api/v1/projects/PROJECT_ID/paywalls/from-template \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk_your_private_key" \
  -d '{
    "template_id": "basic-subscription",
    "name": "My Subscription Paywall",
    "slug": "my-subscription"
  }'

Via MCP

agentwallie_create_from_template(
  project_id: "PROJECT_ID",
  template_id: "trial-offer",
  name: "Onboarding Trial",
  overrides: {
    "theme": {
      "primary": "#E94560",
      "background": "#1A1A2E"
    }
  }
)

Listing Templates

# Via API
curl https://agentwallie.com/api/v1/templates
 
# Via MCP Resource
# Read agentwallie://project/{id}/templates

Creating Custom Templates

Templates are simply paywall schemas stored in the database. To create a reusable template:

  1. Design your paywall schema using the schema reference
  2. Create it via the API
  3. Test it by presenting it in the SDK
  4. Save the schema as a template for future use

When using the overrides parameter with agentwallie_create_from_template, top-level fields in the override object are merged with the template schema. This lets you customize the theme, settings, or other fields without rewriting the entire schema.

Template Design Tips

  • Use theme tokens ({{ theme.primary }}) instead of hard-coded colors so templates adapt to different brands
  • Include all standard components: title, feature list, product picker, CTA, and legal links
  • Set sensible defaults for close_button_delay_ms based on the paywall's aggressiveness
  • Keep product slots generic (primary, secondary) so templates work with any product configuration