> 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.

# Poll async task status

GET https://{tenant_name}.benchling.com/api/v3/tasks/tenant-metering-summary/export-usage/{task_id}

Poll the status of the "Export the tenant's usage of credits as a CSV file" task.

Export the tenant's usage of Benchling credits as a CSV file. Returns a task; when the task completes, its result contains a presigned download `url` and an expiration timestamp.

## Notes

- Requires tenant admin permission.
- The report reflects only AI credits.
- Returns `400` if `fromTimestamp` is later than `toTimestamp`, or if `userId` does not identify a user in the tenant.
- If the export cannot retrieve all usage in the requested range, the result has `truncated: true`, no `url`, and a `message` explaining why. Narrow the time range and try again.

Reference: https://docs.benchling.com/docs/api/benchling-api/tenant-metering-summary/exportusage-get

## Authentication

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

## Request

### Path parameters

- `task_id` (string, required) — ID of the asynchronous task to poll.

### Headers

- `EARLY-ACCESS` (string, optional) — Set to true to access beta operations via /api/v3.

## Response

### 200

OK

- `message` (string, required)
- `status` (enum, required)
  - Allowed values: `NOT_STARTED`, `IN_PROGRESS`, `COMPLETED`, `FAILED`
- `result` (ExportTenantUsageOutput, optional, nullable) — The result of exporting a tenant's AI-credit usage as a CSV file.

## Errors

### 400 Bad Request Error

Bad Request

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 403 Forbidden Error

Forbidden

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 404 Not Found Error

Not Found

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 429 Too Many Requests Error

Too Many Requests

- `detail` (TooManyRequestsErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 500 Internal Server Error

Internal Server Error

- `detail` (InternalServerErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `errorId` (string, optional)

## Types

### ExportTenantUsageOutput

The result of exporting a tenant's AI-credit usage as a CSV file.

- `message` (string, optional, nullable) — An explanation for the user, set when the export is incomplete.
- `parameters` (ExportTenantUsageParameters, optional) — Input parameters from the request.
- `truncated` (boolean, optional) — Whether the export stopped before all usage in the requested range could be retrieved.
- `url` (string, optional, nullable) — Presigned download URL for the exported CSV file, if file is complete.
- `validUntil` (string, optional, nullable) — If successful, the URL will be valid at least until this time. Currently it is set at one day after the export task began.

### GeneralErrorDetail

- string
- map from string to any

### TooManyRequestsErrorDetail

- string
- map from string to any

### InternalServerErrorDetail

- string
- map from string to any

### ExportTenantUsageParameters

Request parameters for the tenant usage report.

- `__typename` (string, optional)
- `fromTimestamp` (string, optional) — Start of the time range of usage events to export.
- `includeNonCreditProducts` (boolean, optional) — Whether the export includes usage that does not draw from the tenant's credit grant. Reflects the value the export used, which is true when the request did not specify it.
- `toTimestamp` (string, optional) — End of the time range of usage events to export.
- `user` (UserRef, optional, nullable) — Restrict the export to usage by this user.

### UserRef

- `__typename` (string, optional)
- `id` (string, optional)

## Examples

**Response**

```json
{
  "message": "string",
  "status": "NOT_STARTED",
  "result": {
    "message": null,
    "parameters": {
      "__typename": "string",
      "fromTimestamp": "string",
      "includeNonCreditProducts": true,
      "toTimestamp": "string",
      "user": {
        "__typename": "string",
        "id": "string"
      }
    },
    "truncated": true,
    "url": null,
    "validUntil": null
  }
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v3/tasks/tenant-metering-summary/export-usage/task_id"

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

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

print(response.json())
```

```javascript
const url = 'https://{tenant_name}.benchling.com/api/v3/tasks/tenant-metering-summary/export-usage/task_id';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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