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

# Upload the file to the signed URL

> Step 2 of 2 of the file upload flow. `PUT` the file to the `signedUrl`
returned by `POST /api/files/aws-presigned`, exactly as returned: it
already carries the `requestId` and the `token` query parameter.

No `X-API-KEY` header is needed; the token authorizes the upload.

Send only the raw file bytes as the body. Send a non-form
`Content-Type` (for example `application/octet-stream` or the file's
MIME type), or none. `multipart/*`, `application/x-www-form-urlencoded`
and `application/json` are rejected with 415.

With curl, use `curl -T your-file.mp4 '<signedUrl>'`, or
`curl -X PUT -H 'Content-Type: application/octet-stream' --data-binary '@your-file.mp4' '<signedUrl>'`.
Quote the URL. Plain `--data-binary` without a Content-Type header
sends `application/x-www-form-urlencoded` and is rejected.



## OpenAPI

````yaml /openapi/realscan.json put /api/files/{requestId}
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/{requestId}:
    put:
      tags:
        - RealScan
      summary: Upload the file to the signed URL
      description: >-
        Step 2 of 2 of the file upload flow. `PUT` the file to the `signedUrl`

        returned by `POST /api/files/aws-presigned`, exactly as returned: it

        already carries the `requestId` and the `token` query parameter.


        No `X-API-KEY` header is needed; the token authorizes the upload.


        Send only the raw file bytes as the body. Send a non-form

        `Content-Type` (for example `application/octet-stream` or the file's

        MIME type), or none. `multipart/*`, `application/x-www-form-urlencoded`

        and `application/json` are rejected with 415.


        With curl, use `curl -T your-file.mp4 '<signedUrl>'`, or

        `curl -X PUT -H 'Content-Type: application/octet-stream' --data-binary
        '@your-file.mp4' '<signedUrl>'`.

        Quote the URL. Plain `--data-binary` without a Content-Type header

        sends `application/x-www-form-urlencoded` and is rejected.
      operationId: uploadFile
      parameters:
        - name: requestId
          required: true
          in: path
          description: Request ID returned by `POST /api/files/aws-presigned`.
          schema:
            type: string
        - name: token
          required: true
          in: query
          description: >-
            Upload token embedded in the signed URL. It is only valid for this
            `requestId` and expires 15 minutes after it is issued.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
          '*/*':
            schema:
              type: string
              format: binary
      responses:
        '200':
          description: File stored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadFileResponse'
              example:
                requestId: 8b0d4c1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e
                bucket: <bucket>
                key: >-
                  3f2a1b4c-5d6e-4f70-8a9b-0c1d2e3f4a5b/8b0d4c1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e/8b0d4c1e-2f3a-4b5c-8d6e-7f8a9b0c1d2e.mp4
                versionId: <version-id>
        '400':
          description: >-
            The upload stream is unavailable or already read, or the stored file
            is rejected: `file-too-large`, `file-empty`,
            `upload-min-limit-not-reached` (text shorter than 200 characters). A
            rejected file is deleted and the scan is marked failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: Invalid or expired token, or a token issued for another request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '415':
          description: Form, multipart or JSON body instead of raw file bytes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnsupportedMediaError'
        default:
          description: Default error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseError'
      security: []
components:
  schemas:
    UploadFileResponse:
      type: object
      properties:
        requestId:
          type: string
          description: Request ID of the upload.
        bucket:
          type: string
          description: Storage bucket the file was written to.
        key:
          type: string
          description: Storage key of the file.
        versionId:
          type: string
          description: Storage version of the file, when versioning is enabled.
      required:
        - requestId
        - bucket
        - key
    BadRequestError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              const: 400
    UnauthorizedError:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            statusCode:
              const: 401
    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`).
  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.

````