{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nopaque-co-uk/json-schema/nopaque-co-uk-create-audio-upload-url-request-schema.json",
  "title": "CreateAudioUploadUrlRequest",
  "description": "Request body for `POST /audio/upload-url`. The server creates the metadata\nrecord up-front and returns a presigned PUT URL — the client uploads the bytes\ndirectly to S3 outside this API (no body forwarded through the gateway).\n",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nopaque-co-uk-audio-api-openapi.yml#/components/schemas/CreateAudioUploadUrlRequest",
  "type": "object",
  "required": [
    "filename",
    "contentType",
    "category",
    "sizeBytes"
  ],
  "properties": {
    "filename": {
      "type": "string",
      "maxLength": 255,
      "description": "Client-supplied filename. Will be sanitised before forming the S3 key."
    },
    "contentType": {
      "type": "string",
      "enum": [
        "audio/wav",
        "audio/x-wav",
        "audio/wave",
        "audio/vnd.wave",
        "audio/mpeg",
        "audio/mp3"
      ],
      "description": "MIME type of the upload. WAV or MP3 only. Matching is case-insensitive and MIME\nparameters (e.g. `; charset=binary`) are ignored. The value you send is signed\ninto the presigned URL, so the PUT must send exactly this `Content-Type` string.\n"
    },
    "category": {
      "$ref": "#/$defs/AudioCategory"
    },
    "associatedId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Optional owning entity id (e.g. a test run id). Defaults to a new uuid when omitted.\nSanitised when used in the S3 key; stored verbatim on the metadata row.\n"
    },
    "durationSecs": {
      "type": "number",
      "description": "Optional declared duration in seconds. Stored on the metadata row."
    },
    "sizeBytes": {
      "type": "integer",
      "minimum": 1,
      "maximum": 52428800,
      "description": "Required. The exact size of the file in bytes (maximum 52428800, 50 MB). Stored on\nthe metadata row and signed into the presigned URL as `Content-Length`, so the PUT\nbody must be exactly this many bytes.\n"
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true,
      "description": "Arbitrary client-supplied metadata stored alongside the audio row."
    }
  },
  "$defs": {
    "AudioCategory": {
      "type": "string",
      "enum": [
        "test",
        "map",
        "voice",
        "transcript"
      ],
      "description": "Bucket used by the upload-URL handler to derive the S3 key. Audio files\nfor test runs live under `tests/`, mapping recordings under `maps/`, voice\nprofiles under `voices/`, and transcript audio under `transcripts/`.\n"
    }
  }
}