> ## 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.

# Generate Strategy

> Kick off content strategy generation from a user brief.

Persists the brief synchronously to ``strategy_brief_history`` BEFORE
launching the background task, so a Railway restart, LLM timeout, or
OOM mid-generation cannot lose the user's brief. The Strategy Briefs
page reads from this table — without a synchronous write, a crashed
background task would leave nothing to display.

The background task receives the new row's id and UPDATEs the same
row when the LLM completes (filling in ``strategy_snapshot`` +
``strategy_file_id``); it does NOT insert a duplicate.

The user can call /strategy/cancel to abort before the background
task saves; the brief row stays around with an empty
``strategy_snapshot`` so it remains visible on the Briefs page.



## OpenAPI

````yaml /openapi.json post /api/v1/teams/{team_id}/strategy/generate
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/teams/{team_id}/strategy/generate:
    post:
      tags:
        - Teams
      summary: Generate Strategy
      description: |-
        Kick off content strategy generation from a user brief.

        Persists the brief synchronously to ``strategy_brief_history`` BEFORE
        launching the background task, so a Railway restart, LLM timeout, or
        OOM mid-generation cannot lose the user's brief. The Strategy Briefs
        page reads from this table — without a synchronous write, a crashed
        background task would leave nothing to display.

        The background task receives the new row's id and UPDATEs the same
        row when the LLM completes (filling in ``strategy_snapshot`` +
        ``strategy_file_id``); it does NOT insert a duplicate.

        The user can call /strategy/cancel to abort before the background
        task saves; the brief row stays around with an empty
        ``strategy_snapshot`` so it remains visible on the Briefs page.
      operationId: generate_strategy_api_v1_teams__team_id__strategy_generate_post
      parameters:
        - name: team_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Team Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StrategyGenerateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    StrategyGenerateRequest:
      properties:
        brief:
          type: string
          minLength: 10
          title: Brief
          description: User's content strategy brief
      type: object
      required:
        - brief
      title: StrategyGenerateRequest
    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

````