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

# Upload Ads

> Upload video files or URLs to AdManage for ad creation

Upload a video file directly to AdManage for ad creation. Images and Videos are supported.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.admanage.ai/upload" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "file=@/path/to/your/file.mp4"
  ```

  ```javascript JavaScript theme={null}
  const formData = new FormData();
  formData.append('file', /* your file object */);

  fetch('https://api.admanage.ai/upload', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: formData
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
  ```

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

  files = {
      'file': open('path/to/your/file.mp4', 'rb')
  }
  headers = {
      'Authorization': 'Bearer YOUR_API_KEY'
  }
  response = requests.post(
      'https://api.admanage.ai/upload',
      headers=headers,
      files=files
  )
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "url": "https://media.admanage.ai/company-name/filename.png",
    "filename": "filename_suffix.png",
    "originalName": "filename.png",
    "wasRenamed": true,
    "dimensions": {
      "format": "png",
      "size": 145523,
      "width": 960,
      "height": 694,
      "space": "srgb",
      "channels": 3,
      "depth": "uchar",
      "density": 72,
      "isProgressive": false,
      "hasProfile": false,
      "hasAlpha": false,
      "exif": {
        "type": "Buffer",
        "data": [77, 77, 0, 42, 0, 0, 0, 8, 0, 1, 135, 105, 0, 4, 0, 0, 0, 1, 0, 0, 0, 26, 0, 0, 0, 0, 0, 3, 160, 1, 0, 3, 0, 0, 0, 1, 0, 1, 0, 0, 160, 2, 0, 4, 0, 0, 0, 1, 0, 0, 3, 192, 160, 3, 0, 4, 0, 0, 0, 1, 0, 0, 2, 182, 0, 0, 0, 0]
      }
    },
    "size": 145523,
    "sizeFormatted": "142.11 KB"
  }
  ```
</ResponseExample>

### Parameters

<ParamField body="file" type="file" required>
  The video file to upload. Supported formats: MP4, MOV, AVI. Maximum size: 100MB.
</ParamField>

***

## Upload from URL

Upload a video from a URL to AdManage for ad creation.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.admanage.ai/upload/url" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"url": "https://example.com/video.mp4"}'
  ```

  ```javascript JavaScript theme={null}
  fetch('https://api.admanage.ai/upload/url', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      url: 'https://example.com/video.mp4'
    })
  })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
  ```

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

  headers = {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
  }
  response = requests.post(
      'https://api.admanage.ai/upload/url',
      headers=headers,
      json={'url': 'https://example.com/video.mp4'}
  )
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "url": "https://media.admanage.ai/admanage.ai/video_sample_xyz123.mp4",
    "filename": "video_sample_xyz123.mp4",
    "originalName": "video.mp4",
    "wasRenamed": true,
    "id": 11110,
    "dimensions": {
      "format": "mp4",
      "size": 12582912,
      "width": 1280,
      "height": 720,
      "duration": 25.2,
      "bitrate": 4000000,
      "framerate": 30
    },
    "size": 12582912,
    "sizeFormatted": "12.00 MB"
  }
  ```
</ResponseExample>

### Parameters

<ParamField body="url" type="string" required>
  The URL of the video file to upload. Must be publicly accessible and point to a supported video format.
</ParamField>

***

## Response Fields

<ResponseField name="success" type="boolean">
  Indicates whether the upload was successful.
</ResponseField>

<ResponseField name="url" type="string">
  The CDN URL where the uploaded file can be accessed.
</ResponseField>

<ResponseField name="filename" type="string">
  The final filename of the uploaded file (may include suffix if renamed).
</ResponseField>

<ResponseField name="originalName" type="string">
  The original filename of the uploaded file.
</ResponseField>

<ResponseField name="wasRenamed" type="boolean">
  Indicates whether the file was renamed during upload to avoid conflicts.
</ResponseField>

<ResponseField name="id" type="number">
  Unique identifier for the uploaded file. Use this ID to reference the file in other API calls.
</ResponseField>

<ResponseField name="dimensions" type="object">
  Detailed information about the file's dimensions and metadata.

  <Expandable title="dimensions properties">
    <ResponseField name="format" type="string">
      The format of the uploaded file (e.g., "png", "mp4", "jpg").
    </ResponseField>

    <ResponseField name="size" type="number">
      The size of the file in bytes.
    </ResponseField>

    <ResponseField name="width" type="number">
      The width of the image/video in pixels.
    </ResponseField>

    <ResponseField name="height" type="number">
      The height of the image/video in pixels.
    </ResponseField>

    <ResponseField name="duration" type="number">
      (Video files only) The duration of the video in seconds.
    </ResponseField>

    <ResponseField name="bitrate" type="number">
      (Video files only) The bitrate of the video.
    </ResponseField>

    <ResponseField name="framerate" type="number">
      (Video files only) The framerate of the video.
    </ResponseField>

    <ResponseField name="space" type="string">
      (Image files only) The color space of the image.
    </ResponseField>

    <ResponseField name="channels" type="number">
      (Image files only) The number of color channels.
    </ResponseField>

    <ResponseField name="depth" type="string">
      (Image files only) The bit depth of the image.
    </ResponseField>

    <ResponseField name="density" type="number">
      (Image files only) The pixel density (DPI).
    </ResponseField>

    <ResponseField name="isProgressive" type="boolean">
      (Image files only) Whether the image is progressive.
    </ResponseField>

    <ResponseField name="hasProfile" type="boolean">
      (Image files only) Whether the image has a color profile.
    </ResponseField>

    <ResponseField name="hasAlpha" type="boolean">
      (Image files only) Whether the image has an alpha channel.
    </ResponseField>

    <ResponseField name="exif" type="object">
      (Image files only) EXIF metadata from the image file.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="size" type="number">
  The size of the uploaded file in bytes.
</ResponseField>

<ResponseField name="sizeFormatted" type="string">
  Human-readable formatted file size (e.g., "142.11 KB", "12.00 MB").
</ResponseField>

***

## Error Responses

<ResponseExample>
  ```json File Too Large theme={null}
  {
    "success": false,
    "error": "FILE_TOO_LARGE",
    "message": "File size exceeds the maximum limit of 100MB",
    "details": {
      "fileSize": 157286400,
      "maxSize": 104857600
    }
  }
  ```

  ```json Invalid Format theme={null}
  {
    "success": false,
    "error": "INVALID_FORMAT",
    "message": "Unsupported file format. Supported formats: MP4, MOV, AVI, PNG, JPG, JPEG",
    "details": {
      "detectedFormat": "webp"
    }
  }
  ```

  ```json URL Not Accessible theme={null}
  {
    "success": false,
    "error": "URL_NOT_ACCESSIBLE",
    "message": "The provided URL is not accessible or does not contain a valid file",
    "details": {
      "url": "https://example.com/invalid.mp4"
    }
  }
  ```
</ResponseExample>
