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

# Create a moderation job

POST https://api.fastpix.com/v1/agents/moderation/jobs
Content-Type: application/json

This endpoint creates a moderation job that applies a moderation rule to a selected set of videos. The job starts a separate moderation workflow for each selected media item. You can use the job endpoints to track progress and retrieve results.

#### How it works

1. Send a POST request with a `name`, the `ruleId` of the rule to apply, and a `videoSource`.

2. Set `videoSource.type` to specify which videos to moderate:
   - `specific`: Moderate the videos listed in `videoIds`.
   - `tags`: Moderate all media associated with the specified `tags`.
   - `all`: Moderate all media in your account.

3. Set `scanNewUploads` to `true` to also moderate media uploaded after the job is created.

4. The response returns the `id` of the created job, which you use to track progress and fetch results.

#### Example

A platform applies its "strict" moderation rule to all videos tagged `user-generated` and sets `scanNewUploads` to `true`. The job also moderates newly uploaded videos that match the configured source.


Reference: https://fastpix.com/docs/agents-api/moderation-agent/create-moderation-job

## Authentication

- `Authorization` header (basic auth, required) — FastPix APIs are secured with Basic Authentication. Use your Access Token ID as the username and Secret Key as the password in the Authorization header of each API request. * Username: Access Token ID * Password: Secret Key Activate your FastPix account to generate your API credentials. See the guide here

## Request

### Body (application/json)

This endpoint expects a CreateModerationJobRequest.

- `name` (string, required) — A human-readable name for the job.
- `ruleId` (string, required) — The id of the moderation rule to apply.
- `videoSource` (ModerationVideoSource, required) — Where a job pulls its videos from. `tags` applies only when `type` is `tags`; `videoIds` applies only when `type` is `specific`; for `all`, both are ignored.
- `scanNewUploads` (boolean, optional, default: false) — When true, media uploaded after the job is created are also moderated.

## Response

### 200

Moderation job created successfully

- `success` (boolean, optional) — Shows the request status. Returns true for success and false for failure.
- `data` (ModerationResourceCreatedResponseData, optional)

## Types

### ModerationVideoSource

Where a job pulls its videos from. `tags` applies only when `type` is `tags`; `videoIds` applies only when `type` is `specific`; for `all`, both are ignored.

- `type` (enum, required) — How a job selects its videos: `specific` uses an explicit `videoIds` list, `tags` selects every media carrying the given `tags`, and `all` selects every media in the workspace.
  - Allowed values: `all`, `tags`, `specific`
- `tags` (list of string, optional, nullable) — Required when `type` is `tags`. At most 20 tags.
- `videoIds` (list of string, optional, nullable) — Required when `type` is `specific`. At most 100 media ids.

### ModerationResourceCreatedResponseData

- `id` (string, optional) — The unique identifier of the created resource.

## Examples

**Request**

```json
{
  "name": "Nightly UGC scan",
  "ruleId": "3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33",
  "videoSource": {
    "type": "specific"
  }
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "id": "3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.fastpix.com/v1/agents/moderation/jobs"

payload = {
    "name": "Nightly UGC scan",
    "ruleId": "3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33",
    "videoSource": { "type": "specific" }
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript
const url = 'https://api.fastpix.com/v1/agents/moderation/jobs';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: '{"name":"Nightly UGC scan","ruleId":"3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33","videoSource":{"type":"specific"}}'
};

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.fastpix.com/v1/agents/moderation/jobs"

	payload := strings.NewReader("{\n  \"name\": \"Nightly UGC scan\",\n  \"ruleId\": \"3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33\",\n  \"videoSource\": {\n    \"type\": \"specific\"\n  }\n}")

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

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/json")

	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.fastpix.com/v1/agents/moderation/jobs")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Nightly UGC scan\",\n  \"ruleId\": \"3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33\",\n  \"videoSource\": {\n    \"type\": \"specific\"\n  }\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.fastpix.com/v1/agents/moderation/jobs")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Nightly UGC scan\",\n  \"ruleId\": \"3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33\",\n  \"videoSource\": {\n    \"type\": \"specific\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fastpix.com/v1/agents/moderation/jobs', [
  'body' => '{
  "name": "Nightly UGC scan",
  "ruleId": "3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33",
  "videoSource": {
    "type": "specific"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.fastpix.com/v1/agents/moderation/jobs");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Nightly UGC scan\",\n  \"ruleId\": \"3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33\",\n  \"videoSource\": {\n    \"type\": \"specific\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Nightly UGC scan",
  "ruleId": "3c7fae25-8b40-4f69-9d13-2a0b7c4e6f33",
  "videoSource": ["type": "specific"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fastpix.com/v1/agents/moderation/jobs")! 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()
```