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

# Find matching regions for AA sequences

POST https://{tenant_name}.benchling.com/api/v2/aa-sequences:find-matching-regions
Content-Type: application/json

Find matching regions for AA sequences

Reference: https://docs.benchling.com/docs/api/v2/benchling-api/aa-sequences/find-matching-regions-aa-sequences

## 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 an AaSequencesFindMatchingRegion.

- `schemaId` (string, required) — Schema ID for the type of AA to match to the source sequence
- `targetAASequenceIds` (list of string, required) — API IDs of the AA sequences which matching regions will be found for
- `registryId` (string, optional) — An optional Registry ID to restrict the region search to

## Response

### 202

This endpoint launches a [long-running task](#/Tasks/getTask) and returns the Task ID of the launched task. It is used to search for AA sequences that are either subsequences or exact matches of the provided target sequences. Each returned item represents the group of sequences that partially or fully match the target sequence."

- `taskId` (string, optional)

## 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
{
  "schemaId": "ts_n4l12nf0",
  "targetAASequenceIds": [
    "prtn_W7KgYydE",
    "prtn_g7SI2nih"
  ]
}
```

**Response**

```json
{
  "taskId": "string"
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v2/aa-sequences:find-matching-regions"

payload = {
    "schemaId": "ts_n4l12nf0",
    "targetAASequenceIds": ["prtn_W7KgYydE", "prtn_g7SI2nih"]
}
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/aa-sequences:find-matching-regions';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"schemaId":"ts_n4l12nf0","targetAASequenceIds":["prtn_W7KgYydE","prtn_g7SI2nih"]}'
};

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