# Resolve picker options for an input widget

> Source: https://docs.clonepartner.com/api-reference/dashboards/resolve-dashboard-widget-options/

`POST /api/dashboards/{id}/widgets/{widgetId}/options`

Resolves one page of options from the widget's `options_source` via a
readonly connector call, with server-side search (`q`) and cursor paging.
`side` selects the source: 'source' | 'target' (field_mapping) or a field
`key` (form). Returns a single page + `next_cursor`.

**Operation ID:** `resolveDashboardWidgetOptions`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Path parameters

- `id` — `integer`, `required`
  Resource ID
- `widgetId` — `string`, `required`

## Request body

### `application/json`

- Reference: `WidgetOptionsRequest`
  - Type: `object`
  - Description: `side` selects the option source: 'source' | 'target' for a field_mapping widget, or a field `key` for a form widget. `q` is server-side search, `cursor` is the pagination cursor (omit for the first page). `value` is the current draft widget value, used by dependent form option sources.
  - Properties:
    - `side` (`string`)
    - `q` (`string`)
    - `cursor` (`string`)
    - `value` (`unknown`) — Current draft value for this input widget.

## Success responses

### 200

One page of options

**Content type:** `application/json`

- Reference: `WidgetOptionsResponse`
  - Type: `object`
  - Properties:
    - `options` (`array<WidgetOption>`, `required`)
      - Items:
        - Reference: `WidgetOption`
          - Type: `object`
          - Properties:
            - `label` (`string`, `required`)
            - `value` (`string`, `required`)
            - `subText` (`string`)
    - `next_cursor` (`string | null`, `required`)
      - Nullable: yes

## Error responses

### 400

Validation error

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "VALIDATION_ERROR",
  "message": "Invalid input"
}
```

### 404

Resource not found

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}
```

## Examples

### cURL

```bash
curl --request POST \
  --url 'https://your-envoy.example.com/api/dashboards/YOUR_ID/widgets/YOUR_WIDGET_ID/options' \
  --header 'Authorization: Bearer $API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "side": "string",
  "q": "string",
  "cursor": "string",
  "value": "string"
}'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/dashboards/YOUR_ID/widgets/YOUR_WIDGET_ID/options', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "side": "string",
    "q": "string",
    "cursor": "string",
    "value": "string"
  }),
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
