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

# /dataset

POST https://dataset
Content-Type: multipart/form-data

Creates a dataset from a dataset template. Templates can be found in the "Admin => Templates" menu via the user interface at ODR.io. Known issue - template UUID is not available there. A feature request to display the template UUID has been added. Contact the ODR team for a UUID when using this endpoint until the issue is resoled.

POST a template UUID and the desired database name to create the database. If using a super-admin credential, optionally pass the email of the creating user to create a new dataset with metadata corresponding to that user. Email and user info should not be included unless usinng a super-admin credential.

This requires an "Authorization: Bearer" header with a valid API Token.

Reference: https://docs.odr.io/odr-search-api-v-4/dataset

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form.

- `user_email` (string, required)
- `first_name` (string, required)
- `last_name` (string, required)
- `dataset_name` (string, required)
- `template_uuid` (string, required) — This generates a RRUFF dataset from the RRUFF Sample template.

## Response

### 200

OK

- `database_uuid` (string, required)
- `internal_id` (integer, required)
- `record_name` (integer, required)
- `record_uuid` (string, required)
- `template_uuid` (string, required)
- `metadata_for_uuid` (string, required)
- `_record_metadata` (object, required)
  - `_create_date` (string, required)
  - `_updated_date` (string, required)
  - `_create_auth` (string, required)
  - `_public_date` (string, required)
- `fields` (list of any, required)
- `records` (list of any, required)

## Examples

**Request**

```json
{
  "user_email": "string",
  "first_name": "string",
  "last_name": "string",
  "dataset_name": "string",
  "template_uuid": "string"
}
```

**Response**

```json
{
  "database_uuid": "48e7e532a715a1c1cb02bed99138",
  "internal_id": 326,
  "record_name": 326,
  "record_uuid": "b14c1b13587b9db6832a8635cb78",
  "template_uuid": "93253b88d314bc2f11848f0eca15",
  "metadata_for_uuid": "b418ef9777d61f2f0a88144ed71a",
  "_record_metadata": {
    "_create_date": "2022-08-24 20:56:03",
    "_updated_date": "2022-08-24 20:56:03",
    "_create_auth": "nate@opendatarepository.org",
    "_public_date": "2200-01-01 00:00:00"
  },
  "fields": [],
  "records": []
}
```

**SDK Code**

```python /dataset_example
import requests

url = "https://https/dataset"

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_email\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"first_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"last_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dataset_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_uuid\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n"
headers = {"Content-Type": "multipart/form-data; boundary=---011000010111000001101001"}

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

print(response.json())
```

```javascript /dataset_example
const url = 'https://https/dataset';
const form = new FormData();
form.append('user_email', 'string');
form.append('first_name', 'string');
form.append('last_name', 'string');
form.append('dataset_name', 'string');
form.append('template_uuid', 'string');

const options = {method: 'POST'};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go /dataset_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://https/dataset"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_email\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"first_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"last_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dataset_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_uuid\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n")

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

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby /dataset_example
require 'uri'
require 'net/http'

url = URI("https://https/dataset")

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

request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_email\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"first_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"last_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dataset_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_uuid\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java /dataset_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/dataset")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_email\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"first_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"last_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dataset_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_uuid\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/dataset', [
  'multipart' => [
    [
        'name' => 'user_email',
        'contents' => 'string'
    ],
    [
        'name' => 'first_name',
        'contents' => 'string'
    ],
    [
        'name' => 'last_name',
        'contents' => 'string'
    ],
    [
        'name' => 'dataset_name',
        'contents' => 'string'
    ],
    [
        'name' => 'template_uuid',
        'contents' => 'string'
    ]
  ]
]);

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

```csharp /dataset_example
using RestSharp;

var client = new RestClient("https://https/dataset");
var request = new RestRequest(Method.POST);
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"user_email\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"first_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"last_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"dataset_name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"template_uuid\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift /dataset_example
import Foundation
let parameters = [
  [
    "name": "user_email",
    "value": "string"
  ],
  [
    "name": "first_name",
    "value": "string"
  ],
  [
    "name": "last_name",
    "value": "string"
  ],
  [
    "name": "dataset_name",
    "value": "string"
  ],
  [
    "name": "template_uuid",
    "value": "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://https/dataset")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```