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

# Upload assets to a dataset

POST https://api.ideogram.ai/datasets/{dataset_id}/upload_assets
Content-Type: multipart/form-data

Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images.


Reference: https://developer.ideogram.ai/v1/api-reference/custom-model-training/upload-dataset-assets

## Authentication

- `Api-Key` header (required) — API key for access control. Use in the header with the name \"Api-Key\"

## Request

### Path parameters

- `dataset_id` (string, required)

### Body (multipart/form-data)

This endpoint expects a multipart form with multiple files.

- `files` (files, required) — Image files (JPEG, PNG, WebP), .txt caption sidecar files, and/or ZIP archives containing images and captions. Caption .txt files are matched to images by filename stem (e.g. sunset.txt provides the caption for sunset.jpg). Captions are optional!

## Response

### 200

Upload summary

- `total_count` (integer, required) — Total number of images processed.
- `success_count` (integer, required) — Number of images successfully uploaded.
- `failure_count` (integer, required) — Number of images that failed to upload.
- `successful_assets` (list of DatasetUploadSucceededAsset, optional, default: []) — Details of successfully uploaded assets.
- `failed_assets` (list of DatasetUploadFailedAsset, optional, default: []) — Details of assets that failed to upload.

## Errors

### 400 Bad Request Error

Bad request

- `any`

### 401 Unauthorized Error

Unauthorized

- `any`

### 404 Not Found Error

Dataset not found

- `any`

## Types

### DatasetUploadSucceededAsset

- `file_name` (string, optional, nullable) — Original filename of the uploaded file. For a caption sidecar (.txt or .json) this is the sidecar's filename. A single image therefore yields one entry for the image plus one per caption file.

### DatasetUploadFailedAsset

- `failure_reason` (enum, required) — Reason why an asset failed to upload.
  - Allowed values: `FAILED_SAFETY_CHECK`, `FILE_TOO_LARGE`, `INTERNAL_ERROR`, `INVALID_CAPTION`, `INVALID_CAPTION_JSON`, `INVALID_IMAGE`, `INVALID_ZIP`, `TOO_MANY_IMAGES`
- `file_name` (string, optional, nullable) — Original filename of the failed image.

## Examples

**Request**

```json
{
  "files": [
    "<file: string>"
  ]
}
```

**Response**

```json
{
  "total_count": 0,
  "success_count": 6,
  "failure_count": 1,
  "successful_assets": [
    {
      "file_name": "file_name"
    },
    {
      "file_name": "file_name"
    }
  ],
  "failed_assets": [
    {
      "failure_reason": "FAILED_SAFETY_CHECK",
      "file_name": "file_name"
    },
    {
      "failure_reason": "FAILED_SAFETY_CHECK",
      "file_name": "file_name"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.ideogram.ai/datasets/dataset_id/upload_assets"

files = { "files": "open('string', 'rb')" }
headers = {"Api-Key": "<apiKey>"}

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

print(response.json())
```

```javascript
const url = 'https://api.ideogram.ai/datasets/dataset_id/upload_assets';
const form = new FormData();
form.append('files', 'string');

const options = {method: 'POST', headers: {'Api-Key': '<apiKey>'}};

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.ideogram.ai/datasets/dataset_id/upload_assets"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; 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("Api-Key", "<apiKey>")

	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.ideogram.ai/datasets/dataset_id/upload_assets")

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

request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<apiKey>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; 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.ideogram.ai/datasets/dataset_id/upload_assets")
  .header("Api-Key", "<apiKey>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; 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.ideogram.ai/datasets/dataset_id/upload_assets', [
  'multipart' => [
    [
        'name' => 'files',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'Api-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.ideogram.ai/datasets/dataset_id/upload_assets");
var request = new RestRequest(Method.POST);
request.AddHeader("Api-Key", "<apiKey>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; 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 = ["Api-Key": "<apiKey>"]
let parameters = [
  [
    "name": "files",
    "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.ideogram.ai/datasets/dataset_id/upload_assets")! 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()
```