> ## 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 an upload URL

> Returns a pre-signed upload URL bound to the file's SHA-256. Upload the audio bytes with an HTTP `PUT` to that URL. The `PUT` must send the headers `Content-Type` (the declared `contentType`), `Content-Length` (the declared `contentLength`) and `X-Amz-Content-Sha256` (the declared `sha256`), with the same values you sent here. Otherwise the storage service refuses the upload with `403`, and the simulate call then returns `422`. After the upload succeeds, call `POST /api/v1/realcall/streams/simulate` with the returned `blobId`. Returns `422` if the file name does not end in `.mp3`, `.wav` or `.aiff`, or if the file is larger than 20 MB.



## OpenAPI

````yaml /openapi/realcall.json post /api/v1/realcall/streams/presign
openapi: 3.2.0
info:
  title: Reality Defender RealCall API
  version: 1.0.0
  description: >-
    The RealCall REST API provides programmatic access to real-time call
    analysis: streams, segments, test uploads, organization settings, API keys
    and webhooks.


    ## Getting started

    1. Create an API key in the Reality Defender web app under [API
    keys](https://app.realitydefender.ai/api-keys), or with `POST
    /api/v1/realcall/api-keys`. The plaintext key is shown only once, when it is
    created, so store it securely.

    2. Send the key in the `X-Api-Key` header on every request:


    ```bash

    curl -H "X-Api-Key: <your-key>" https://<host>/api/v1/realcall/settings

    ```


    ## Authentication

    Every request needs either an API key in the `X-Api-Key` header or a user
    access token in the `Authorization: Bearer <token>` header. An API key
    belongs to your organization and can call every RealCall operation;
    user-role restrictions apply only to bearer tokens. If a request sends both,
    the API key is used.


    ## Base path

    All endpoints are prefixed with `/api/v1/realcall/`.


    ## Conventions

    - `GET` — Retrieve one or more resources

    - `POST` — Create a new resource

    - `PUT` — Update an existing resource at a known identifier

    - `DELETE` — Permanently remove a resource


    ## Pagination

    List endpoints paginate by page: they accept `page` (zero-based, default 0)
    and `pageSize` (default 30, max 100), and return an `items` array alongside
    a `pagination` object with `currentPage`, `itemsPerPage` and `total`.


    ## Errors

    All error responses follow a consistent shape with `code`, `message`, and an
    optional `details` array.


    A `403` response has two meanings. With `code: org_not_enabled`, your
    organization does not have RealCall enabled; changing your user role does
    not fix it, so contact Reality Defender. A `403` without that code means
    your user role does not allow this operation. If both apply,
    `org_not_enabled` is returned. Neither is returned for requests made with an
    API key.
servers:
  - url: https://app.api.os.realitydefender.xyz
security:
  - BearerAuth: []
  - ApiKeyAuth: []
tags:
  - name: RealCall
    description: >-
      Real-time call analysis: streams, segments, test uploads, org settings,
      API keys and webhooks.
paths:
  /api/v1/realcall/streams/presign:
    post:
      tags:
        - RealCall
      summary: Request an upload URL
      description: >-
        Returns a pre-signed upload URL bound to the file's SHA-256. Upload the
        audio bytes with an HTTP `PUT` to that URL. The `PUT` must send the
        headers `Content-Type` (the declared `contentType`), `Content-Length`
        (the declared `contentLength`) and `X-Amz-Content-Sha256` (the declared
        `sha256`), with the same values you sent here. Otherwise the storage
        service refuses the upload with `403`, and the simulate call then
        returns `422`. After the upload succeeds, call `POST
        /api/v1/realcall/streams/simulate` with the returned `blobId`. Returns
        `422` if the file name does not end in `.mp3`, `.wav` or `.aiff`, or if
        the file is larger than 20 MB.
      operationId: createRealCallStreamPresign
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PresignRequest'
      responses:
        '200':
          description: A presigned upload URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PresignResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
        default:
          $ref: '#/components/responses/DefaultError'
      security:
        - BearerAuth:
            - REAL_CALL_WRITE_ACCESS
        - ApiKeyAuth: []
components:
  schemas:
    PresignRequest:
      type: object
      description: >-
        Describes the audio file you are about to upload, so a pre-signed upload
        URL bound to its SHA-256 can be issued. You upload the bytes directly to
        that URL.
      required:
        - fileName
        - contentType
        - contentLength
        - sha256
      properties:
        fileName:
          type: string
          minLength: 1
          description: >-
            Name of the audio file. It must end in `.mp3`, `.wav` or `.aiff`
            (case-insensitive); any other extension is rejected with `422`. It
            is shown as the call's original file name (`fileName` on the call).
          example: sample-call.wav
        contentType:
          type: string
          minLength: 1
          description: >-
            MIME type of the audio file. Accepted formats are MP3, WAV and AIFF
            (for example `audio/mpeg`, `audio/wav`, `audio/aiff`). The format is
            checked from the `fileName` extension.
          example: audio/wav
        contentLength:
          type: integer
          minimum: 1
          description: >-
            Size of the file in bytes. Maximum 20 MB (20,971,520 bytes); larger
            files are rejected with `422`.
          example: 1048576
        sha256:
          type: string
          pattern: ^[a-fA-F0-9]{64}$
          description: Hex-encoded SHA-256 of the file, computed client-side.
          example: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
    PresignResponse:
      type: object
      required:
        - blobId
        - uploadUrl
      properties:
        blobId:
          $ref: '#/components/schemas/Ksuid'
          description: Identifier to pass to the simulate call once the upload completes.
        uploadUrl:
          type: string
          format: uri
          description: >-
            Pre-signed URL to `PUT` the file bytes to. The `PUT` must send
            `Content-Type`, `Content-Length` and `X-Amz-Content-Sha256` set to
            the declared `contentType`, `contentLength` and `sha256`, or it is
            refused with `403`.
          example: https://storage.example.com/upload?...
    Ksuid:
      type: string
      description: Globally unique ID built to be chronologically sortable by timestamp
      example: 2nYn7qqkM5678Ks99ykvmZAr7pz
    ErrorWithDetails:
      allOf:
        - $ref: '#/components/schemas/Error'
        - properties:
            details:
              type: array
              nullable: true
              description: Optional list of field-level validation errors.
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The field path that caused the error.
                    example: email
                  issue:
                    type: string
                    description: A description of the issue with this field.
                    example: Must be a valid email address.
    Error:
      type: object
      description: Standard error response returned for all 4xx and 5xx status codes.
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Machine-readable error code.
          example: VALIDATION_ERROR
        message:
          type: string
          description: Human-readable description of the error.
          example: The request body contains invalid fields.
        details:
          type: array
          nullable: true
          description: Optional list of field-level validation errors.
          items:
            type: object
            properties:
              field:
                type: string
                description: The field path that caused the error.
                example: email
              issue:
                type: string
                description: A description of the issue with this field.
                example: Must be a valid email address.
  responses:
    BadRequest:
      description: Bad Request. The request was malformed or missing required fields.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/ErrorWithDetails'
              - properties:
                  code:
                    example: BAD_REQUEST
    Unauthorized:
      description: Unauthorized. No valid credential was provided.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - properties:
                  code:
                    example: UNAUTHORIZED
                  message:
                    example: Invalid or missing token
    Forbidden:
      description: >-
        Forbidden. The authenticated user does not have permission to perform
        this action.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - properties:
                  code:
                    example: FORBIDDEN
    UnprocessableEntity:
      description: >-
        Unprocessable Entity. The request was well-formed but failed validation
        rules.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/ErrorWithDetails'
              - properties:
                  code:
                    example: UNPROCESSABLE_ENTITY
    InternalServerError:
      description: Internal Server Error. An unexpected error occurred on the server.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - properties:
                  code:
                    example: INTERNAL_SERVER_ERROR
    DefaultError:
      description: An error response in the standard shape.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorWithDetails'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Bearer token. Obtain a token via your identity provider and pass it
        in the `Authorization: Bearer <token>` header.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Organization API key, sent in the `X-Api-Key` header. Create one in the
        web app under API keys. API-key requests are not subject to user-role
        restrictions.

````