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

# Request a signed upload URL

> Step 1 of 2 of the file upload flow. Returns a temporary upload URL in
`response.signedUrl` and the `requestId` used later to fetch the result
from `GET /api/media/users/{requestId}`. Step 2 is to `PUT` the file to
that URL (`PUT /api/files/{requestId}`).

### Supported file types

- Images: `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`, `.heic`, `.heif`, `.avif`
- Audio: `.wav`, `.mp3`, `.ogg`, `.amr`, `.flac`, `.aac`, `.m4a`, `.alac`
- Video: `.mp4`, `.mov`, `.mkv`, `.webm`, `.avi`, `.ts`
- Text: `.txt`, `.rtf`

### Size limits

- Text: up to 900 KB
- Images: up to 50 MB
- Audio: up to 20 MB
- Video: up to 250 MB. Videos longer than 30 minutes are accepted but
  not analyzed (NOT_APPLICABLE reason `duration: video too long`).

### Filename rules

- Maximum length: 200 characters, including the extension
- The extension is matched case-insensitively
- The scan's `filename` is a normalized copy (runs of non-word
  characters become `_`, lowercased, with a timestamp suffix);
  `originalFileName` keeps the name as sent.



## OpenAPI

````yaml /openapi/realscan.json post /api/files/aws-presigned
openapi: 3.1.1
info:
  title: Reality Defender RealScan API
  description: |-
    > **Note:** Reality Defender recommends the
    > [Reality Defender SDKs](/sdks/quickstart) (Python, TypeScript, Go, Java
    > and Rust) for most integrations.

    ## Authentication

    Every request except `PUT /api/files/{requestId}` (authorized by its
    `token`) and `GET /api/health` must send your API key in the `X-API-KEY`
    header (header names are case-insensitive). Create a key on the Reality
    Defender web platform under
    [API keys](https://app.realitydefender.ai/api-keys).

    API keys are linked to a user. Organization owners, admins and viewers
    can view uploads from all users in the organization; contributors see
    only their own.

    ## Workflow

    1. Request a signed upload URL with `POST /api/files/aws-presigned`.
    2. `PUT` the file to the returned `signedUrl`. Alternatively, skip both
       steps and submit a social media URL with `POST /api/files/social`.
    3. Poll `GET /api/media/users/{requestId}` until the scan reaches a final
       status, or set up a webhook. Analysis time varies with file size and
       type.

    ## Interpreting results

    Focus on the ensemble result (`overallStatus` and `resultsSummary`) rather
    than on individual model results.
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.prd.realitydefender.xyz
security:
  - apiKey: []
tags:
  - name: RealScan
    description: >-
      Deepfake detection for uploaded files and social media links: upload, scan
      status and results, usage, and feedback.
paths:
  /api/files/aws-presigned:
    post:
      tags:
        - RealScan
      summary: Request a signed upload URL
      description: >-
        Step 1 of 2 of the file upload flow. Returns a temporary upload URL in

        `response.signedUrl` and the `requestId` used later to fetch the result

        from `GET /api/media/users/{requestId}`. Step 2 is to `PUT` the file to

        that URL (`PUT /api/files/{requestId}`).


        ### Supported file types


        - Images: `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`, `.heic`, `.heif`,
        `.avif`

        - Audio: `.wav`, `.mp3`, `.ogg`, `.amr`, `.flac`, `.aac`, `.m4a`,
        `.alac`

        - Video: `.mp4`, `.mov`, `.mkv`, `.webm`, `.avi`, `.ts`

        - Text: `.txt`, `.rtf`


        ### Size limits


        - Text: up to 900 KB

        - Images: up to 50 MB

        - Audio: up to 20 MB

        - Video: up to 250 MB. Videos longer than 30 minutes are accepted but
          not analyzed (NOT_APPLICABLE reason `duration: video too long`).

        ### Filename rules


        - Maximum length: 200 characters, including the extension

        - The extension is matched case-insensitively

        - The scan's `filename` is a normalized copy (runs of non-word
          characters become `_`, lowercased, with a timestamp suffix);
          `originalFileName` keeps the name as sent.
      operationId: getAwsPresignedUrl
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostAWSPresignedURLRequest'
            example:
              fileName: your-file.mp4
      responses:
        '200':
          description: Signed upload URL and the request ID of the new scan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostAWSPresignedURLResponse'
              example:
                code: ok
                errno: 0
                mediaId: 8b0d4c1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e
                requestId: 8b0d4c1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e
                response:
                  signedUrl: >-
                    https://api.prd.realitydefender.xyz/api/files/8b0d4c1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e?token=<token>
        '400':
          description: |-
            Invalid or missing fields, values, or parameters: a missing or
            empty `fileName` (validation error, `code` is `null`). Error codes:
            `filename-exceeded-maximum-length` (more than 200 characters),
            `file-too-large` (the declared `fileSize` exceeds the limit for its
            media type; checked only when `fileSize` is sent, and the real size
            is checked again on upload), `upload-limit-reached` (no scan credits
            left and no overage plan).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: Unauthorized, authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: >-
            Forbidden. Error codes: `free-tier-restriction` (video, audio, and
            text

            uploads require a paid plan), `text-detection-disabled` (text scans

            are not enabled for the organization). Also returned for the viewer

            role.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '415':
          description: 'Unsupported file format. Error code: `unsupported-file-format`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnsupportedMediaError'
        default:
          description: Default error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseError'
components:
  schemas:
    PostAWSPresignedURLRequest:
      type: object
      properties:
        fileName:
          type: string
          description: Name of the file to upload, including its extension.
        fileSize:
          type: number
          description: >-
            File size in bytes, checked against the size limit for its media
            type.
        originUI:
          type: boolean
          description: Ignored by the API.
        showAudioResult:
          type: boolean
          description: >-
            For video, also analyze the extracted audio. Defaults to the
            organization setting.
        contentPreview:
          type: string
          description: Text preview for text uploads.
        tags:
          minItems: 1
          type: array
          description: Labels to attach to the scan.
          items:
            type: string
            minLength: 1
            maxLength: 128
      required:
        - fileName
    PostAWSPresignedURLResponse:
      type: object
      properties:
        code:
          type: string
          description: '`ok` on success.'
        response:
          $ref: '#/components/schemas/PostAWSPresignedUrl'
        errno:
          type: number
          description: '`0` on success.'
        mediaId:
          type: string
          description: Same value as `requestId`.
        requestId:
          type: string
          description: ID used to fetch the result from `GET /api/media/users/{requestId}`.
      required:
        - code
        - response
        - errno
        - mediaId
        - requestId
    BadRequestError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              const: 400
    UnauthorizedError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              const: 401
    ForbiddenError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              const: 403
    UnsupportedMediaError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              const: 415
    BaseError:
      type: object
      properties:
        statusCode:
          type: integer
        path:
          type: string
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        code:
          oneOf:
            - type: string
              nullable: true
            - type: number
            - type: boolean
            - type: array
              items:
                type: string
        type:
          type: string
          description: >-
            Present only for import errors (for example
            `unsupported-file-format`).
        name:
          type: string
          description: >-
            Present only for import errors (for example
            `unsupported-file-format`).
        explanation:
          type: string
          description: >-
            Present only for import errors (for example
            `unsupported-file-format`).
    PostAWSPresignedUrl:
      type: object
      properties:
        signedUrl:
          type: string
          description: >-
            Temporary URL to `PUT` the file bytes to. It already carries the
            request ID and the upload token.
      required:
        - signedUrl
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        API key created in the web app under API keys. Expired or disabled keys
        are rejected with 401.

````