> This page is for Developer Documentation.

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

# Convert a blob or file containing ASM, JSON, or instrument data to CSV

POST https://{tenant_name}.benchling.com/api/v2/connect/convert-to-csv
Content-Type: application/json

Convert a blob or file containing ASM, JSON, or instrument data to CSV.

If the file is ASM JSON, specify either no transform type (in which case all transform types will be returned),
a matching transform type for the ASM schema, or a custom JSON mapper config.

If the file non-ASM JSON, must provide a JSON mapper config argument, which specifies how to map the JSON to CSV.
Reach out to Benchling Support for more information about how to create a JSON mapper config.

If the file is an instrument file, must also specify an instrument vendor. The file will be converted first to
ASM JSON and then to CSV. Only the CSV output will be returned.

May provide an AutomationOutputFile with CSV transform arguments configured to read the transform type
or mapper config from.

May provide a connection ID associated with an instrument to read the vendor from.


Reference: https://docs.benchling.com/docs/api/v2/benchling-api/connect/convert-to-csv

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a ConvertToCSV.

- `blobOrFileId` (string, required) — The ID of a blob link or the API ID of a file to process.
- `automationOutputFileId` (string, optional) — The ID of an AutomationOutputFile configured to with CSV transform argument. Transform parameters will be read from file settings.
- `connectionId` (string, optional) — The ID of a connection to read the instrument vendor from.
- `mapperConfig` (string, optional) — A JSON configuration specifying how to convert a JSON file to CSV. Reach out to Benchling Support for more information about how to create a mapperConfig.
- `transformType` (string, optional) — The transform type to use to convert an ASM file to CSV.
- `vendor` (string, optional) — The instrument vendor to use for conversion. See /connect/list-allotropy-vendors.

## Response

### 200

List of pairs of (transformDataType, blobId) where the blob ID is the ID of a blob containing the converted CSV.

- `list of ConnectConvertToCsvPostResponsesContentApplicationJsonSchemaItems`

## Errors

### 400 Bad Request Error

Bad Request

- `error` (BadRequestErrorError, optional)

## Types

### ConnectConvertToCsvPostResponsesContentApplicationJsonSchemaItems

- `blobId` (string, optional)
- `transformDataType` (string, optional)

### BadRequestErrorError

- `message` (string, optional)
- `type` (enum, optional)
  - Allowed values: `invalid_request_error`
- `userMessage` (string, optional)

## Examples

**Request**

```json
{
  "blobOrFileId": "string"
}
```

**Response**

```json
[
  {
    "blobId": "string",
    "transformDataType": "string"
  }
]
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v2/connect/convert-to-csv"

payload = { "blobOrFileId": "string" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://{tenant_name}.benchling.com/api/v2/connect/convert-to-csv';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"blobOrFileId":"string"}'
};

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