> For a complete page index, fetch https://developer.close.com/llms.txt

# Export opportunities, based on opportunity filters

POST https://api.close.com/api/v1/export/opportunity/
Content-Type: application/json

Parameters:
  - `params` (optional) - A dictionary of filters, which would be used for the `/opportunity/` endpoint.
  - `format` - Format of the exported file. The choices are: `csv`, `json`
  - `date_format` (optional) - Controls the format of date objects. Note: this only works with the `csv` format.
    - `original` (default) - A date format that includes microseconds and timezone information.
        - Date: `[YYYY]-[MM]-[DD]`
        - Date w/ time: `[YYYY]-[MM]-[DD] [hh]:[mm]:[ss.sssss]±[hh]:[mm]`
    - `iso8601` (recommended) - An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) compatible date representation that does not include microseconds.
        - Date: `[YYYY]-[MM]-[DD]`
        - Date w/ time: `[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]±[hh]:[mm]`
    - `excel` - An Excel compatible date format. Dates are always in UTC, do not include timezone information or microseconds, and use a 12 hour clock with an AM or PM designation.
        - Date: `[YYYY]-[MM]-[DD]`
        - Date w/ time: `[YYYY]-[MM]-[DD] [hh]:[mm]:[ss] [AM|PM]`
  - `fields` (optional) - By default we return all the data fields. If you only need specific fields exported, you can explicitly list them in fields to get smaller exports.
  - `send_done_email` - Set to `false` if you don't want to get a confirmation email after the bulk action is done.

Reference: https://developer.close.com/api/resources/exports/create-opportunity

## Authentication

- `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty.
- `Authorization` header (bearer token, required)

## Request

### Body (application/json)

- `any`

## Response

### 200

Successful response

## Examples

**Request**

```json
{
  "date_format": "iso8601",
  "format": "csv",
  "params": {
    "status_id": "st_id",
    "user_id__in": "id_1,id_2"
  },
  "send_done_email": false
}
```

**Response**

```json
{
  "created_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "date_created": "2014-04-01T16:50:22.256000+00:00",
  "date_format": "iso8601",
  "date_updated": "2014-04-02T00:55:34.967000+00:00",
  "download_url": null,
  "fields": [
    "confidence",
    "contact_id",
    "created_by",
    "created_by_name",
    "date_created",
    "date_updated",
    "date_won",
    "id",
    "lead_id",
    "lead_name",
    "note",
    "status_id",
    "status_label",
    "status_type",
    "updated_by",
    "updated_by_name",
    "user_id",
    "user_name",
    "value",
    "value_period"
  ],
  "format": "csv",
  "id": "expo_ASFasdfasdAY8VZhRiSn5UG2wNGRUrRurHdaN7kQp6",
  "n_docs": null,
  "n_docs_processed": 0,
  "organization_id": "orga_klasjd123vxiEY58eTGQmFNG3LPlEVQ4V7Nk",
  "params": {
    "status_id": "st_id",
    "user_id__in": "id_1,id_2"
  },
  "send_done_email": false,
  "status": "created",
  "type": "opps",
  "updated_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
}
```

**SDK Code**

```python
import requests

url = "https://api.close.com/api/v1/export/opportunity/"

payload = {
    "date_format": "iso8601",
    "format": "csv",
    "params": {
        "status_id": "st_id",
        "user_id__in": "id_1,id_2"
    },
    "send_done_email": False
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript
const url = 'https://api.close.com/api/v1/export/opportunity/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'POST',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"date_format":"iso8601","format":"csv","params":{"status_id":"st_id","user_id__in":"id_1,id_2"},"send_done_email":false}'
};

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.close.com/api/v1/export/opportunity/"

	payload := strings.NewReader("{\n  \"date_format\": \"iso8601\",\n  \"format\": \"csv\",\n  \"params\": {\n    \"status_id\": \"st_id\",\n    \"user_id__in\": \"id_1,id_2\"\n  },\n  \"send_done_email\": false\n}")

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

	req.SetBasicAuth("<CLOSE_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.close.com/api/v1/export/opportunity/")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"date_format\": \"iso8601\",\n  \"format\": \"csv\",\n  \"params\": {\n    \"status_id\": \"st_id\",\n    \"user_id__in\": \"id_1,id_2\"\n  },\n  \"send_done_email\": false\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.close.com/api/v1/export/opportunity/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"date_format\": \"iso8601\",\n  \"format\": \"csv\",\n  \"params\": {\n    \"status_id\": \"st_id\",\n    \"user_id__in\": \"id_1,id_2\"\n  },\n  \"send_done_email\": false\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.close.com/api/v1/export/opportunity/', [
  'body' => '{
  "date_format": "iso8601",
  "format": "csv",
  "params": {
    "status_id": "st_id",
    "user_id__in": "id_1,id_2"
  },
  "send_done_email": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

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

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/export/opportunity/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"date_format\": \"iso8601\",\n  \"format\": \"csv\",\n  \"params\": {\n    \"status_id\": \"st_id\",\n    \"user_id__in\": \"id_1,id_2\"\n  },\n  \"send_done_email\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```