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

# Run investigation

POST https://app.resemble.ai/api/v2/agents/{uuid}/run
Content-Type: multipart/form-data

Run a managed Detect Agent against uploaded media or a public URL.
The response is a live Server-Sent Events stream. The first `run_started`
event contains the persisted run identifier.


Reference: https://docs.resemble.ai/api-reference/detect-agents/run-detect-agent-investigation

## Authentication

- `Authorization` header (bearer token, required) — API key from https://app.resemble.ai/hub/api

## Request

### Path parameters

- `uuid` (string, required) — Stable Detect Agent identifier returned by `GET /agents`.

### Body (multipart/form-data)

This endpoint expects a multipart form with multiple files.

- `file` (file, optional) — Primary media to analyze. Required when `url` is omitted.
- `url` (string, optional) — Public media URL to analyze. Required when `file` is omitted.
- `query` (string, optional) — Question or investigation objective.
- `evidence[]` (files, optional) — Supporting evidence files. Repeat this field for multiple files.
- `check_urls` (string, optional) — Additional URLs for the Detect Agent to check.

## Errors

### 401 Unauthorized Error

Missing or invalid API key

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

### 402 Payment Required Error

The investigation is blocked by billing or available credits

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

### 403 Forbidden Error

The account does not have Detect Agents access

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

### 404 Not Found Error

Detect Agent not found

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

### 422 Unprocessable Entity Error

Neither `file` nor `url` was provided

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

### 502 Bad Gateway Error

Detect Agents service unavailable before streaming begins

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

## Examples

**Request**

```json
{
  "file": "<file: <file1>>",
  "evidence[]": []
}
```

**Response**

```json
"data: {\"type\":\"run_started\",\"run_id\":\"6b208dee-f515-48d7-a895-cd595c46aa6d\"}\n\ndata: {\"type\":\"token\",\"text\":\"I will inspect the submitted media.\"}\n\ndata: {\"type\":\"final_verdict\",\"intelligence\":\"{\\\"recommended_action\\\":\\\"reject\\\",\\\"confidence\\\":0.98}\",\"forced\":false}\n\ndata: {\"type\":\"done\"}\n"
```

**SDK Code**

```python
import requests

url = "https://app.resemble.ai/api/v2/agents/verify_document/run"

files = { "file": "open('<file1>', 'rb')" }
payload = {
    "url": ,
    "query": ,
    "check_urls": 
}
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.resemble.ai/api/v2/agents/verify_document/run';
const form = new FormData();
form.append('file', '<file1>');
form.append('url', '');
form.append('query', '');
form.append('check_urls', '');

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://app.resemble.ai/api/v2/agents/verify_document/run"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"query\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"check_urls\"\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://app.resemble.ai/api/v2/agents/verify_document/run")

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=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"query\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"check_urls\"\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://app.resemble.ai/api/v2/agents/verify_document/run")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"query\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"check_urls\"\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://app.resemble.ai/api/v2/agents/verify_document/run', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => '<file1>',
        'contents' => null
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.resemble.ai/api/v2/agents/verify_document/run");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"query\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"check_urls\"\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": "<file1>"
  ],
  [
    "name": "url",
    "value": 
  ],
  [
    "name": "query",
    "value": 
  ],
  [
    "name": "check_urls",
    "value": 
  ]
]

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://app.resemble.ai/api/v2/agents/verify_document/run")! 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()
```