> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zespan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a prompt version

> Create a new version of a prompt. If the named prompt already exists a new incremented version is created; otherwise version 1 is created. The `latest` label is always applied automatically.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/prompts
openapi: 3.1.0
info:
  title: Zespan Public API
  version: 1.0.0
  description: >
    The Zespan Public API covers the endpoints that customers call directly or
    through the Zespan SDKs: trace ingestion (native and OpenTelemetry), prompt
    management, datasets and dataset runs, and the runtime guardrails check.

    All endpoints authenticate with a project API key sent in the `x-api-key`
    header. Create and manage API keys from the project settings in the Zespan
    dashboard.
servers:
  - url: https://api.zespan.com
    description: Zespan production API
security:
  - ApiKeyAuth: []
tags:
  - name: Ingestion
    description: Send traces and events to Zespan.
  - name: OpenTelemetry
    description: OTLP-compatible ingestion endpoints.
  - name: Prompts
    description: Manage versioned prompts and their labels, tags, and folders.
  - name: Datasets
    description: Read datasets and manage dataset runs used for experiments and scoring.
  - name: Guardrails
    description: Runtime guardrail evaluation.
paths:
  /v1/prompts:
    post:
      tags:
        - Prompts
      summary: Create a prompt version
      description: >
        Create a new version of a prompt. If the named prompt already exists a
        new incremented version is created; otherwise version 1 is created. The
        `latest` label is always applied automatically.
      operationId: createPrompt
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - type
                - prompt
              properties:
                projectId:
                  type: string
                  format: uuid
                  description: Optional when authenticating with an API key.
                name:
                  type: string
                  minLength: 1
                  example: support-reply
                type:
                  type: string
                  enum:
                    - text
                    - chat
                  example: chat
                prompt:
                  description: >-
                    Prompt content. A string for `text` prompts, or an array of
                    chat messages for `chat` prompts.
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        type: object
                        additionalProperties: true
                  example:
                    - role: system
                      content: You are a concise support assistant.
                    - role: user
                      content: '{{question}}'
                config:
                  type: object
                  additionalProperties: true
                  description: Model configuration (temperature, max_tokens, etc.).
                  example:
                    temperature: 0.2
                    max_tokens: 512
                labels:
                  type: array
                  items:
                    type: string
                  example:
                    - production
                tags:
                  type: array
                  items:
                    type: string
                  example:
                    - support
                commitMessage:
                  type: string
                  example: Tighten system instructions
                folder:
                  type: string
                  nullable: true
                  example: support/inbound
      responses:
        '201':
          description: Prompt version created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Prompt'
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    Prompt:
      type: object
      description: A single prompt version.
      properties:
        id:
          type: string
          format: uuid
        projectId:
          type: string
          format: uuid
        name:
          type: string
          example: support-reply
        version:
          type: integer
          example: 3
        type:
          type: string
          enum:
            - text
            - chat
        prompt:
          description: >-
            Prompt content — a string for text prompts, or an array of chat
            messages.
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: true
        config:
          type: object
          additionalProperties: true
        labels:
          type: array
          items:
            type: string
          example:
            - production
            - latest
        tags:
          type: array
          items:
            type: string
        folder:
          type: string
          nullable: true
        commitMessage:
          type: string
          nullable: true
        createdBy:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        resolvedPrompt:
          description: >-
            Prompt content with dependencies inlined (present on single-prompt
            fetch).
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
          example: Unauthorized
        code:
          type: string
          description: Machine-readable error code, when present.
          example: rate_limit_exceeded
      required:
        - error
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Project API key. Manage keys in the Zespan dashboard under project
        settings.

````