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

# Get Upload Url

> Generate a presigned URL for direct S3 upload.

This endpoint:
1. Validates the dataset exists and belongs to the tenant
2. Creates a pending AudioFile record in the database
3. Generates a presigned POST URL for direct browser upload to S3

The client should:
1. Use the returned URL and fields to construct a multipart/form-data POST
2. Upload the file directly to S3
3. Call the confirm endpoint to mark the upload as complete



## OpenAPI

````yaml post /api/v1/datasets/{dataset_id}/audio/upload-url
openapi: 3.1.0
info:
  title: Relay API
  description: Voice AI Artifact Detection Platform
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/datasets/{dataset_id}/audio/upload-url:
    post:
      tags:
        - audio
      summary: Get Upload Url
      description: >-
        Generate a presigned URL for direct S3 upload.


        This endpoint:

        1. Validates the dataset exists and belongs to the tenant

        2. Creates a pending AudioFile record in the database

        3. Generates a presigned POST URL for direct browser upload to S3


        The client should:

        1. Use the returned URL and fields to construct a multipart/form-data
        POST

        2. Upload the file directly to S3

        3. Call the confirm endpoint to mark the upload as complete
      operationId: get_upload_url_api_v1_datasets__dataset_id__audio_upload_url_post
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Dataset Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadUrlRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadUrlResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    UploadUrlRequest:
      properties:
        filename:
          type: string
          maxLength: 500
          minLength: 1
          title: Filename
        content_type:
          type: string
          title: Content Type
          description: MIME type of the audio file
        file_size:
          type: integer
          exclusiveMinimum: 0
          title: File Size
          description: File size in bytes
      type: object
      required:
        - filename
        - content_type
        - file_size
      title: UploadUrlRequest
      description: Request schema for generating a presigned upload URL.
    UploadUrlResponse:
      properties:
        upload_url:
          type: string
          title: Upload Url
          description: Presigned URL for direct S3 upload
        fields:
          additionalProperties:
            type: string
          type: object
          title: Fields
          description: Form fields to include in POST request
        key:
          type: string
          title: Key
          description: S3 object key
        expires_in:
          type: integer
          title: Expires In
          description: URL expiration in seconds
        audio_id:
          type: string
          format: uuid
          title: Audio Id
          description: ID of the created audio file record
      type: object
      required:
        - upload_url
        - fields
        - key
        - expires_in
        - audio_id
      title: UploadUrlResponse
      description: Response schema for presigned upload URL.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````