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

# Regenerate the auth key for an app definition

POST https://{tenant_name}.benchling.com/api/v2-alpha/app-definitions/{app_def_id}/generate-oauth2-client-secret

Regenerate the oauth2 client key for the given app definition. Note that this will invalidate the previous key, and the value returned by this call can't be retrieved from Benchling.

Reference: https://docs.benchling.com/docs/api/v2-alpha/benchling-api-alpha/app-definitions/regenerate-benchling-app-definition-client-secret

## Authentication

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

## Request

### Path parameters

- `app_def_id` (string, required)

## Response

### 200

OK

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

## Errors

### 403 Forbidden Error

Forbidden

- `error` (ForbiddenErrorError, optional)

### 404 Not Found Error

Not Found

- `error` (NotFoundErrorError, optional)

## Types

### ForbiddenErrorError

- `invalidId` (string, optional)
- `message` (string, optional)
- `type` (string, optional)
- `userMessage` (string, optional)

### NotFoundErrorError

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

## Examples

**Response**

```json
{
  "clientSecret": "string",
  "id": "string"
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v2-alpha/app-definitions/appdef_e59sjL23Pqn30xHg/generate-oauth2-client-secret"

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

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

print(response.json())
```

```javascript
const url = 'https://{tenant_name}.benchling.com/api/v2-alpha/app-definitions/appdef_e59sjL23Pqn30xHg/generate-oauth2-client-secret';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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