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

# Create a video

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Starts generating a video and returns the job right away, usually `queued`. Poll Get a video until `status` is `completed`, about every 15 seconds, and read `url`. Billed to the app's credits at the same price as an AI gateway call.

For an estimate that generates and charges nothing, send the body you plan to generate with and add `dry_run: true`. The price depends on the model and the length, so an estimate for a different body can be off. Send an `Idempotency-Key` with each generation, and the same key when you retry it, so a retry isn't charged twice.

When the model provider fails, the same request usually fails the same way again, so try another model rather than resending it unchanged. A dry run answers 200. The charge is recorded once the provider finishes the video; a video that fails to generate costs nothing, but one that fails while being stored may still be charged.



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json post /api/apps/{app_id}/media/videos
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/apps/{app_id}/media/videos:
    post:
      summary: Create a video
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Starts generating a video and returns the job right away, usually
        `queued`. Poll Get a video until `status` is `completed`, about every 15
        seconds, and read `url`. Billed to the app's credits at the same price
        as an AI gateway call.


        For an estimate that generates and charges nothing, send the body you
        plan to generate with and add `dry_run: true`. The price depends on the
        model and the length, so an estimate for a different body can be off.
        Send an `Idempotency-Key` with each generation, and the same key when
        you retry it, so a retry isn't charged twice.


        When the model provider fails, the same request usually fails the same
        way again, so try another model rather than resending it unchanged. A
        dry run answers 200. The charge is recorded once the provider finishes
        the video; a video that fails to generate costs nothing, but one that
        fails while being stored may still be charged.
      operationId: create_video_api_apps__app_id__media_videos_post
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app to generate media for.
            title: App Id
          description: ID of the app to generate media for.
          example: 6820f3a4e7b91d003c45a1f2
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            description: >-
              One key per operation, 1 to 128 characters. A retry with the same
              key and request within 24 hours returns the first response.
            examples:
              - 7f3c9a2e-retry-1
            title: Idempotency-Key
          description: >-
            One key per operation, 1 to 128 characters. A retry with the same
            key and request within 24 hours returns the first response.
        - name: X-Active-Branch-Id
          in: header
          required: false
          schema:
            type: string
            description: >-
              ID of the branch the editor shows. Used when `branch_id` is
              omitted, for users who work on protected-main branches.
            title: X-Active-Branch-Id
          description: >-
            ID of the branch the editor shows. Used when `branch_id` is omitted,
            for users who work on protected-main branches.
          example: 68f1a2b3c4d5e6f708192a3b
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVideoRequest'
      responses:
        '200':
          description: The estimate for a dry run. No job is started.
          content:
            application/json:
              example:
                dry_run: true
                model: veo_3_1_fast
                usage:
                  credits: 4
              schema:
                $ref: '#/components/schemas/Estimate'
        '202':
          description: The job, usually `queued`.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/VideoResponse'
                  - $ref: '#/components/schemas/Estimate'
                title: Response Create Video Api Apps  App Id  Media Videos Post
              example:
                id: video_6820f3a4e7b91d003c45a1f2
                status: queued
                model: veo_3_1_fast
                seconds: '8'
                created_at: '2026-11-23T10:00:00Z'
        '400':
          description: >-
            The request can't be served (`invalid_request_error`,
            `model_not_found`), for example an option the model doesn't support.
            `details.param` names the field.
          content:
            application/json:
              examples:
                invalid_request_error:
                  summary: invalid_request_error
                  value:
                    error:
                      code: invalid_request_error
                      message: '`n` must be between 1 and 4.'
                      details:
                        param: 'n'
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '402':
          description: >-
            The app's workspace doesn't have enough credits
            (`insufficient_quota`).
          content:
            application/json:
              examples:
                insufficient_quota:
                  summary: insufficient_quota
                  value:
                    error:
                      code: insufficient_quota
                      message: Not enough credits.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '403':
          description: >-
            The workspace's AI policy turns off media generation for this app
            (`forbidden`).
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    error:
                      code: forbidden
                      message: AI media generation is turned off for this app.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '404':
          description: >-
            The API isn't enabled for you, or the app doesn't exist or you can't
            edit it (`not_found`).
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    error:
                      code: not_found
                      message: Not found.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '409':
          description: >-
            `idempotency_in_progress`: A request with this `Idempotency-Key` is
            still running, or its outcome isn't known yet.
          content:
            application/json:
              examples:
                idempotency_in_progress:
                  summary: idempotency_in_progress
                  value:
                    error:
                      code: idempotency_in_progress
                      message: >-
                        A request with this Idempotency-Key is still running.
                        Retry shortly.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '422':
          description: >-
            The request body is invalid (`detail`). `idempotency_key_reused`:
            The `Idempotency-Key` was already used with a different request.
            `invalid_request`: The `Idempotency-Key` header is empty or longer
            than 128 characters.
          content:
            application/json:
              examples:
                idempotency_key_reused:
                  summary: idempotency_key_reused
                  value:
                    error:
                      code: idempotency_key_reused
                      message: >-
                        This Idempotency-Key was already used with a different
                        request.
                      details: {}
                invalid_request:
                  summary: invalid_request
                  value:
                    error:
                      code: invalid_request
                      message: Idempotency-Key must be 1 to 128 characters.
                      details: {}
              schema:
                anyOf:
                  - $ref: '#/components/schemas/HTTPValidationError'
                  - $ref: '#/components/schemas/StandardErrorEnvelope'
        '429':
          description: >-
            Too many requests (`rate_limited`). The base limit is 5 requests per
            60 seconds for each caller, raised by your plan's multiplier. Retry
            after the `Retry-After` seconds.
          content:
            application/json:
              examples:
                rate_limited:
                  summary: rate_limited
                  value:
                    error:
                      code: rate_limited
                      message: Rate limit exceeded.
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '502':
          description: >-
            The model provider or file storage couldn't complete the request
            (`internal_error`).
          content:
            application/json:
              examples:
                internal_error:
                  summary: internal_error
                  value:
                    error:
                      code: internal_error
                      message: Internal server error
                      details: {}
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
        '503':
          description: >-
            Database temporarily unavailable (`database_unavailable`): the data
            cluster did not answer in time. Retry after the `Retry-After`
            seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
              examples:
                database_unavailable:
                  summary: database_unavailable
                  value:
                    error:
                      code: database_unavailable
                      message: Database temporarily unavailable, please retry
                      details: {}
      security:
        - PersonalAccessTokenAuth:
            - full_access
        - WorkspaceApiKeyAuth:
            - full_access
        - WorkspaceApiKeyBearerAuth:
            - full_access
components:
  schemas:
    CreateVideoRequest:
      properties:
        dry_run:
          type: boolean
          title: Dry Run
          description: >-
            `true` returns a credit estimate without generating or charging;
            omit or `false` to generate
          default: false
        model:
          type: string
          maxLength: 100
          minLength: 1
          title: Model
          description: >-
            required; a video model id from List models (`type=video`), with
            values its capabilities allow
          examples:
            - veo_3_1_fast
        prompt:
          type: string
          maxLength: 10000
          minLength: 1
          title: Prompt
          description: required; what the clip shows
        seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seconds
          description: >-
            Clip length in seconds, within the model's `durations` from List
            models. Ask for the length the result needs, since a short clip
            can't be extended afterward. Omitted, the model's default applies.
          examples:
            - 8
        aspect_ratio:
          anyOf:
            - type: string
              maxLength: 20
            - type: 'null'
          title: Aspect Ratio
          description: output proportions, such as `16:9`
        resolution:
          anyOf:
            - type: string
              maxLength: 20
            - type: 'null'
          title: Resolution
          description: output pixel scale, such as `720p`
        reference_image_urls:
          items:
            type: string
          type: array
          maxItems: 8
          title: Reference Image Urls
          description: >-
            Public HTTPS image URLs, or this app's own files, that guide the
            output.
      additionalProperties: false
      type: object
      required:
        - model
        - prompt
      title: CreateVideoRequest
    Estimate:
      properties:
        dry_run:
          type: boolean
          const: true
          title: Dry Run
          description: 'Always `true`: nothing was generated or charged.'
        model:
          type: string
          title: Model
          description: The model that would serve the request.
          examples:
            - gpt_image_2
        usage:
          $ref: '#/components/schemas/MediaUsage'
      type: object
      required:
        - dry_run
        - model
        - usage
      title: Estimate
    VideoResponse:
      properties:
        id:
          type: string
          title: Id
          description: The video's ID, for Get a video.
          examples:
            - video_6820f3a4e7b91d003c45a1f2
        status:
          type: string
          enum:
            - queued
            - in_progress
            - completed
            - failed
          title: Status
        model:
          type: string
          title: Model
          examples:
            - veo_3_1_fast
        seconds:
          anyOf:
            - type: string
            - type: 'null'
          title: Seconds
          description: Clip length in seconds.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the job was created, ISO 8601 UTC.
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
          description: When the job finished, ISO 8601 UTC, or `null`.
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: >-
            Public URL of the MP4 once `completed`, else `null`. Anyone with the
            link can open it, and the link doesn't expire.
        error:
          anyOf:
            - $ref: '#/components/schemas/VideoFailure'
            - type: 'null'
          description: Why the job failed, or `null`.
        usage:
          anyOf:
            - $ref: '#/components/schemas/MediaUsage'
            - type: 'null'
          description: Credits charged, once known.
      type: object
      required:
        - id
        - status
        - model
        - seconds
        - created_at
        - completed_at
        - url
        - error
        - usage
      title: VideoResponse
    StandardErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/StandardError'
          description: What went wrong.
      type: object
      required:
        - error
      title: StandardErrorEnvelope
      description: The error body returned in the standard envelope.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MediaUsage:
      properties:
        credits:
          type: number
          title: Credits
          description: Credits charged to the app, or the estimate for a dry run.
          examples:
            - 4
      type: object
      required:
        - credits
      title: MediaUsage
    VideoFailure:
      properties:
        code:
          type: string
          title: Code
          description: Stable error code.
        message:
          type: string
          title: Message
          description: What went wrong.
      type: object
      required:
        - code
        - message
      title: VideoFailure
    StandardError:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable machine-readable cause of the failure. Match on this, not on
            `message`.
          example: not_found
        message:
          type: string
          title: Message
          description: Human-readable explanation. It isn't a stable contract.
          example: App not found
        details:
          additionalProperties: true
          type: object
          title: Details
          description: >-
            Structured context for the failure, or an empty object when there's
            none.
          example: {}
      type: object
      required:
        - code
        - message
      title: StandardError
    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:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: >-
        Workspace API key, sent as `api_key: <key>`. Each operation that accepts
        one lists what the key needs: a permission, `read_only` or
        `full_access`, like a personal access token, or a scope. A key without
        the scope gets 403 `workspace_api_key_scope_required`.
    WorkspaceApiKeyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key, sent as `Authorization: Bearer <key>`. Accepted
        wherever `api_key` is, with the same permission.

````

## Related topics

- [Creating a video to show off your app](https://docs.base44.com/promoting-your-app/show-off-video.md)
- [Using integrations](https://docs.base44.com/Integrations/Using-integrations.md)
- [Generate video with the AI Gateway](https://docs.base44.com/developers/references/sdk/getting-started/ai-gateway-video.md)
- [Creating images and videos with Base44 Studio](https://docs.base44.com/Building-your-app/base44-studio.md)
- [Using Base44 built-in integrations](https://docs.base44.com/Integrations/built-in-integrations.md)


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