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

# Create Review Response Draft Route

> Create or regenerate the AI-drafted reply for one own-brand review.

Authorization is mandatory and runs BEFORE any review body is read or
the LLM is called: ``_get_brand_or_404`` proves the caller owns
``brand_id``; ``generate_review_response_draft`` then resolves
``review_id`` as an own-brand review of that brand — never a
competitor's — before touching the provider (Design §4.2's server-side
authorization paragraph). Both "wrong brand" and "competitor-owned
review_id" surface as the same 404, by design — see
``ReviewResponseDraftReviewNotFound``.

Regenerating an already-drafted review OVERWRITES the existing row
(Design §4.3) — this route is both "create" and "regenerate", the DB
upsert on the unique ``review_id`` index is what prevents a second row.



## OpenAPI

````yaml /openapi.json post /api/v1/brands/{brand_id}/brand-intelligence/reviews/{review_id}/draft-response
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/brands/{brand_id}/brand-intelligence/reviews/{review_id}/draft-response:
    post:
      tags:
        - Brand Reviews
        - Brand Reviews
      summary: Create Review Response Draft Route
      description: |-
        Create or regenerate the AI-drafted reply for one own-brand review.

        Authorization is mandatory and runs BEFORE any review body is read or
        the LLM is called: ``_get_brand_or_404`` proves the caller owns
        ``brand_id``; ``generate_review_response_draft`` then resolves
        ``review_id`` as an own-brand review of that brand — never a
        competitor's — before touching the provider (Design §4.2's server-side
        authorization paragraph). Both "wrong brand" and "competitor-owned
        review_id" surface as the same 404, by design — see
        ``ReviewResponseDraftReviewNotFound``.

        Regenerating an already-drafted review OVERWRITES the existing row
        (Design §4.3) — this route is both "create" and "regenerate", the DB
        upsert on the unique ``review_id`` index is what prevents a second row.
      operationId: >-
        create_review_response_draft_route_api_v1_brands__brand_id__brand_intelligence_reviews__review_id__draft_response_post
      parameters:
        - name: brand_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Brand Id
        - name: review_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Review Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BrandReviewResponseDraftItem'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    BrandReviewResponseDraftItem:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        review_id:
          type: string
          format: uuid
          title: Review Id
        brand_id:
          type: string
          format: uuid
          title: Brand Id
        model:
          type: string
          title: Model
        draft_text:
          type: string
          title: Draft Text
        edited_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Edited Text
        status:
          type: string
          enum:
            - draft
            - edited
            - copied
            - dismissed
          title: Status
        copied_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Copied At
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - id
        - review_id
        - brand_id
        - model
        - draft_text
        - status
        - created_at
        - updated_at
      title: BrandReviewResponseDraftItem
      description: One AI-drafted reply, as served to every consuming surface.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````