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

# Create Ingest Job From File

POST https://api.coactive.ai/api/v1/ingestion/files
Content-Type: application/json

Ingest assets from a CSV or JSON file

Reference: https://docs.coactive.ai/api-reference/api-reference/ingestion/ingest/create-ingest-job-from-file-api-v-1-ingestion-files-post

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a CreateIngestJobFromFileRequest.

- `dataset_id` (string, required)
- `source_path` (string, required)
- `connection_name` (string, optional, nullable)
- `file_type` (enum, optional)
  - Allowed values: `unspecified`, `csv`, `json`

## Response

### 202

Successful Response

- `id` (string, required)
- `org_id` (string, required)
- `dataset_id` (string, required)
- `job_type` (enum, required)
  - Allowed values: `unspecified`, `assets`, `file`, `bucket`, `metadata`
- `details` (CreateIngestJobResponseDetails, required, nullable)
- `created_dt` (string, required)
- `connection_name` (string, optional, nullable)
- `request_type` (enum, optional)
  - Allowed values: `submit`
- `status` (enum, optional) — Enum of Ingest Job Status.
  - Allowed values: `completed`, `failed`, `in_progress`, `pending`, `paused`, `stopping`, `stopped`
- `updated_dt` (string, optional, nullable)
- `total_assets` (integer, optional, nullable)
- `processed_assets` (integer, optional, default: 0)
- `errored_assets` (integer, optional, default: 0)
- `request_id` (string, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### CreateIngestJobResponseDetails

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### AssetsJobDetails

- `assets` (list of AssetJobDetail, required)

### FileJobDetails

- `file` (CreateIngestJobFromFileRequest, required)

### BucketJobDetails

- `path` (string, required)
- `spec` (BucketSpec, required)
- `max_depth` (integer, optional, default: 0)

### MetadataUpdateJobDetails

- `accepted` (list of InternalAssetMetadataUpdate, required)
- `invalid_assets` (list of ExistingAssetMetadataUpdate, required)

### ValidationErrorLocItems

### AssetJobDetail

- `asset` (IngestJobAsset, required)
- `asset_id` (string, optional, nullable)
- `error` (string, optional, nullable)

### CreateIngestJobFromFileRequest

- `dataset_id` (string, required)
- `source_path` (string, required)
- `connection_name` (string, optional, nullable)
- `file_type` (enum, optional)
  - Allowed values: `unspecified`, `csv`, `json`

### BucketSpec

- `bucket` (string, required)
- `prefix` (string, optional, default: /)
- `provider` (enum, optional)
  - Allowed values: `aws`

### InternalAssetMetadataUpdate

- `asset_id` (string, required)
- `source_path` (string, required, nullable)
- `asset_type` (enum, required)
  - Allowed values: `image`, `video`
- `metadata` (map from string to InternalAssetMetadataUpdateMetadata, optional, nullable)

### ExistingAssetMetadataUpdate

- `asset_type` (enum, required)
  - Allowed values: `image`, `video`
- `asset_id` (string, optional, nullable)
- `source_path` (string, optional, nullable)
- `metadata` (map from string to ExistingAssetMetadataUpdateMetadata, optional, nullable)

### IngestJobAsset

- `source_path` (string, required)
- `metadata` (map from string to IngestJobAssetMetadata, optional, nullable)
- `asset_type` (enum, optional)
  - Allowed values: `unspecified`, `image`, `video`

### InternalAssetMetadataUpdateMetadata

### ExistingAssetMetadataUpdateMetadata

### IngestJobAssetMetadata

## Examples

**Request**

```json
{
  "dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "source_path": "/data/uploads/assets_list.csv"
}
```

**Response**

```json
{
  "id": "5eb7cf5a86d9755df3a6c593",
  "org_id": "org_9f8b7c6d5e4a3b2c1d0e",
  "dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "job_type": "assets",
  "details": {
    "assets": [
      {
        "asset": {
          "source_path": "/assets/images/photo1.jpg",
          "metadata": {},
          "asset_type": "image"
        },
        "asset_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "error": "File format not supported"
      }
    ]
  },
  "created_dt": "2024-01-15T09:30:00Z",
  "connection_name": "primary_s3_bucket",
  "request_type": "submit",
  "status": "completed",
  "updated_dt": "2024-01-15T10:00:00Z",
  "total_assets": 1,
  "processed_assets": 1,
  "errored_assets": 1,
  "request_id": "req_1234567890abcdef"
}
```

**SDK Code**

```python
import requests

url = "https://api.coactive.ai/api/v1/ingestion/files"

payload = {
    "dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "source_path": "/data/uploads/assets_list.csv"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.coactive.ai/api/v1/ingestion/files';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"dataset_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6","source_path":"/data/uploads/assets_list.csv"}'
};

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.coactive.ai/api/v1/ingestion/files"

	payload := strings.NewReader("{\n  \"dataset_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"source_path\": \"/data/uploads/assets_list.csv\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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.coactive.ai/api/v1/ingestion/files")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"dataset_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"source_path\": \"/data/uploads/assets_list.csv\"\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.coactive.ai/api/v1/ingestion/files")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"dataset_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"source_path\": \"/data/uploads/assets_list.csv\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.coactive.ai/api/v1/ingestion/files', [
  'body' => '{
  "dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "source_path": "/data/uploads/assets_list.csv"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.coactive.ai/api/v1/ingestion/files");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"dataset_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\",\n  \"source_path\": \"/data/uploads/assets_list.csv\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "source_path": "/data/uploads/assets_list.csv"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.coactive.ai/api/v1/ingestion/files")! 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()
```