---
title: "Courses - Sell Gated Courses in Your Discord (with an API)"
description: "Build courses that reward members with roles and unlock channels on completion. Create them in Discord, or point your AI agent at the PayBot Courses API to build them for you."
canonical: https://paybotapp.com/docs/courses/
source: /docs/courses/
---

[Home](https://paybotapp.com/) / [Docs](https://paybotapp.com/docs/) / Courses

# Courses

Teach your members something, then reward them for finishing. Courses live inside your Discord and can grant a role or unlock private channels on completion.

## Table of Contents

-   [What are Courses?](#what-is-it)
-   [Building a Course in Discord](#building)
-   [Completion Rewards & Unlocks](#rewards)
-   [Build Courses with Your Agent (API)](#api)
-   [Getting an API Key](#api-key)
-   [A Worked Example](#api-example)
-   [Limits](#limits)

## What are Courses?

A course is a sequence of **modules**, each made of **content blocks**—text, headings, videos, images, links, and resource lists. Members work through the modules, and when they finish, PayBot can grant them a role, add a badge to their nickname, and open up private channels.

#### 🎓 For your members

A clean, mobile-friendly course page. They read, watch, and tick off modules at their own pace—and earn access when they're done.

#### 🔓 For you

Courses become a gate. Finish the onboarding course → get the `Verified` role → see the members-only channels. Knowledge and access, tied together.

**How a course flows:**

1.  A member opens your course and works through its modules
2.  Each module is a set of content blocks (text, video, links, …)
3.  On completion, PayBot grants the completion role and any unlocks
4.  Optionally, completion is announced in a public feed and a discussion forum opens up

## Building a Course in Discord

Everything is managed from one command.

**Prerequisites:** Complete the [initial PayBot setup](https://paybotapp.com/docs/setup/) (connect Stripe) first.

1

### Open the course admin

Run `/courses-admin` in your server.

`/courses-admin`

2

### Create a course and add modules

Give it a name and description, then add modules. Each module holds an ordered list of content blocks.

3

### Fill modules with content

Add blocks to each module:

-   **Heading** & **Paragraph** — your written lesson
-   **Video** — embed a YouTube/Vimeo link
-   **Image** — with optional caption
-   **Link** — a titled external link
-   **Resource list** — a tidy list of links
-   **Discussion prompt** — links to the module's forum thread

4

### Publish

A course starts as a **draft** (only you can see it). Set it to **published** when it's ready. Each course gets a shareable page at `go.paybotapp.com/c/yourcode`.

## Completion Rewards & Unlocks

This is what makes a course more than just reading material.

#### 🏅 Completion role

Grant a Discord role the moment a member finishes. Optionally append a badge to their nickname (e.g. `📈 Chartist`).

#### 🔓 Unlocks

Open private channels, grant bonus roles, or add members to threads on completion. Channel unlocks are gated to the completion role automatically.

#### 🪜 Prerequisites

Require members to finish one course before another unlocks. Build a learning path.

#### 💬 Discussion forum

Turn on discussion and PayBot creates a forum for the course, with one thread per module for Q&A.

**Sequential mode:** Lock modules so they unlock in order—members can't skip ahead until they've completed the previous one.

## Build Courses with Your Agent (API)

Courses are valuable but tedious to build by hand—lots of modules, lots of blocks. So PayBot has an HTTP API designed for **your own AI agent** (ChatGPT, Claude, or any tool that can call an API) to build the whole course for you.

**The short version:** get an API key, then point your agent at [`go.paybotapp.com/llms.txt`](https://go.paybotapp.com/llms.txt). That page tells the agent everything it needs—the endpoints, the course format, and a worked example. Ask it to "build a course on X" and it assembles the modules and blocks in one request.

### What your agent can build

Anything the in-Discord builder can: multiple modules, all the content block types (including embedded videos), the completion role and nickname badge, channel and role unlocks, and prerequisites. One `POST` creates the entire course at once.

### Using an MCP agent? Even easier.

If your agent speaks the **Model Context Protocol** (Claude Desktop, Cursor, Claude Code, and others), connect it to PayBot's MCP server instead. The course-building tools become *self-describing*—your agent sees them with full typed inputs and doesn't need to read any docs. Point it at:

`https://go.paybotapp.com/api/v1/mcp`

…with your `pbk_live_` key as a `Bearer` token, and ask it to build a course. Same key, same limits.

## Getting an API Key

1

Run `/courses-admin` → **API Access** → **Create API Key**.

2

Copy the key (it starts with `pbk_live_`). It's shown **once**—store it somewhere safe.

3

Give it to your agent. The key is scoped to *this one server* and only touches its courses.

**Keep it secret.** Anyone with the key can create and delete courses in your server. You can revoke a key any time from the same **API Access** screen.

## A Worked Example

A course is described by one JSON document. Here's a minimal one (`course.json`):

```
{
  "name": "Intro to Candlestick Charts",
  "description": "A short primer for new traders.",
  "visibility": "draft",
  "completion": {
    "role_id": "123456789012345678",
    "suffix": "📈 Chartist"
  },
  "unlocks": [
    { "target_type": "channel", "target_id": "222333444555666777" }
  ],
  "modules": [
    {
      "name": "What is a candle?",
      "estimated_time_minutes": 8,
      "blocks": [
        { "block_type": "heading",    "content": { "text": "Anatomy of a candle" } },
        { "block_type": "paragraph",  "content": { "text": "Each candle encodes four prices: open, high, low, close." } },
        { "block_type": "video_embed", "content": { "url": "https://youtube.com/watch?v=abc" } }
      ]
    }
  ]
}
```

Send it with your key:

```
curl -X POST https://go.paybotapp.com/api/v1/courses \
  -H "Authorization: Bearer pbk_live_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d @course.json
```

The response includes the assigned course code; the course is live at `go.paybotapp.com/c/{code}` once you publish it. Your agent can read the full block format, every field, and all the endpoints at [`go.paybotapp.com/llms.txt`](https://go.paybotapp.com/llms.txt). There's also a machine-readable OpenAPI spec at [`go.paybotapp.com/api/v1/openapi.json`](https://go.paybotapp.com/api/v1/openapi.json).

## Limits

To keep things sane, the API has a few guardrails (these are generous—they're here to prevent abuse, not to cap real use):

#### 📦 Size

-   20 courses per server
-   25 modules per course
-   20 blocks per module

#### ⏱️ Rate

-   30 requests per minute, per key

## Related Documentation

[

#### Membership Tiers

Charge for access to your community

](https://paybotapp.com/docs/membership-tiers/)[

#### Role Management

How PayBot grants and removes roles

](https://paybotapp.com/docs/role-management/)[

#### Setup Guide

Connect Stripe and get started

](https://paybotapp.com/docs/setup/)
