---
title: "Derive an output schema from a prompt"
method: POST
path: "/table-enrichments/saved-agents/outputs/generate/"
tags: ["table-enrichments"]
---

# Derive an output schema from a prompt

`POST /table-enrichments/saved-agents/outputs/generate/`

## Request

- Base URL: `https://api.getoneprofile.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.getoneprofile.ai/table-enrichments/saved-agents/outputs/generate/`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Read a prompt and propose the typed fields the agent should return. Nothing is stored. The caller drops the result into the editor and decides what to keep. Counts against the workspace's daily AI Assistant allowance; a refused call answers 429.

## Request body

- SavedAgentOutputGenerateRequestSchema: A prompt to derive an output schema from.
  - `inputs` AgentInputSchema[]
    - `id` string, uuid, required
    - `name` string, required
  - `prompt` AgentPromptTemplateInput, required: A saved agent's prompt: literal text with references between the runs. The same convention every other stored prompt in the product uses (``EnrichmentPromptTemplate`` for columns, template segments for sequences): identity-keyed segments, so renaming what a reference points at never rewrites the prompt. Structurally parallel to the enrichment template rather than importing it: an agent prompt references INPUTS, an enrichment prompt references COLUMNS, and the import hierarchy keeps the two domains apart.
    - `segments` union[]
      - union
        - AgentPromptTextSegment: A literal run of prompt text.
          - `text` string, required
          - `type` 'text'
        - AgentPromptInputRefSegment: A reference to one declared input, resolved per row at run time.
          - `input_id` string, uuid, required
          - `type` 'input_ref'
        - AgentPromptContextRefSegment: A reference to the org's business context, resolved per org.
          - `section` 'all' | 'company' | 'icp' | 'personas' | 'signals' | 'social_proof': One section of the org's AI business context a prompt can reference. ``ALL`` is the whole context document; the rest are its named sections.
          - `type` 'context_ref'

## Response `200`

Successful Response

- SavedAgentOutputGenerateResponseSchema: The generated output schema, ready to drop into the editor.
  - `output_schema` union, required
    - EnrichmentOutputFieldsOutput: The fields-mode output shape: repeatable named typed fields. The default is Clay's: one text field named ``response``.
      - `fields` EnrichmentOutputField[]
        - `choices` string[], nullable: The fixed option list for a select field; None elsewhere.
        - `description` string, nullable: Shown to the model: what this field should contain.
        - `field_type` 'text' | 'paragraph' | 'url' | 'email' | 'image_url' | 'person' | 'select' | 'number' | 'decimal' | 'currency' | 'checkbox' | 'date' | 'multi_select' | 'list' | 'object': The type a user picks for a table column. Ordered as the picker shows them, which is also the order the groups below run in: text-ish, then numeric, then choice, then structured.
        - `name` string, required
      - `mode` 'fields'
    - EnrichmentOutputRawSchema: The advanced output shape: a raw strict-mode JSON schema, verbatim. Held to every strict-mode constraint at SAVE time by the service layer. The shape is stored exactly as authored, and validation failures name the exact violated rule rather than surfacing at run time.
      - `json_schema` object, required: A strict-mode JSON schema with an object root.
      - `mode` 'json_schema'

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `422`: Invalid request made to the API.
- `429`: The workspace's AI Assistant allowance is spent, or the AI Assistant is paused
- `500`: Internal server error.
- `502`: Bad gateway error.
- `503`: Service unavailable.

---

[API](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile.md) · [All operations](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/llms.txt) · [OpenAPI document](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/revisions/4a6bd71e3f02?raw)
