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

# Upload Media File

Have a direct downloadable file URL? Use file\_url to copy it from any accessible HTTP/HTTPS cloud host into Creator Insights storage; URLs must return actual media without login. Small inline files up to 6 MiB can use file\_base64. If you only have a local file or a larger file, use create\_media\_upload, transfer bytes, then complete\_media\_upload. Returns ready and file\_url only after storage verification. Reuse that URL across platforms. Managed files are cleaned after all referencing publishing finishes; schedules retain their media. External source URLs are never deleted.

Verified uploads cost 2 credits once at completion; initialization and repeated completion are not charged again.

> [!NOTE]
>
> Examples use illustrative values. The playground sends a real request. Intelligence can consume plan credits. Publishing examples save drafts.

## Endpoint

**POST** `https://api.creatorinsights.in/api/v1/tools/upload_media_file`

**Content type:** application/json

**Authentication:** `x-api-key: YOUR_SAVED_API_KEY`

**MCP tool:** `upload_media_file`. See [MCP Setup](https://creatorinsights.mintlify.site/mcp-setup.md) for AI clients.

For paid MCP calls in an organization with multiple workspaces, pass the intended `workspace` ID. Calls without it are rejected before execution.

## Request parameters

**x-workspace-id** `string`

Active workspace ID or current name in your organization. Optional header alternative to passing workspace in the body.

**file\_url** `string`

Public URL of the media file to ingest and optimize

**media\_type** `string`

Media format type Allowed values: `image`, `video`.

**workspace** `string`

Workspace ID, current name, or immutable publishing key in the authenticated organization. Required for paid requests when more than one active workspace exists; pass an active workspace to select its accounts and data. Discover IDs with list\_workspaces; reuse the selected canonical ID throughout the workflow. Owned workspace ID, current name, or immutable publishing key. Omit to use the credential's assigned workspace; a legacy unbound key uses the primary workspace. The browser selection is not inferred. Discover IDs with list\_workspaces; reuse the selected canonical ID throughout the workflow.

**file** `object`

**file\_base64** `string`

Base64 data URI or base64 file contents (up to 6 MB). Use file\_url for large files. Local paths on your computer are not readable by the remote server.

**mime\_type** `string`

MIME type for base64 content. Checked against actual file signatures.

## Request example

Send these arguments directly as the JSON body.

```json theme={null}
{
  "file_url": "https://YOUR_PUBLIC_CDN.example/video.mp4",
  "workspace": "YOUR_WORKSPACE_ID_OR_CURRENT_NAME"
}
```

```bash cURL theme={null}
curl -X POST 'https://api.creatorinsights.in/api/v1/tools/upload_media_file' \
  -H "x-api-key: $CREATOR_INSIGHTS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"file_url":"https://YOUR_PUBLIC_CDN.example/video.mp4","workspace":"YOUR_WORKSPACE_ID_OR_CURRENT_NAME"}'
```

```javascript Node.js theme={null}
const response = await fetch('https://api.creatorinsights.in/api/v1/tools/upload_media_file', {
  method: 'POST',
  headers: { 'x-api-key': process.env.CREATOR_INSIGHTS_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
  "file_url": "https://YOUR_PUBLIC_CDN.example/video.mp4",
  "workspace": "YOUR_WORKSPACE_ID_OR_CURRENT_NAME"
})
});
const raw = await response.text();
let result;
try { result = JSON.parse(raw); } catch { throw new Error('Non-JSON response: ' + response.status); }
if (!response.ok || result.status === false) throw new Error(result.message || result.error || 'Request failed');
console.log(result.data);
```

```python Python theme={null}
import json, os, requests

arguments = json.loads("{\"file_url\":\"https://YOUR_PUBLIC_CDN.example/video.mp4\",\"workspace\":\"YOUR_WORKSPACE_ID_OR_CURRENT_NAME\"}")
response = requests.post("https://api.creatorinsights.in/api/v1/tools/upload_media_file",
    headers={"x-api-key": os.environ["CREATOR_INSIGHTS_API_KEY"]},
    json=arguments, timeout=120)
response.raise_for_status()
result = response.json()
print(result["data"])
```

## Response example

HTTP 200. Illustrative values; optional fields can be omitted, null, or empty. Additional platform fields may be returned.

```json Success theme={null}
{
  "status": true,
  "tool": "upload_media_file",
  "credits_deducted": 2,
  "data": {
    "success": true,
    "upload_id": "507f1f77bcf86cd799439011",
    "url_expires_at": null,
    "status": "ready",
    "file_url": "https://media.example.com/sample.mp4",
    "url": "https://media.example.com/sample.mp4",
    "media_type": "video",
    "mime_type": "video/mp4",
    "size_bytes": 1048576,
    "workspace": "Default"
  }
}
```

## Response fields

**status** `boolean` *required*

Whether this operation succeeded. Also check HTTP status and nested platform statuses.

**tool** `string` *required*

The invoked tool name.

**credits\_deducted** `number` *required*

Creator Insights plan credits for this call; the example is illustrative.

**data** `object` *required*

Operation-specific payload. See the nested field table and response example below.

| Field | Type | Description |
| - | - | - |
| `status` | boolean | Example response field. Availability depends on the record and selected options. |
| `tool` | string | Example response field. Availability depends on the record and selected options. |
| `credits_deducted` | number | Example response field. Availability depends on the record and selected options. |
| `data` | object | Nested object. Expand the response schema for its fields. |
| `data.success` | boolean | Example response field. Availability depends on the record and selected options. |
| `data.upload_id` | string | Example response field. Availability depends on the record and selected options. |
| `data.status` | string | Example response field. Availability depends on the record and selected options. |
| `data.file_url` | string | Example response field. Availability depends on the record and selected options. |
| `data.url` | string | Example response field. Availability depends on the record and selected options. |
| `data.media_type` | string | Example response field. Availability depends on the record and selected options. |
| `data.mime_type` | string | Example response field. Availability depends on the record and selected options. |
| `data.size_bytes` | integer | Example response field. Availability depends on the record and selected options. |
| `data.url_expires_at` | string or null | Example response field. Availability depends on the record and selected options. |
| `data.workspace` | string | Example response field. Availability depends on the record and selected options. |

The interactive schema includes deeper nested fields. Sample fields are descriptive, not a promise that every record includes them.

## n8n and JSON tool endpoint

**POST** `https://api.creatorinsights.in/api/v1/tools/upload_media_file`. Use Header Auth with `x-api-key` and body content type JSON. This alias returns the n8n envelope below; included operations can report zero credits\_deducted.

```bash theme={null}
curl -X POST 'https://api.creatorinsights.in/api/v1/tools/upload_media_file' \
  -H "x-api-key: $CREATOR_INSIGHTS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"file_url":"https://YOUR_PUBLIC_CDN.example/video.mp4","workspace":"YOUR_WORKSPACE_ID_OR_CURRENT_NAME"}'
```

```json theme={null}
{
  "status": true,
  "tool": "upload_media_file",
  "credits_deducted": 2,
  "data": {
    "success": true,
    "upload_id": "507f1f77bcf86cd799439011",
    "url_expires_at": null,
    "status": "ready",
    "file_url": "https://media.example.com/sample.mp4",
    "url": "https://media.example.com/sample.mp4",
    "media_type": "video",
    "mime_type": "video/mp4",
    "size_bytes": 1048576,
    "workspace": "Default"
  }
}
```

## Errors

Handle non-2xx responses before mapping data. Error codes vary with the cause; these are representative examples. A 429 response may be plain text. Never treat a queued post as published or blindly retry a partial publication.

```json theme={null}
{
  "status": false,
  "error": "Unauthorized: Invalid API Key. Please verify your Creator Insights API key."
}
```

| HTTP status | Meaning |
| - | - |
| 400 | Invalid arguments |
| 401 | Missing or invalid API key |
| 402 | Insufficient Creator Insights plan credits |
| 403 | Subscription or permission required |
| 404 | Resource not found |
| 409 | Conflicting request, idempotency key, or unfinished upload |
| 410 | Managed media expired; upload the file again |
| 413 | Media too large |
| 415 | Unsupported media type |
| 422 | Account selection, connection, or platform payload needs attention |
| 500 | Authentication or server error |
| 503 | Service temporarily unavailable or operation failed; inspect saved status before retrying |
| 429 | Rate limit; inspect response headers and retry later. |

## File transfer and retention

See [Media uploads](https://creatorinsights.mintlify.site/media-uploads.md) for direct file transfer, resumable uploads, n8n binary handling, MCP attachment limits, signed URLs and deletion after all publishing finishes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.