> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.aventure.vc/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.aventure.vc/_mcp/server.

# Upload media asset

POST https://api.aventure.vc/v1/media/upload
Content-Type: multipart/form-data

Uploads bytes to R2 and may attach the managed path; CLI/MCP URLs are fetched. Agent ENTITY and PERSON uploads must cite the exact source image in sourceDetail; PERSON images must be named headshot photos, not avatar CDNs.

Reference: https://docs.aventure.vc/api-reference/a-venture-api/media/upload-media

## Authentication

- `Authorization` header (bearer token, required) — User bearer token: Supabase or Clerk session JWT, Clerk OAuth access token, or Clerk personal API key
- `X-API-Key` header (required) — Admin API key for system-to-system write operations

## Request

### Query parameters

- `mediaType` (enum, required) — Media target type.
  - Allowed values: `ENTITY`, `PERSON`, `NEWS`, `BLOG`
- `id` (string, optional) — Target UUID for entity/person or integer id for news.
- `slug` (string, optional) — Target slug.
- `logoType` (enum, optional) — Entity logo variant.
  - Allowed values: `SQUARE`, `STANDARD`
- `permitWide` (boolean, optional, default: false) — Fallback that permits a wide (non-square) logo or photo into the square slot, used only after confirming no square or near-square source exists. Default false rejects wide wordmark/banner content for ENTITY/PERSON. Blank or invisible images are always rejected regardless of this flag.
- `overrideGate` (enum, optional) — Gate to override from the prior ProblemDetail resolution.
  - Allowed values: `duplicate`, `entity-publication-requirements`, `square-logo-deletion`, `current-classification-removal`, `news-thumbnail-required`, `news-article-url-fetch`, `news-dated-slug`, `brand-match`, `type-structure-contradiction`
- `overrideReason` (string, optional) — Source-backed reason for overriding the returned gate requirement.
- `sourceType` (enum, required) — Write provenance source type.
  - Allowed values: `requestChangeForm`, `newsArticle`, `blogArticle`, `firstPartyWebsite`, `relatedPartyWebsite`, `thirdPartyWebsite`, `llm`, `aventureStaff`
- `sourceDetail` (string, required) — Source detail or reviewer reference for the write.
- `sourceProvider` (string, optional) — Provider name for provider-native IDs or slugs.
- `sourceProviderId` (string, optional) — Provider-native source ID.
- `sourceProviderSlug` (string, optional) — Provider-native source slug.
- `actorType` (enum, optional) — Actor type; inferred as agent when agentChassis and agentModel are supplied, or as employee from an authenticated user JWT session.
  - Allowed values: `agent`, `employee`
- `agentChassis` (string, optional) — Agent chassis token for agent-authored writes.
- `agentModel` (string, optional) — Agent model id for agent-authored writes.

### Body (multipart/form-data)

- `file` (file, required) — Image file to upload. CLI/MCP may supply a local file path or http(s) URL. Agent ENTITY/PERSON uploads require the exact source image; PERSON images cannot be avatar CDNs.

## Response

### 200

OK

- `cdnUrl` (string, required) — Resolved API CDN URL
- `mediaType` (enum, required) — Target media domain
  - Allowed values: `ENTITY`, `PERSON`, `NEWS`, `BLOG`
- `path` (string, required) — Attached managed storage path; never an external image URL
- `firstUploadedAt` (datetime, optional, nullable) — Earliest recorded write timestamp for this media asset slot from res_provenance_event (when this entity/person/news first received any image in this slot).
- `provenance` (object, optional, nullable) — Latest write source for this media asset slot from res_provenance_event. `changedAt` is the last-modified timestamp of the current attached file.
  - `changedAt` (datetime, optional, nullable)
  - `dataSourceUpdatedAt` (datetime, optional, nullable)
  - `detail` (string, optional, nullable)
  - `kind` (string, optional, nullable)
  - `pendingApproval` (integer, optional, nullable)
  - `sourceId` (string, optional, nullable)
  - `status` (string, optional, nullable)
- `targetId` (string, optional, nullable) — Attached entity/person/news target id, when known

## Examples

**Request**

```json
{
  "file": "<file: string>"
}
```

**Response**

```json
{
  "cdnUrl": "string",
  "mediaType": "ENTITY",
  "path": "string",
  "firstUploadedAt": "2024-01-15T09:30:00Z",
  "provenance": {
    "changedAt": "2024-01-15T09:30:00Z",
    "dataSourceUpdatedAt": "2024-01-15T09:30:00Z",
    "detail": "string",
    "kind": "string",
    "pendingApproval": 1,
    "sourceId": "string",
    "status": "string"
  },
  "targetId": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.aventure.vc/v1/media/upload"

querystring = {"actorType":"agent","agentChassis":"codex-cli","mediaType":"ENTITY","sourceDetail":"aventure.vc","sourceProvider":"TechCrunch","sourceProviderId":"tc-2026-05-20-example-round","sourceProviderSlug":"example-round","sourceType":"requestChangeForm"}

files = { "file": "open('string', 'rb')" }
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, files=files, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.aventure.vc/v1/media/upload?actorType=agent&agentChassis=codex-cli&mediaType=ENTITY&sourceDetail=aventure.vc&sourceProvider=TechCrunch&sourceProviderId=tc-2026-05-20-example-round&sourceProviderSlug=example-round&sourceType=requestChangeForm';
const form = new FormData();
form.append('file', 'string');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.aventure.vc/v1/media/upload?actorType=agent&agentChassis=codex-cli&mediaType=ENTITY&sourceDetail=aventure.vc&sourceProvider=TechCrunch&sourceProviderId=tc-2026-05-20-example-round&sourceProviderSlug=example-round&sourceType=requestChangeForm"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.aventure.vc/v1/media/upload?actorType=agent&agentChassis=codex-cli&mediaType=ENTITY&sourceDetail=aventure.vc&sourceProvider=TechCrunch&sourceProviderId=tc-2026-05-20-example-round&sourceProviderSlug=example-round&sourceType=requestChangeForm")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.aventure.vc/v1/media/upload?actorType=agent&agentChassis=codex-cli&mediaType=ENTITY&sourceDetail=aventure.vc&sourceProvider=TechCrunch&sourceProviderId=tc-2026-05-20-example-round&sourceProviderSlug=example-round&sourceType=requestChangeForm")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.aventure.vc/v1/media/upload?actorType=agent&agentChassis=codex-cli&mediaType=ENTITY&sourceDetail=aventure.vc&sourceProvider=TechCrunch&sourceProviderId=tc-2026-05-20-example-round&sourceProviderSlug=example-round&sourceType=requestChangeForm', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.aventure.vc/v1/media/upload?actorType=agent&agentChassis=codex-cli&mediaType=ENTITY&sourceDetail=aventure.vc&sourceProvider=TechCrunch&sourceProviderId=tc-2026-05-20-example-round&sourceProviderSlug=example-round&sourceType=requestChangeForm");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]
let parameters = [
  [
    "name": "file",
    "fileName": "string"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.aventure.vc/v1/media/upload?actorType=agent&agentChassis=codex-cli&mediaType=ENTITY&sourceDetail=aventure.vc&sourceProvider=TechCrunch&sourceProviderId=tc-2026-05-20-example-round&sourceProviderSlug=example-round&sourceType=requestChangeForm")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```