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

# Download Bulk Entities (Sync)

GET https://api.mercoa.com/entities/download

Get a URL to download a bulk entity as a CSV/JSON file.

Reference: https://docs.mercoa.com/embedded-ap-ar/api-reference/entity/bulk/download

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `format` (enum, optional) — Format of the file to download. Defaults to CSV.
  - Allowed values: `CSV`, `JSON`
- `paymentMethods` (boolean, optional) — If true, will include entity payment methods as part of the response
- `isCustomer` (boolean, optional) — If true, only entities with a direct relationship to the requesting organization will be returned. If false or not provided, all entities will be returned.
- `foreignId` (string, optional) — ID used to identify this entity in your system
- `status` (enum, optional)
  - Allowed values: `unverified`, `pending`, `resubmit`, `review`, `verified`, `failed`
- `isPayee` (boolean, optional) — If true, entities that are marked as payees will be returned. If false or not provided, entities that are marked as payees will not be returned.
- `isPayor` (boolean, optional) — If true or not provided, entities that are marked as payors will be returned. If false, entities that are marked as payors will not be returned.
- `name` (string, optional, deprecated) — Use search instead. Deprecated. Filter entities by name. Partial matches are supported.
- `search` (string, optional) — Find entities by name, email, emailTo, entity ID, or foreign ID. Partial matches are supported for name, email, and emailTo. Exact matches are used for entity ID and foreign ID.
- `metadata` (object, optional) — Filter entities by simple key/value metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
  - `key` (string, required)
  - `value` (string or list of string, required) — If multiple values are provided, the filter will match if any of the values match (OR filter). To filter for the absence of a key, use the value 'NULL'. To filter for the presence of a key, use the value 'NOT NULL'.
- `returnMetadata` (string, optional) — Return simple key/value metadata for the specified keys for the entities. For more complex metadata, use the Metadata API.
- `limit` (integer, optional) — Number of entities to return. Limit can range between 1 and 100, and the default is 10.
- `startingAfter` (string, optional) — The ID of the entity to start after. If not provided, the first page of entities will be returned.

## Response

### 200

- `url` (string, required)
- `mimeType` (string, required)

## Errors

### 400 Bad Request

- `errorName` ("BadRequest", required)
- `content` (string, required)

### 401 Unauthorized

- `errorName` ("Unauthorized", required)
- `content` (string, required)

### 403 Forbidden

- `errorName` ("Forbidden", required)
- `content` (string, required)

### 404 Not Found

- `errorName` ("NotFound", required)
- `content` (string, required)

### 409 Conflict

- `errorName` ("Conflict", required)
- `content` (string, required)

### 500 Internal Server Error

- `errorName` ("InternalServerError", required)
- `content` (string, required)

### 501 Unimplemented

- `errorName` ("Unimplemented", required)
- `content` (string, required)

## Examples

**Response**

```json
{
  "url": "https://mercoa.com/download/bulk-invoices.csv",
  "mimeType": "text/csv"
}
```

**SDK Code**

```python Default
import requests

url = "https://api.mercoa.com/entities/download"

querystring = {"format":"CSV"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```typescript Default
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entity.bulk.download({
    format: "CSV"
});

```

```go Default
package main

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

func main() {

	url := "https://api.mercoa.com/entities/download?format=CSV"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://api.mercoa.com/entities/download?format=CSV")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java Default
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.mercoa.com/entities/download?format=CSV")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.mercoa.com/entities/download?format=CSV', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Default
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entities/download?format=CSV");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Default
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entities/download?format=CSV")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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