Founding churches get 50% off for 12 monthsFounding churches: 50% offApply as a founding churchApply

Quickstart

In about five minutes you will add a teaching, wait for it to be prepared, read what Lectern made from it, and ask a question that answers with citations.

Before you start

  • A Lectern API key with the scopes teachings:read, teachings:ingest, notes:read, scripture:read and ask:use.
  • Your church slug and your Lectern API address.
  • Node.js 20 or newer, Python 3.10 or newer with requests, or Go 1.22 or newer. The curl steps need curl and uuidgen.

1. Get a key#

  1. In Lectern, open Integrations & export and choose the API keys tab.
  2. Choose Create API key, name it for the job it will do, and tick only the things it needs to do.
  3. Copy the secret now. It starts with lk_live_ and is shown once.

Keep the key on a server. Put it in an environment variable, not in code:

export LECTERN_BASE_URL="https://your-lectern-host.example"
export LECTERN_SLUG="your-church-slug"
export LECTERN_API_KEY="lk_live_..."
Keys are server-side only

Never put a key in a web page, a mobile app or a URL. Anyone who has it can act as your church within its scopes.

The JavaScript, Python and Go tabs above define a small lectern helper that adds the key, sends JSON, and turns errors into exceptions that carry the status, the error code and the request id. Every step below uses it. Set LECTERN_BASE_URL (for example https://your-lectern-host.example), LECTERN_SLUG and LECTERN_API_KEY in your environment.

2. Check your key#

GET /usage works with any valid key and shows what it can do.

curl "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/usage" \
  -H "Authorization: Bearer $LECTERN_API_KEY"

3. Submit a teaching#

Send a YouTube link. The response comes back at once with status queued: the work happens afterwards. The Idempotency-Key makes a retry safe, so a timeout never creates the same teaching twice.

curl -X POST "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/teachings" \
  -H "Authorization: Bearer $LECTERN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"url": "https://www.youtube.com/watch?v=jNQXAC9IVRw"}'

A successful response is 201:

{
  "status": true,
  "message": "ok",
  "data": {
    "id": "tch_01m4h8nrg9e56b9wket22nay7f",
    "title": "YouTube jNQXAC9IVRw",
    "duration_s": 0,
    "status": "queued",
    "visibility": "",
    "branch": {
      "id": "brn_01m4h7y09deqtamqgs56j3gmb5",
      "name": "Grace Community Church",
      "slug": "hq",
      "address": {}
    },
    "kind": "",
    "standing": {
      "state": "current"
    }
  },
  "meta": {
    "request_id": "req_01m4h8nry7eq2bfwf822ry0vwm"
  }
}
Other recordings

This route accepts YouTube video links. To add an audio file, a video file or a transcript file, use uploads.

4. Wait for it#

A teaching moves from queued to done, or to failed. Poll until it is final, or skip polling by subscribing to the teaching.ready and teaching.failed webhooks.

curl "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/teachings/$TEACHING_ID" \
  -H "Authorization: Bearer $LECTERN_API_KEY"

While it waits for a transcript, the teaching reports awaiting_transcript. Keep polling; there is nothing to fix on your side. The status values are explained in Teachings.

5. Read the transcript, notes and Scripture#

Once the teaching is done its transcript is available. Notes and Scripture citations appear after a person on the church team approves a note, so GET .../notes answers 404 note_not_approved until then. That is normal, and the sample treats it that way.

curl "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/teachings/$TEACHING_ID/transcript" \
  -H "Authorization: Bearer $LECTERN_API_KEY"

curl "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/teachings/$TEACHING_ID/notes" \
  -H "Authorization: Bearer $LECTERN_API_KEY"

curl "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/teachings/$TEACHING_ID/citations" \
  -H "Authorization: Bearer $LECTERN_API_KEY"

The transcript is a list of timed segments:

{
  "status": true,
  "message": "ok",
  "data": {
    "origin": "import",
    "segments": [
      {
        "idx": 0,
        "start_s": 0,
        "end_s": 20,
        "text": "Good morning, church. Open your Bibles with me to Matthew chapter eighteen."
      },
      {
        "idx": 1,
        "start_s": 21,
        "end_s": 44,
        "text": "Peter comes to Jesus and asks, Lord, how often shall my brother sin against me, and I forgive him? Up to seven times?"
      },
      {
        "idx": 2,
        "start_s": 45,
        "end_s": 70,
        "text": "And Jesus answers him, I do not say to you seven times, but seventy times seven. Matthew eighteen, verses twenty-one and twenty-two."
      }
    ]
  },
  "meta": {
    "request_id": "req_01m4h8nry7eq2bfwf822ry0vwm"
  }
}

6. Ask a question#

POST /ask queues the answer and returns the conversation with a pending assistant message. The sample reads the conversation until the answer is ready. To show it as it is written, stream it.

curl -X POST "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/ask" \
  -H "Authorization: Bearer $LECTERN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"question": "What did the pastor teach about forgiveness?"}'

curl "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/conversations/$CONVERSATION_ID" \
  -H "Authorization: Bearer $LECTERN_API_KEY"

The reply has a short answer, the full answer, and numbered citations that point back to the teaching and the moment it was said:

{
  "status": true,
  "message": "ok",
  "data": {
    "id": "cnv_01m4h87fpyerrr62f654bpj1dc",
    "title": "What did the pastor teach about forgiveness?",
    "updated_at": "2026-10-09T21:13:42Z",
    "messages": [
      {
        "id": "msg_01m4h87fqjf0fbnfvm4gb8d407",
        "role": "user",
        "kind": "answer",
        "text": "What did the pastor teach about forgiveness?",
        "at": "2026-10-09T21:13:41Z",
        "verses": [],
        "blocks": [],
        "follow_ups": [],
        "citations": []
      },
      {
        "id": "msg_01m4h87fqjf0h8g1xqg16mvsh9",
        "role": "assistant",
        "kind": "answer",
        "text": "## Forgiveness in this church's teaching\n\nIn Forgiveness that frees, the pastor starts with Peter's question about how often to forgive and Jesus' answer of seventy times seven, which takes the counting away.\n\n> Then came Peter to him, and said, Lord, how oft shall my brother sin against me, and I forgive him? till seven times? Jesus saith unto him, I say not unto thee, Until seven times: but, Until seventy times seven.\n\nIn short: Forgiveness is not pretending it did not hurt. It is deciding that the debt will not be collected, because we have first been forgiven.",
        "at": "2026-10-09T21:13:41Z",
        "verses": [
          {
            "ref": "Matthew 18:21-22",
            "teachings": 1,
            "series": 0,
            "summary": "Jesus answers Peter with seventy times seven, which removes the counting from forgiveness.",
            "open_tensions": 0
          }
        ],
        "short_answer": "The church teaches that forgiveness is a decision not to collect a debt, grounded in the fact that God in Christ has already forgiven us.",
        "blocks": [
          {
            "type": "heading",
            "text": "Forgiveness in this church's teaching"
          },
          {
            "type": "paragraph",
            "text": "In Forgiveness that frees, the pastor starts with Peter's question about how often to forgive and Jesus' answer of seventy times seven, which takes the counting away.",
            "source_refs": [
              1
            ]
          },
          {
            "type": "quote",
            "text": "Then came Peter to him, and said, Lord, how oft shall my brother sin against me, and I forgive him? till seven times? Jesus saith unto him, I say not unto thee, Until seven times: but, Until seventy times seven.",
            "verse_ref": "Matthew 18:21-22",
            "source_refs": [
              1
            ]
          },
          {
            "type": "conclusion",
            "text": "Forgiveness is not pretending it did not hurt. It is deciding that the debt will not be collected, because we have first been forgiven.",
            "source_refs": [
              1
            ]
          }
        ],
        "follow_ups": [
          "How does the church teach about forgiving someone who has not apologised?"
        ],
        "citations": [
          {
            "type": "teaching",
            "ref": 1,
            "teaching": {
              "id": "tch_01m4h7zbsve4ybxjarahd3fpkh",
              "title": "Forgiveness that frees",
              "recorded_at": "2026-09-27T00:00:00Z",
              "duration_s": 242,
              "branch": {
                "id": "brn_01m4h7y09deqtamqgs56j3gmb5",
                "name": "Grace Community Church",
                "slug": "hq",
                "address": {}
              }
            },
            "start_s": 0,
            "end_s": 242,
            "excerpt": "Good morning, church. Open your Bibles with me to Matthew chapter eighteen. Peter comes to Jesus and asks, Lord, how often shall my brother sin against me, and I forgive him? Up to seven times? And Jesus answers him, I do not say to you seven times, but seventy times seven. Matthew eighteen, verses twenty-one and twenty-two. Now Jesus is not giving us a numb…"
          }
        ]
      }
    ]
  },
  "meta": {
    "request_id": "req_01m4h8nry7eq2bfwf822ry0vwm"
  }
}
Show support messages

Some questions are answered with a support message instead of a teaching answer: kind is crisis and code is crisis_support. Always show that message to the person, exactly as returned. See Ask.

Put it together#

This script chains the steps. For an unattended server, replace the polling step with a webhook.

const teaching = await submitTeaching("https://www.youtube.com/watch?v=jNQXAC9IVRw");
console.log("Queued", teaching.id);

const ready = await waitUntilDone(teaching.id);
if (ready.status === "failed") throw new Error(ready.processing_error ?? "The teaching failed");

const results = await readResults(teaching.id);
console.log(results.segments.length, "transcript segments");
console.log(results.note?.summary ?? "No approved note yet");

const answer = await ask("What did the pastor teach about forgiveness?");
console.log(answer.short_answer);
for (const citation of answer.citations) {
  console.log("[" + citation.ref + "]", citation.teaching.title, citation.start_s + "s");
}
Use a webhook in production

Preparing a teaching takes as long as it takes. A script that polls is fine for a first run; in production subscribe to teaching.ready so no process sits in a loop.

What next#

Next steps