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

# Get Presigned Upload URL

> Get a temporary presigned URL to upload local files directly to S3

This endpoint generates a presigned S3 URL that allows you to upload files directly to Dubformer's storage. This is the first step when uploading local files.

<Note>
  **Use this endpoint for local file uploads only.** If your file is already hosted on a URL or in S3, you can skip this step and go directly to [Create Artifact](/studio/endpoints/artifacts/create-artifact-upload).
</Note>

## Query Parameters

<ParamField query="fileName" type="string" required>
  Name of the file with extension (e.g., `video.mp4`, `audio.wav`, `script.txt`).

  This is the actual file name, not the artifact display name. The extension is used to determine the file type.
</ParamField>

## Response

<ResponseField name="s3Path" type="string">
  S3 path where the file will be stored. You'll need this path when creating the artifact in Step 2.
</ResponseField>

<ResponseField name="presignedUploadUrl" type="string">
  Temporary presigned URL for uploading your file. Use this URL to upload via PUT request.
</ResponseField>

<ResponseField name="expiresAt" type="string">
  ISO 8601 timestamp when the presigned URL expires. Typically 24 hours from generation.
</ResponseField>

## Example Request

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET \
    'https://studio.dubformer.ai/api/v1/artifacts/create?fileName=my-video.mp4' \
    -H 'Authorization: Bearer YOUR_API_KEY'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://studio.dubformer.ai/api/v1/artifacts/create?fileName=my-video.mp4',
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://studio.dubformer.ai/api/v1/artifacts/create',
      params={'fileName': 'my-video.mp4'},
      headers={'Authorization': 'Bearer YOUR_API_KEY'}
  )

  data = response.json()
  print(data)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "s3Path": "s3://dubformer-artifacts/temp/550e8400-e29b-41d4-a716-446655440000/my-video.mp4",
    "presignedUploadUrl": "https://storage.dubformer.ai/uploads/67a8f9b0c1d2e3f4g5h6i7j8/source_video.mp4?X-Amz-Algorithm=...",
    "expiresAt": "2026-02-04T12:30:00.000Z"
  }
  ```
</ResponseExample>

## Next Step: Upload Your File

After receiving the presigned URL, upload your file using a PUT request:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT \
    "PRESIGNED_UPLOAD_URL_FROM_RESPONSE" \
    -H 'Content-Type: application/octet-stream' \
    --data-binary '@/path/to/your/my-video.mp4'
  ```

  ```javascript JavaScript theme={null}
  const file = document.getElementById('fileInput').files[0];

  const uploadResponse = await fetch(presignedUploadUrl, {
    method: 'PUT',
    body: file,
    headers: {
      'Content-Type': 'application/octet-stream'
    }
  });

  if (uploadResponse.ok) {
    console.log('File uploaded successfully');
  }
  ```

  ```python Python theme={null}
  with open('/path/to/your/my-video.mp4', 'rb') as file:
      upload_response = requests.put(
          presigned_upload_url,
          data=file,
          headers={'Content-Type': 'application/octet-stream'}
      )

  if upload_response.status_code == 200:
      print('File uploaded successfully')
  ```
</CodeGroup>

<Warning>
  The presigned URL expires after the time specified in `expiresAt` (typically 24 hours). Make sure to complete your upload before this time.
</Warning>

## Final Step: Create Artifact

After successfully uploading your file, create the artifact record using the `s3Path` from the response.

<Card title="Create Artifact" icon="arrow-right" href="/studio/endpoints/artifacts/create-artifact-upload">
  See full details on creating an artifact record
</Card>
