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

# Run Generation

> Start an AI generation run for the attribute.

`mode` says what the run does: `fill` generates values only for assets not
generated yet (or whose last run failed); `overwrite` regenerates every
asset's value, replacing the AI's answers. Values entered by hand are kept
unless `replace_manual` is true, and `count` leaves them out accordingly;
an `overwrite` dry run also reports how many there are (`manually_entered`).
`target` says which assets it covers: `watch` = every asset in the attribute's watch folders;
`directories` = assets in the given directories (`recursive: true` includes
their subdirectories); `assets` = only the listed assets, wherever they are.
Requires edit-metadata access on the project for `watch`, on every listed
directory or asset otherwise. An attribute without generation attached has
nothing to run and is rejected with 409 once the target is validated.
`POST /metadata/attributes/{attribute_id}/generation/run` is the deprecated
form of this route.



## OpenAPI

````yaml /api-reference/openapi.json post /metadata/attributes/{attribute_id}/run
openapi: 3.1.0
info:
  title: Aspect API
  description: Manage and search media in Aspect.
  version: 1.0.0
servers:
  - url: https://api.aspect.inc
security:
  - ApiKeyAuth: []
tags:
  - name: Users
  - name: API Keys
  - name: Workspaces
  - name: Projects
  - name: Directories
  - name: Assets
  - name: Attachments
  - name: Filesystem Items
  - name: Jobs
  - name: Collections
  - name: Comments
  - name: Search
  - name: Transcription
  - name: Metadata
  - name: Shares
  - name: Share Templates
  - name: Watermarks
paths:
  /metadata/attributes/{attribute_id}/run:
    post:
      tags:
        - Metadata
      summary: Run Generation
      description: >-
        Start an AI generation run for the attribute.


        `mode` says what the run does: `fill` generates values only for assets
        not

        generated yet (or whose last run failed); `overwrite` regenerates every

        asset's value, replacing the AI's answers. Values entered by hand are
        kept

        unless `replace_manual` is true, and `count` leaves them out
        accordingly;

        an `overwrite` dry run also reports how many there are
        (`manually_entered`).

        `target` says which assets it covers: `watch` = every asset in the
        attribute's watch folders;

        `directories` = assets in the given directories (`recursive: true`
        includes

        their subdirectories); `assets` = only the listed assets, wherever they
        are.

        Requires edit-metadata access on the project for `watch`, on every
        listed

        directory or asset otherwise. An attribute without generation attached
        has

        nothing to run and is rejected with 409 once the target is validated.

        `POST /metadata/attributes/{attribute_id}/generation/run` is the
        deprecated

        form of this route.
      operationId: run_generation
      parameters:
        - name: attribute_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: Attribute ID
            title: Attribute Id
          description: Attribute ID
        - name: dry_run
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Return the counts without starting the run; not supported when
              `target.kind` is `assets`
            default: false
            title: Dry Run
          description: >-
            Return the counts without starting the run; not supported when
            `target.kind` is `assets`
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CellRunRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CellRunResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CellRunRequest:
      properties:
        mode:
          $ref: '#/components/schemas/CellMode'
          title: Run Mode
          description: >-
            `fill` runs only the assets not run yet (or whose last run failed);
            `overwrite` re-runs every asset, replacing the AI's answers; answers
            entered by hand are kept unless `replace_manual` is true
        replace_manual:
          type: boolean
          title: Replace Manual Answers
          description: >-
            With `overwrite`, also replace answers entered by hand. Ignored by
            `fill`
          default: false
        target:
          oneOf:
            - $ref: '#/components/schemas/WatchRunTarget'
            - $ref: '#/components/schemas/DirectoriesRunTarget'
            - $ref: '#/components/schemas/AssetsRunTarget'
          title: Run Target
          description: >-
            Which assets the run covers: `watch` = every asset in the watch
            folders, rejected when there are none; `directories` = assets in the
            given directories (`recursive: true` includes their subdirectories);
            `assets` = only the listed assets, wherever they are
          discriminator:
            propertyName: kind
            mapping:
              assets: '#/components/schemas/AssetsRunTarget'
              directories: '#/components/schemas/DirectoriesRunTarget'
              watch: '#/components/schemas/WatchRunTarget'
      type: object
      required:
        - mode
        - target
      title: CellRunRequest
      description: 'API request schema for a run: what it does and which assets it covers.'
    CellRunResponse:
      properties:
        count:
          type: integer
          title: Count
          description: >-
            Number of assets the run covers (with `dry_run`, the number it would
            cover)
        manually_entered:
          anyOf:
            - type: integer
            - type: 'null'
          title: Manually Entered
          description: >-
            How many assets of the target currently hold an answer entered by
            hand. Only returned for `overwrite` dry runs; `count` leaves them
            out unless `replace_manual` is true
      type: object
      required:
        - count
      title: CellRunResponse
      description: API response schema for an explicit run's counts.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CellMode:
      type: string
      enum:
        - fill
        - overwrite
      title: CellMode
      description: |-
        What a run does to cells that already hold a value.

        ``fill`` stands down when the cell already has a value; ``overwrite``
        always runs and replaces whatever is there (values entered by hand only
        when the run asks to replace them). A missing payload ``mode`` reads as
        ``fill``, and modes are only ever promoted fill -> overwrite, never
        demoted.
    WatchRunTarget:
      properties:
        kind:
          type: string
          const: watch
          title: Kind
      type: object
      required:
        - kind
      title: WatchRunTarget
      description: Every asset the column watches; rejected when it watches nothing.
    DirectoriesRunTarget:
      properties:
        kind:
          type: string
          const: directories
          title: Kind
        directory_ids:
          items:
            type: string
            format: uuid
          type: array
          minItems: 1
          title: Directory IDs
          description: >-
            Directories in the column's project; the trash directory is not
            allowed
        recursive:
          type: boolean
          title: Recursive
          description: >-
            `true` includes each directory's subdirectories; `false` covers only
            the assets directly inside it
      type: object
      required:
        - kind
        - directory_ids
        - recursive
      title: DirectoriesRunTarget
      description: |-
        Assets in the given directories (`recursive: true` includes their
        subdirectories), of every type the column runs on: the watch and its
        asset-type limit do not apply.
    AssetsRunTarget:
      properties:
        kind:
          type: string
          const: assets
          title: Kind
        asset_ids:
          items:
            type: string
            format: uuid
          type: array
          minItems: 1
          title: Asset IDs
          description: Assets to run on
      type: object
      required:
        - kind
        - asset_ids
      title: AssetsRunTarget
      description: Only the listed assets, wherever they are.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Aspect API key (sk_...) in Authorization header. 'Bearer ' optional.

````

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