# Start dataset CSV export

POST http://localhost:5173/api/v1/private/datasets/{id}/export

Initiates an asynchronous CSV export job for the dataset. Returns immediately with job details for polling.

Reference: https://www.comet.com/docs/opik/reference/rest-api/datasets/start-dataset-export

## OpenAPI Specification

```yaml
openapi: 3.1.1
info:
  title: Start dataset CSV export
  version: endpoint_datasets.startDatasetExport
paths:
  /v1/private/datasets/{id}/export:
    post:
      operationId: start-dataset-export
      summary: Start dataset CSV export
      description: >-
        Initiates an asynchronous CSV export job for the dataset. Returns
        immediately with job details for polling.
      tags:
        - - subpackage_datasets
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Existing export job in progress
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatasetExportJob_Public'
components:
  schemas:
    DatasetExportJobPublicStatus:
      type: string
      enum:
        - value: PENDING
        - value: PROCESSING
        - value: COMPLETED
        - value: FAILED
    DatasetExportJob_Public:
      type: object
      properties:
        id:
          type: string
          format: uuid
        dataset_id:
          type: string
          format: uuid
        dataset_name:
          type: string
        status:
          $ref: '#/components/schemas/DatasetExportJobPublicStatus'
        file_path:
          type: string
        error_message:
          type: string
        created_at:
          type: string
          format: date-time
        last_updated_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
        viewed_at:
          type: string
          format: date-time
        created_by:
          type: string
        last_updated_by:
          type: string

```

## SDK Code Examples

```python
import requests

url = "http://localhost:5173/api/v1/private/datasets/id/export"

response = requests.post(url)

print(response.json())
```

```javascript
const url = 'http://localhost:5173/api/v1/private/datasets/id/export';
const options = {method: 'POST'};

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"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:5173/api/v1/private/datasets/id/export"

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

	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("http://localhost:5173/api/v1/private/datasets/id/export")

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

request = Net::HTTP::Post.new(url)

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

```java
HttpResponse<String> response = Unirest.post("http://localhost:5173/api/v1/private/datasets/id/export")
  .asString();
```

```php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:5173/api/v1/private/datasets/id/export');

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

```csharp
var client = new RestClient("http://localhost:5173/api/v1/private/datasets/id/export");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:5173/api/v1/private/datasets/id/export")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

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()
```

```python
import requests

url = "http://localhost:5173/api/v1/private/datasets/id/export"

response = requests.post(url)

print(response.json())
```

```javascript
const url = 'http://localhost:5173/api/v1/private/datasets/id/export';
const options = {method: 'POST'};

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"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:5173/api/v1/private/datasets/id/export"

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

	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("http://localhost:5173/api/v1/private/datasets/id/export")

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

request = Net::HTTP::Post.new(url)

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

```java
HttpResponse<String> response = Unirest.post("http://localhost:5173/api/v1/private/datasets/id/export")
  .asString();
```

```php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:5173/api/v1/private/datasets/id/export');

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

```csharp
var client = new RestClient("http://localhost:5173/api/v1/private/datasets/id/export");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:5173/api/v1/private/datasets/id/export")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

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()
```