---
title: "Draft a document from an industry prompt"
method: POST
path: "/org/content-generation/industry-prompt-draft"
tags: ["Content Generation"]
---

# Draft a document from an industry prompt

`POST /org/content-generation/industry-prompt-draft`

## Request

- Base URL: `https://apiv2.senso.ai/api/v1`
- URL: `https://apiv2.senso.ai/api/v1/org/content-generation/industry-prompt-draft`
- Auth: API key in header `X-API-Key`

Generates a complete document from one of your industry's prompts in a single synchronous call. The prompt is resolved server-side against your organization's industry, grounded in your knowledge base, and written in the requested content type with your brand kit and product-line context applied. The document is not stored as content: the response carries it as GitHub Flavored Markdown with footnote citations, together with the sources behind it and a summary of what retrieval found, so you can review it or store it as content in a follow-up call. The call typically takes 10–30 seconds — set your client timeout accordingly. Each returned document consumes credits like an ad-hoc content generation; the balance is checked first, so an insufficient balance is a `402` before anything runs, and no credits are consumed unless a document is returned. A prompt that is not part of your organization's industry is a `404`; an organization with no industry assigned is a `422`. Requires the GEO product.

## Request body

- IndustryPromptDraftRequest
  - `industry_prompt_id` string, uuid, required: The industry prompt to draft from. It must belong to your organization's industry — industry prompts are the prompts Senso runs for your sector, distinct from your organization's own prompts (`GET /org/prompts`), whose ids are not accepted here. A prompt from another industry is a `404`.
  - `selected_content_type_id` string, uuid, required: The content type that gives the document its format (`GET /org/content-types`). It must be one of your organization's content types; an id that does not resolve is a `400`.
  - `selected_product_line_ids` string[]: Product lines to include as context (up to 100). Omit to include all of your organization's product lines, up to the same limit.
  - `audience` string: Who the document is for. Defaults to a general audience.
  - `style_tone` string: Voice and tone guidance for the writer. Defaults to professional, concise, and helpful.
  - `extra_instructions` string: Any further instructions for the writer, such as sections to include or claims to avoid.

## Response `200`

The generated document with its citations and a summary of what retrieval found.

- IndustryPromptDraftResponse: A generated document and everything needed to render or store it. The document is not stored as content — persist `document_markdown` in a follow-up call if you want to keep it.
  - `industry_prompt_id` string, uuid, required: The industry prompt the document answers.
  - `prompt_text` string, required: The prompt's text as stored on the industry.
  - `funnel_stage` string: The prompt's funnel stage as configured on the industry — for example `awareness`, `consideration`, `evaluation`, or `decision`. Free text whose casing varies between industries; omitted when the prompt has none.
  - `document_markdown` string, required: The document as GitHub Flavored Markdown. Citations appear as footnote references (`[^1]`, `[^2]`, …) whose definitions, at the end of the document, are links to the sources — each labelled with the source's title and pointing at its URL, which you can match against `citations`.
  - `content_type` IndustryPromptDraftContentType, required: The content type that shaped the document.
    - `id` string, uuid, required: The content type's id, as sent in `selected_content_type_id`.
    - `name` string, required: The content type's name.
  - `citations` IndustryPromptDraftCitation[], required: The knowledge-base sources that were available to the writer, deduplicated by URL. Not every entry is necessarily cited in the document — match footnote definitions to entries by URL. Empty when retrieval found nothing citable.
    - `id` string, required: Identifier of the source within this response. Identifiers are not contiguous and are not footnote numbers.
    - `url` string, required: An in-app knowledge-base path beginning `/knowledge-base?node=` that identifies the source's `kb_node_id` and, when known, its `version`.
    - `label` string: Display label for the source, typically its title. Omitted when unknown.
    - `snippet` string: An excerpt of the cited passage. Omitted when unavailable.
  - `retrieval` IndustryPromptDraftRetrieval, required: What retrieval found for the prompt, so you can tell a document grounded in your knowledge base from one the model wrote unaided.
    - `total_results` integer, required: Number of knowledge-base passages retrieval returned for the prompt.
    - `context_chunks_used` integer, required: Whether usable knowledge-base context reached the writer. `0` means none did and the document is not grounded in your knowledge base — see `notes`; any positive value means it was grounded.
    - `query_info` IndustryPromptDraftQueryInfo, required: The search query retrieval ran, and how it was derived from the prompt.
      - `original_query` string, required: The prompt text retrieval started from.
      - `query` string, required: The query actually searched — a rewritten form of the prompt when `was_rewritten` is true, otherwise the prompt itself.
      - `was_rewritten` boolean, required: Whether the prompt was rewritten into a search query before retrieval.
      - `rewrite_failed` boolean, required: True when the rewrite step failed and the original prompt was searched instead.
      - `rewrite_error` string: Why the rewrite failed. Present only when `rewrite_failed` is true.
      - `input_tokens` integer: Tokens sent to the model for the rewrite step. Omitted when zero.
      - `output_tokens` integer: Tokens the rewrite step produced. Omitted when zero.
      - `cost` number: Estimated provider cost of the rewrite step, in US dollars. Omitted when zero.
    - `metrics` IndustryPromptDraftRetrievalMetrics, required: Retrieval statistics for this call.
      - `embedding_tokens` integer, required: Tokens embedded to run the semantic half of the search.
      - `answer_input_tokens` integer: Tokens sent to a model when retrieval also synthesizes an answer over the passages. Omitted when that step did not run, which is the case for this endpoint.
      - `answer_output_tokens` integer: Tokens produced by answer synthesis. Omitted for the same reason as `answer_input_tokens`.
      - `context_chars` integer, required: Characters of passage text assembled as context for the writer.
      - `raw_result_count` integer, required: Candidate passages considered before the relevance floor was applied.
      - `filtered_result_count` integer, required: Candidate passages kept after the relevance floor.
      - `relevance_threshold` number, required: The minimum relevance score a passage needed to be kept.
      - `search_type` string, required: The retrieval pipeline used. This endpoint uses `hybrid` — semantic and keyword search combined, then reranked.
      - `expanded_result_count` integer, required: Passages after neighbouring passages were added around each kept result.
      - `max_results` integer, required: The cap on passages requested from the search, before neighbouring passages were added.
      - `processing_time_ms` integer, required: Wall-clock time retrieval took, in milliseconds.
  - `usage` IndustryPromptDraftUsage, required: Model usage for the writing step.
    - `model` string, required: The model that wrote the document.
    - `provider` string, required: The model provider.
    - `input_tokens` integer, required: Tokens sent to the model.
    - `output_tokens` integer, required: Tokens the model produced.
    - `total_tokens` integer, required: The sum of input and output tokens.
    - `cost` number, required: Estimated provider cost of the writing step, in US dollars.
  - `model_used` string: The model that wrote the document.
  - `notes` string[]: Caveats about this particular result — for example that retrieval found no usable context, so the document is not grounded in your knowledge base and its specifics should be treated as unverified. Omitted when there are none.

## Other responses

- `400`: The request body was invalid — either it failed field validation (`ValidationErrorResponse`) or was otherwise malformed (`ErrorResponse`).
- `401`: Missing or invalid credentials — supply a valid org API key in the `X-API-Key` header.
- `402`: The organization is out of credits or has reached its spending limit, so generation did not run. Unlike most errors, the body carries a stable `code` you can branch on.
- `403`: The API key is authenticated but not permitted to access this resource.
- `404`: The requested resource does not exist or is not visible to this key.
- `422`: The request was well-formed but cannot be fulfilled given the current state (e.g. insufficient data to act on).
- `503`: The service is temporarily unavailable — retry later.
- `504`: A generation stage did not finish within the server's time limit. No credits were consumed — retry later.

---

[API](https://skmtc.dev/senso/apis/senso-org-api.md) - [All operations](https://skmtc.dev/senso/apis/senso-org-api/llms.txt) - [OpenAPI document](https://skmtc.dev/senso/apis/senso-org-api/revisions/d789b4fcbe84?raw)
