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

# Generate Audio Upload URL

> Generate a presigned URL for uploading an audio file (Enterprise only)

<Note>This endpoint is available only for Enterprise plan users.</Note>

### Request Body

<ParamField body="fileExtension" type="string" required>
  The file extension of the audio file (e.g., `m4a`, `mp3`, `wav`, `aac`)
</ParamField>

<ParamField body="duration" type="number" required>
  Duration of the audio file in seconds (maximum 4 hours / 14400 seconds)
</ParamField>

### Response

<ResponseField name="presignedUrl" type="string">
  The presigned URL to upload the audio file using PUT request
</ResponseField>

<ResponseField name="audioUrl" type="string">
  The final URL where the audio will be accessible after upload
</ResponseField>

<ResponseField name="contentType" type="string">
  The content type to use when uploading the file
</ResponseField>

<RequestExample>
  ```bash curl theme={null}

  curl --request POST \
   --url https://api.caret.so/v1/notes/from-audio/generate-upload-url \
   --header 'Authorization: Bearer <your_api_key>' \
   --header 'Content-Type: application/json' \
   --data '{
  "fileExtension": "m4a",
  "duration": 3600
  }'

  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "presignedUrl": "https://caret-cdn.s3.us-west-1.amazonaws.com/audio/temp_upload_...",
    "audioUrl": "https://caret-cdn.s3.us-west-1.amazonaws.com/audio/temp_upload_...",
    "contentType": "audio/mp4"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": {
      "code": "bad_request",
      "message": "Duration is too long"
    }
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "error": {
      "code": "forbidden",
      "message": "API key does not have the required permissions"
    }
  }
  ```
</ResponseExample>

### Usage

After receiving the presigned URL, upload your audio file:

```bash theme={null}
curl --request PUT \
  --url "<presignedUrl>" \
  --header "Content-Type: audio/mp4" \
  --data-binary @your-audio-file.m4a
```

Then use the `audioUrl` with the [Create Note from Audio](/api-reference/notes/create-from-audio) endpoint.
