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

Ask

Ask answers a question using only what the church has taught, and shows where each part of the answer came from. You can read the answer when it is ready, stream it as it is written, or get it by webhook.

Before you start

  • A key with ask:use.
  • At least one teaching that is done.

Ask a question#

POST/askask:use

Send a question of 2 to 500 characters. Add conversation_id to continue an earlier conversation, or branch_id to limit the answer to one branch (campus). It needs an Idempotency-Key, uses AI budget and answers 201 with the conversation and a message whose kind is pending.

{
  "status": true,
  "message": "ok",
  "data": {
    "id": "cnv_01m4h8nrktfkgajg22jz628dxq",
    "title": "What did the pastor teach about forgiveness?",
    "updated_at": "2026-10-09T21:21:29Z",
    "messages": [
      {
        "id": "msg_01m4h8nrm7fmdr3nt01pd7tc3y",
        "role": "user",
        "kind": "answer",
        "text": "What did the pastor teach about forgiveness?",
        "at": "2026-10-09T21:21:29Z",
        "verses": [],
        "blocks": [],
        "follow_ups": [],
        "citations": []
      },
      {
        "id": "msg_01m4h8nrm7fmftda7bvkrbf87q",
        "role": "assistant",
        "kind": "pending",
        "text": "",
        "at": "2026-10-09T21:21:29Z",
        "verses": [],
        "blocks": [],
        "follow_ups": [],
        "citations": []
      }
    ]
  },
  "meta": {
    "request_id": "req_01m4h8nry7eq2bfwf822ry0vwm"
  }
}

Get the answer one of three ways:

  1. Poll GET /conversations/{id} until the last assistant message is no longer pending.
  2. Stream GET /conversations/{id}/events to show the answer as it is written.
  3. Webhook: subscribe to ask.answered and read the conversation when it arrives. Best for unattended servers.
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"
Repeated questions

A question the church has already asked can be answered immediately, so the 201 response may already contain the finished answer. Check kind on the response before you wait.

Asking again in a conversation before the last answer is ready answers 409 answer_pending. Only the key that started a conversation can read it.

The answer#

{
  "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"
  }
}
FieldMeaning
kindpending, then answer, not_covered, greeting, unavailable or crisis. Treat unknown values as “show the text”.
short_answerA direct answer in one or two sentences.
textThe full answer as Markdown.
blocksThe same answer as structured blocks: heading, paragraph, quote, list-item and conclusion. A quote of Scripture has a verse_ref. Each block has source_refs pointing into citations.
citationsThe teachings the answer is drawn from, numbered by ref. Each has the teaching, start_s and end_s in its transcript, and an excerpt.
follow_upsSuggested next questions.
versesScripture the answer uses, with how the church’s teaching uses it.

Showing citations#

Show a citation next to the text it supports. Use source_refs on each block to attach footnote numbers, and start_s to link to the moment in the recording. A citation lets a reader judge the answer for themselves, which is why every answer carries them.

Kinds of reply#

kindMeaningWhat to show
pendingThe answer is being written.A loading state.
answerAn answer from the church’s teaching.The short answer, the full answer and citations.
not_coveredThe church’s teaching does not cover the question.The text as written. Do not fill the gap with another source.
greetingThe message was a greeting.The text.
unavailableAn answer could not be made right now.The text, and let the person try again.
crisisThe person may need support rather than a teaching answer.The support message, exactly as returned. See below.

Support messages#

Always show support messages

Some questions are answered with a support message instead of a teaching answer. The assistant message has kind: "crisis" and code: "crisis_support", and carries helplines in a block of type support. Show it to the person, in full and as written. Never hide it, shorten it, rewrite it, summarise it, or ask the question again to get a different reply. Lectern also alerts the church’s team when this happens. The alert names your API key and does not put the question in the email.

Where to look
{
  "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"
  }
}

Check for it on every reply: message.kind === "crisis" or message.code === "crisis_support". The user’s own message in that exchange carries the same code. Both the create response and later reads show it, and no ask.answered event is sent for it. Give the message prominent placement in your interface, with readable contrast, and make sure its links work on the devices your visitors use.

Shape of a support message (abridged)
{
  "code": "crisis_support",
  "kind": "crisis",
  "role": "assistant",
  "text": "I’m really sorry you are carrying this. You matter, and you do not have to face it alone. ...",
  "blocks": [
    {
      "type": "support",
      "text": "...",
      "contacts": [
        { "name": "Find a helpline in your country", "url": "https://findahelpline.com", "categories": ["suicide_self_harm", "abuse", "other_crisis"] }
      ]
    }
  ]
}

Stream an answer#

GET/conversations/{id}/eventsask:use

The events endpoint is a Server-Sent Events stream. Open it right after you create the conversation, and you receive progress and each block of the answer as it is written.

Send Accept: text/event-stream and your key. A browser EventSource cannot send an Authorization header, so read the stream from your server with fetch or your language’s HTTP client, and forward events to your page however you like (for example, as your own stream).

typeMeaning
stageProgress: searching, reading (with a count of passages) or writing.
sourcesThe teachings the answer is drawn from.
shortThe short answer, in text.
blockOne block of the answer, in block, at position index.
resetThe answer is being rewritten. Discard the blocks you have.
conversation_updatedThe stored conversation changed.
doneThe answer is complete. Close the stream and read the conversation for the final message.
What the stream sends
retry: 3449
event: hello
data: {}

id: 1
data: {"type":"stage","message_id":"msg_01m4h88ne3e639fbkjk1y8nsqx","index":0,"stage":"searching"}

id: 2
data: {"type":"sources","message_id":"msg_01m4h88ne3e639fbkjk1y8nsqx","index":0,"sources":[{"ref":1,"teaching":{"id":"tch_01m4h7zbsve4ybxjarahd3fpkh","title":"Forgiveness that frees"},"excerpt":"Good morning, church. ...","start_s":0,"end_s":242}]}

id: 5
data: {"type":"short","message_id":"msg_01m4h88ne3e639fbkjk1y8nsqx","index":0,"text":"The church teaches that forgiveness is a decision not to collect a debt."}

id: 6
data: {"type":"block","message_id":"msg_01m4h88ne3e639fbkjk1y8nsqx","index":0,"block":{"type":"heading","text":"Forgiveness in this church’s teaching"}}

id: 10
data: {"type":"done"}

: ping
  • Every event after the first is an unnamed data: line holding JSON. Parse it, switch on type, and ignore types you do not know.
  • The stream does not end by itself when the answer is done. Stop reading at done and close the connection.
  • A : ping comment arrives about every 20 seconds to keep the connection open, and a stream ends after roughly 25 to 30 minutes. If it closes before done, read the conversation to catch up.
  • If the question is answered with a support message there is nothing to stream: the create response already holds it.
curl -N "$LECTERN_BASE_URL/v1/api/o/$LECTERN_SLUG/conversations/$CONVERSATION_ID/events" \
  -H "Authorization: Bearer $LECTERN_API_KEY" \
  -H "Accept: text/event-stream"

The Go version needs bufio and strings added to the imports from the quickstart.

Where answers come from#

  • Answers are written from the church’s own teaching and cite it. They are not general web answers.
  • Pass branch_id to limit the answer to one branch (campus).
  • A key only ever reaches its own church. Answers never draw on another church’s teaching.
Do not rewrite answers

Show the answer as returned. Editing it, merging answers or paraphrasing citations puts words in the church’s mouth that no one reviewed.

Next steps