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

# List task spec targets

GET https://acme-api.invivo.benchling.com/api/public/v1/studies/{studyId}/task-specs/{taskSpecId}/targets

Returns the study groups targeted by the task specification.

Reference: https://docs.benchling.com/in-vivo/study-task-specs/study-task-spec-targets-list

## Authentication

- OAuth2 — send the obtained token as `Authorization: Bearer <token>`

## Request

### Path parameters

- `studyId` (string, required) — The unique identifier of the study.
- `taskSpecId` (string, required) — The unique identifier of the task specification.

### Query parameters

- `perPage` (integer, optional, default: 10) — The number of results to return per page, up to a maximum of 100.
- `page` (integer, optional, default: 1) — The page of results to return. The first page is 1.

## Response

### 200

A page of targets.

- `data` (list of TaskTargetV1, required) — The targets on this page of results.
- `links` (Links, required) — Absolute URLs for navigating a paginated collection.
- `meta` (Meta, required) — Pagination counters describing the returned page of results.

## Errors

### 400 Bad Request Error

The request was rejected. Validation failures return a `ValidationErrorResponse`; an unrecognised `X-Studies-Api-Version` header returns an `AuthErrorResponse` with the code `invalid_header`.

- `BadRequestErrorResponse`

### 401 Unauthorized Error

Authentication failed. The body is normally empty; when an otherwise valid access token is missing required claims the body is an `AuthErrorResponse` with the code `invalid_token`.

- `any`

### 403 Forbidden Error

The access token does not grant the scopes this operation requires. The body is normally empty; when the token's team is missing or deleted the body is an `AuthErrorResponse` with the code `invalid_data`.

- `any`

### 404 Not Found Error

No resource matching the given identifier exists on your team. The body is empty.

- `any`

### 429 Too Many Requests Error

A rate limit was exceeded. Retry once the window resets; no `Retry-After` header is sent, so use `X-RateLimit-Reset`.

- `error` ("rate_limit_exceeded", required) — A machine-readable error code.
- `message` (string, required) — A human-readable explanation of the failure.

## Types

### TaskTargetV1

A target entry on a task specification. Only group targets are listed.

- `type` (enum, required) — What a task specification is aimed at.
  - Allowed values: `animal`, `group`
- `group` (GroupTargetV1, required) — A study group targeted by a task specification.
- `task_spec` (TaskSpecMinimalV1, required) — Compact task specification summary embedded on assignees and targets.

### Links

Absolute URLs for navigating a paginated collection.

- `first` (string, required) — The first page of results.
- `last` (string, required) — The last page of results.
- `prev` (string, required, nullable) — The previous page of results. Null on the first page.
- `next` (string, required, nullable) — The next page of results. Null on the last page.

### Meta

Pagination counters describing the returned page of results.

- `current_page` (integer, required) — The page of results returned.
- `from` (integer, required, nullable) — The index of the first result on this page, counted across the whole collection from 1. Null when the page is empty.
- `last_page` (integer, required) — The number of the last available page.
- `path` (string, required) — The collection URL, without any query string.
- `per_page` (integer, required) — The number of results per page actually applied, after the requested value is capped to the maximum.
- `to` (integer, required, nullable) — The index of the last result on this page, counted across the whole collection from 1. Null when the page is empty.
- `total` (integer, required) — The total number of results matching the request, ignoring pagination.

### ValidationErrorResponse

Returned when a request body or parameter fails validation.

- `message` (string, required) — A summary of the failure.
- `errors` (map from string to list of string, required) — Failure messages keyed by the offending field, using the field's name as it appears on the wire. Nested fields are dotted, e.g. `schedule.duration`.

### AuthErrorResponse

Returned when a request is rejected during authentication, before it is processed.

- `error` (enum, required) — A machine-readable error code.
  - Allowed values: `invalid_header`, `invalid_token`, `invalid_data`
- `error_description` (string, required) — A human-readable explanation of the failure.

### ProblemDetail

An RFC 9457 problem detail, returned when a request is rejected before it reaches a controller method — most commonly an unparseable or absent JSON body. Unlike the rest of this API, null members are omitted rather than serialised as `null`.

- `title` (string, required) — A short, human-readable summary of the problem type.
- `status` (integer, required) — The HTTP status code, repeated in the body.
- `detail` (string, required) — A human-readable explanation specific to this occurrence.
- `instance` (string, required) — The path of the request that produced the problem.

### GroupTargetV1

A study group targeted by a task specification.

- `id` (string, required) — Unique identifier for a study group.
- `name` (string, required) — Name of the study group.
- `added_at` (datetime, required) — UTC timestamp with microsecond precision, always suffixed with `Z`, in the form `yyyy-MM-ddTHH:mm:ss.SSSSSSZ`.

### TaskSpecMinimalV1

Compact task specification summary embedded on assignees and targets.

- `id` (string, required) — Unique identifier for a study task specification.
- `type` (enum, required) — The kind of work a task specification describes.
  - Allowed values: `measurement`, `sample`, `observation`, `dosing`, `other`
- `title` (string, required) — The title of the task specification.

## Examples

**Response**

```json
{
  "error": "string",
  "message": "Too many requests"
}
```

**SDK Code**

```python
import requests

url = "https://acme-api.invivo.benchling.com/api/public/v1/studies/sdy_3vQ8kZpLmN2xRt7YwBcDfG/task-specs/tsp_2Z3wOcuU0l0s9H6up0umd6/targets"

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

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

print(response.json())
```

```javascript
const url = 'https://acme-api.invivo.benchling.com/api/public/v1/studies/sdy_3vQ8kZpLmN2xRt7YwBcDfG/task-specs/tsp_2Z3wOcuU0l0s9H6up0umd6/targets';
const options = {method: 'GET', headers: {Authorization: '<token>.'}};

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