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

# Submit a video

> Uploads an MP4 or MOV video (at most 200 MB and 3 minutes) for analysis and answers `202` right away with the analysis id and an estimated finish time. The analysis runs in the background. Needs a full-access API key created by a user: the analysis is attributed to that user. Limits: 20 submissions an hour and 5 unfinished at a time per user, and 100 a day per organization.

> [!NOTE]
>
> Send the file as `multipart/form-data`, in a field named `video`. Growi reads the
> duration from the file itself, so a video whose duration can't be read is refused
> with `422 video_duration_unreadable`. Export it again as a standard (not fragmented)
> MP4 or MOV and retry.

> [!TIP]
>
> Send an `Idempotency-Key` so a retry after a timeout can't start a second analysis.
> See [idempotency](https://growi.mintlify.site/essentials/video-analysis.md#retries-and-idempotency).

```bash theme={"dark"}
curl -X POST https://api.growi.io/api/public/v1/video_analyses \
  -H "Authorization: Bearer growi-sk-YOUR-API-KEY" \
  -H "Idempotency-Key: spring-04" \
  -F "video=@spring-04.mp4" \
  -F "external_id=spring-04" \
  -F 'notify={"channels": ["email", "slack"]}'
```


## OpenAPI

````yaml POST /video_analyses
openapi: 3.0.1
info:
  title: Growi API
  description: >-
    API documentation for Growi platform, showcasing the public tracking event
    endpoint
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.growi.io/api/public/v1
security:
  - bearerAuth: []
paths:
  /video_analyses:
    post:
      summary: Submit a video
      description: >-
        Uploads an MP4 or MOV video (at most 200 MB and 3 minutes) for analysis
        and answers `202` right away with the analysis id and an estimated
        finish time. The analysis runs in the background. Needs a full-access
        API key created by a user: the analysis is attributed to that user.
        Limits: 20 submissions an hour and 5 unfinished at a time per user, and
        100 a day per organization.
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Optional, up to 255 characters. Sending the same key again returns
            the original analysis, with the `Idempotent-Replayed: true` header,
            instead of starting another. Keys are scoped to the user who created
            the API key.
          schema:
            type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                video:
                  type: string
                  format: binary
                  description: >-
                    The video file, MP4 or MOV, at most 200 MB and 3 minutes
                    long
                notify:
                  type: string
                  description: >-
                    Who to notify when the analysis finishes, as JSON:
                    `{"channels": ["email", "slack", "discord"]}`, any of the
                    three. Leave it out to follow your AI media analysis
                    notification settings. Your organization's webhooks always
                    get the events, except for `submission_interrupted` failures
                    from uploads that never complete
                external_id:
                  type: string
                  description: >-
                    Your own reference, up to 255 characters. Returned with the
                    analysis and in its webhook events
              required:
                - video
      responses:
        '202':
          description: >-
            Accepted. The analysis is queued. Also the answer to a repeated
            `Idempotency-Key`, with the `Idempotent-Replayed: true` header and
            that analysis's current status. While it's unfinished, the repeat
            carries the same live status and estimate as `GET
            /video_analyses/{id}`; the estimate is `null` only when there's none
            right now or the start isn't confirmed yet
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      status:
                        type: string
                      eta_seconds:
                        type: integer
                        nullable: true
                        description: >-
                          Estimated seconds until the analysis is finished (an
                          estimate, not a promise). Only while queued or
                          processing; null when no estimate is available.
                      eta_at:
                        type: string
                        format: date-time
                        nullable: true
                        description: The same estimate as an instant (UTC).
                    required:
                      - id
                      - status
                required:
                  - data
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiCodedError'
        '403':
          description: >-
            The key is read-only (viewer), wasn't created by a user, or its user
            was deleted. Use a full-access key created by a user
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '409':
          description: >-
            `idempotency_in_progress`: a request with this `Idempotency-Key` is
            still uploading its video. Retry in a moment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiCodedError'
        '413':
          description: '`video_too_large`: the video is over 200 MB'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '415':
          description: '`unsupported_video`: the file isn''t an MP4 or MOV video'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '422':
          description: >-
            `video_required`, `video_too_long` (over 3 minutes),
            `video_duration_unreadable`, `invalid_notify`, `invalid_external_id`
            or `invalid_idempotency_key`. `error` says what to fix
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '429':
          description: >-
            `rate_limited`: a submission limit was reached, and `limit` says
            which (`user_hourly`, `user_in_flight` or `organization_daily`). The
            API's own rate limit (2 seconds between calls and an hourly cap)
            also answers 429, without a `code`. Wait for `Retry-After`
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                  limit:
                    type: string
                    enum:
                      - user_hourly
                      - user_in_flight
                      - organization_daily
                  retry_after:
                    type: integer
        '502':
          description: >-
            `upload_failed` (the video couldn't be stored) or
            `submission_rejected` (the analysis couldn't be started). Nothing
            was kept, so you can retry, with the same `Idempotency-Key`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiCodedError'
        '503':
          description: >-
            `analysis_unavailable`: video analysis is temporarily unavailable.
            Nothing was kept. Retry after `Retry-After` seconds
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
components:
  schemas:
    ApiCodedError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: What went wrong
        code:
          type: string
          description: >-
            Machine-readable error code. Missing on authentication and
            rate-limit errors
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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