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

# Create Benchling Warehouse credentials

POST https://{tenant_name}.benchling.com/api/v2/warehouse-credentials
Content-Type: application/json

Allows for programmatically generating credentials to connect to the Benchling warehouse. You must have a warehouse configured to access this endpoint.
The credentials will authenticate as the same user calling the API.
Note that expiresIn is required - only temporary credentials are currently allowed.


Reference: https://docs.benchling.com/docs/api/v2/benchling-api/warehouse/create-warehouse-credentials

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

- `expiresIn` (integer, required) — Duration, in seconds, that credentials should be active for. Must be greater than 0 and less than 3600.

## Response

### 200

OK

- `expiresAt` (datetime, optional) — The time after which new connections using the username/password will not be permitted. Upon expiration, currently open connections are not terminated.
- `password` (string, optional) — The password to connect to the warehouse.
- `username` (string, optional) — The username to connect to the warehouse.

## Errors

### 400 Bad Request Error

Bad Request

- `error` (BadRequestErrorError, optional)

## Types

### BadRequestErrorError

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

## Examples

**Request**

```json
{
  "expiresIn": 1
}
```

**Response**

```json
{
  "expiresAt": "2017-04-18T05:54:56.247545+00:00",
  "password": "9YC122LzxKW1Uq2q",
  "username": "u$lpasteur_az"
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v2/warehouse-credentials"

payload = { "expiresIn": 1 }
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/warehouse-credentials';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"expiresIn":1}'
};

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