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

# Prepare Text



## OpenAPI

````yaml https://app.usequanta.com/openapi/quanta-services-api/openapi.json post /admin_api/leaves/text/prepare
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://app.usequanta.com
    description: Production
security:
  - HTTPBearer: []
paths:
  /admin_api/leaves/text/prepare:
    post:
      tags:
        - leaf_admin
        - quanta-services-api
      summary: Prepare Text
      operationId: prepare_text_proposal
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrepareProposalRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreparedTextProposal'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    PrepareProposalRequest:
      properties:
        source:
          oneOf:
            - $ref: '#/components/schemas/CloseReviewRunSourceRef'
            - $ref: '#/components/schemas/WorkTurnSourceRef'
          title: Source
          discriminator:
            propertyName: type
            mapping:
              close_review_run: '#/components/schemas/CloseReviewRunSourceRef'
              work_turn: '#/components/schemas/WorkTurnSourceRef'
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
      type: object
      required:
        - source
      title: PrepareProposalRequest
    PreparedTextProposal:
      properties:
        source:
          oneOf:
            - $ref: '#/components/schemas/CloseReviewRunSourceRef'
            - $ref: '#/components/schemas/WorkTurnSourceRef'
          title: Source
          discriminator:
            propertyName: type
            mapping:
              close_review_run: '#/components/schemas/CloseReviewRunSourceRef'
              work_turn: '#/components/schemas/WorkTurnSourceRef'
        source_package_fingerprint:
          type: string
          title: Source Package Fingerprint
        output_id:
          type: string
          title: Output Id
        choice_id:
          type: string
          title: Choice Id
        slug:
          type: string
          title: Slug
        base_version_qid:
          type: string
          title: Base Version Qid
        base_body_md:
          type: string
          title: Base Body Md
        edits:
          items:
            $ref: '#/components/schemas/TextEdit'
          type: array
          title: Edits
      additionalProperties: false
      type: object
      required:
        - source
        - source_package_fingerprint
        - output_id
        - choice_id
        - slug
        - base_version_qid
        - base_body_md
        - edits
      title: PreparedTextProposal
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CloseReviewRunSourceRef:
      properties:
        type:
          type: string
          const: close_review_run
          title: Type
        run_qid:
          type: string
          title: Run Qid
        decision_key:
          type: string
          title: Decision Key
        choice_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Choice Id
      additionalProperties: false
      type: object
      required:
        - type
        - run_qid
        - decision_key
      title: CloseReviewRunSourceRef
    WorkTurnSourceRef:
      properties:
        type:
          type: string
          const: work_turn
          title: Type
        execution_artifact_qid:
          type: string
          title: Execution Artifact Qid
        decision_key:
          type: string
          title: Decision Key
        choice_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Choice Id
      additionalProperties: false
      type: object
      required:
        - type
        - execution_artifact_qid
        - decision_key
      title: WorkTurnSourceRef
    TextEdit:
      properties:
        id:
          type: string
          minLength: 1
          title: Id
        before:
          type: string
          title: Before
        after:
          type: string
          title: After
        insert_after:
          anyOf:
            - type: string
            - type: 'null'
          title: Insert After
      additionalProperties: false
      type: object
      required:
        - id
        - before
        - after
      title: TextEdit
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Quanta Services API scoped bearer token. Supported only on Services API
        routes.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.