> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developer.ideogram.ai/v1/api-reference/custom-model-training/create-dataset/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.ideogram.ai/_mcp/server. # Create a new dataset POST https://api.ideogram.ai/datasets Content-Type: application/json Creates a new dataset Reference: https://developer.ideogram.ai/v1/api-reference/custom-model-training/create-dataset ## Authentication - `Api-Key` header (required) — API key for access control. Use in the header with the name \"Api-Key\" ## Request ### Body (application/json) This endpoint expects a CreateDatasetRequest. - `name` (string, required) — Name of the dataset. ## Response ### 200 Dataset created successfully - `dataset_id` (string, required) — Unique identifier for the dataset. - `name` (string, required) — Display name of the dataset. - `user_id` (string, required) — ID of the user who owns this dataset. - `creation_time` (datetime, required) — When the dataset was created. ## Errors ### 400 Bad Request Error Bad request - `any` ### 401 Unauthorized Error Unauthorized - `any` ## Examples **Request** ```json { "name": "name" } ``` **Response** ```json { "dataset_id": "dataset_id", "name": "name", "user_id": "user_id", "creation_time": "2024-01-15T09:30:00Z" } ``` **SDK Code** ```python import requests url = "https://api.ideogram.ai/datasets" payload = { "name": "name" } headers = { "Api-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.ideogram.ai/datasets'; const options = { method: 'POST', headers: {'Api-Key': '', 'Content-Type': 'application/json'}, body: '{"name":"name"}' }; 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" payload := strings.NewReader("{\n \"name\": \"name\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Api-Key", "") 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.ideogram.ai/datasets") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Api-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"name\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.ideogram.ai/datasets") .header("Api-Key", "") .header("Content-Type", "application/json") .body("{\n \"name\": \"name\"\n}") .asString(); ``` ```php request('POST', 'https://api.ideogram.ai/datasets', [ 'body' => '{ "name": "name" }', 'headers' => [ 'Api-Key' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.ideogram.ai/datasets"); var request = new RestRequest(Method.POST); request.AddHeader("Api-Key", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"name\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Api-Key": "", "Content-Type": "application/json" ] let parameters = ["name": "name"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.ideogram.ai/datasets")! 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() ```