> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cria.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# List opportunities

> Search and paginate CRM opportunities by inbox, stage, assignee, external identity, and dates.

```bash Open opportunities theme={null}
curl --request GET \
  --url "https://app.cria.chat/api/v1/accounts/10/crm/inbox/25/kanban/opportunities" \
  --header "api_access_token: YOUR_API_ACCESS_TOKEN" \
  --header "Accept: application/json" \
  --include
```

```bash Filtered search theme={null}
curl --get \
  --url "https://app.cria.chat/api/v1/accounts/10/crm/inbox/25/kanban/opportunities" \
  --header "api_access_token: YOUR_API_ACCESS_TOKEN" \
  --header "Accept: application/json" \
  --include \
  --data-urlencode "status=all" \
  --data-urlencode "archived=false" \
  --data-urlencode "stage_id=20" \
  --data-urlencode "assignee_type=me" \
  --data-urlencode "qualified=true" \
  --data-urlencode "q=Mary Johnson" \
  --data-urlencode "sort_by=updated_at_desc" \
  --data-urlencode "page=1" \
  --data-urlencode "per_page=50"
```

```bash Updated opportunities theme={null}
curl --get \
  --url "https://app.cria.chat/api/v1/accounts/10/crm/inbox/25/kanban/opportunities" \
  --header "api_access_token: YOUR_API_ACCESS_TOKEN" \
  --header "Accept: application/json" \
  --include \
  --data-urlencode "status=all" \
  --data-urlencode "origin=partner-crm" \
  --data-urlencode "updated_after=2026-10-01T00:00:00-03:00" \
  --data-urlencode "updated_before=2026-11-01T00:00:00-03:00" \
  --data-urlencode "sort_by=updated_at_asc" \
  --data-urlencode "page=1" \
  --data-urlencode "per_page=100"
```

```json 200 OK theme={null}
{
  "data": {
    "meta": {
      "all_count": 1,
      "current_page": 1,
      "per_page": 25,
      "total_pages": 1
    },
    "payload": [
      {
        "id": 123,
        "inbox_id": 25,
        "title": "Motorcycle purchase",
        "status": "open",
        "product": "City motorcycle",
        "service": null,
        "product_version": "Standard",
        "preferred_color": "Blue",
        "value": "15000.0",
        "currency": "BRL",
        "opportunity_type": "purchase",
        "external_status": "qualified",
        "source": "website",
        "sub_source": null,
        "conversion_point": null,
        "current_motorcycle": null,
        "current_vehicle": null,
        "qualified": true,
        "external_owner": "Partner sales team",
        "first_contact_time_minutes": 5,
        "days_without_update": 0,
        "last_customer_contact_at": "2026-10-31T12:00:00.000Z",
        "contact_id": 456,
        "archived_at": null,
        "created_at": "2026-10-01T12:00:00.000Z",
        "updated_at": "2026-10-31T12:00:00.000Z",
        "entered_at": "2026-10-01T12:00:00.000Z",
        "board_id": 5,
        "stage_id": 20,
        "position": 0,
        "contact": {
          "id": 456,
          "name": "Mary Johnson",
          "email": "mary@example.com",
          "phone_number": "+5511999999999"
        },
        "contact_deleted": false,
        "deleted_contact": null,
        "assignee": {
          "id": 7,
          "name": "Alex Smith"
        },
        "external_records": [
          {
            "provider": "external_api",
            "origin": "partner-crm",
            "external_id": "deal-123",
            "external_url": "https://crm.example.com/deals/123",
            "imported_at": "2026-10-01T12:00:00.000Z"
          }
        ]
      }
    ]
  }
}
```

```json 401 Unauthorized theme={null}
{
  "error": "Invalid Access Token"
}
```

```json 404 Not Found theme={null}
{
  "error": "Opportunity or inbox is invalid or inaccessible"
}
```

```json 422 Unprocessable Entity theme={null}
{
  "error": "per_page cannot exceed 100"
}
```

List opportunities in an accessible inbox. Results include pagination metadata, contact and assignee summaries, and external import identities.

## cURL examples

The request panel includes commands for the default list, a filtered search, and a date-based synchronization query. Replace `YOUR_API_ACCESS_TOKEN`, account ID `10`, inbox ID `25`, and stage ID `20` with values from your account.

The commands use Bash syntax. `--get` sends the `--data-urlencode` fields as query parameters, including spaces and timezone offsets. `--include` prints the HTTP status and headers with the response body. No JSON request body is required.

## Authentication

Send a user or AgentBot API access token:

```http theme={null}
api_access_token: YOUR_API_ACCESS_TOKEN
```

The token must have access to the account and inbox. A session login alone does not authorize this endpoint. Administrators, SuperAdmins, and AgentBots can list opportunities within their accessible inboxes. Agents only receive opportunities assigned to them; filters cannot expand that access.

## Path parameters

| Field | Required | Description |
| - | - | - |
| `account_id` | Yes | CriaChat account ID. |
| `inbox_id` | Yes | ID of an inbox accessible to the token. |

## Query parameters

All query parameters are optional. Filters are combined, so an opportunity must match every supplied filter.

| Field | Default | Description |
| - | - | - |
| `page` | `1` | Positive integer page number. |
| `per_page` | `25` | Items per page, from `1` to `100`. |
| `status` | `open` | `open`, `won`, `lost`, or `all`. This is the CriaChat status, not the external status. |
| `archived` | `false` | `false` selects non-archived opportunities; `true` selects archived opportunities only. |
| `stage_id` | — | Positive integer Kanban column ID. |
| `board_id` | — | Positive integer Kanban board ID. |
| `assignee_id` | — | Positive integer CriaChat user ID. Can only be used when `assignee_type` is omitted or `all`. |
| `assignee_type` | `all` | `all`, `me`, `assigned`, or `unassigned`. Applied within the token's access scope. |
| `contact_id` | — | Positive integer contact ID. |
| `product` | — | Exact product name. |
| `service` | — | Exact service name. |
| `source` | — | Exact source value. |
| `qualified` | — | `true` or `false`. |
| `external_status` | — | Exact external opportunity status. |
| `external_id` | — | Exact identifier from an external import record. |
| `origin` | — | Exact origin from an external import record. |
| `created_after` | — | Inclusive lower bound for `created_at`, as an ISO 8601 timestamp with a timezone. |
| `created_before` | — | Exclusive upper bound for `created_at`, as an ISO 8601 timestamp with a timezone. |
| `updated_after` | — | Inclusive lower bound for `updated_at`, as an ISO 8601 timestamp with a timezone. |
| `updated_before` | — | Exclusive upper bound for `updated_at`, as an ISO 8601 timestamp with a timezone. |
| `q` | — | Case-insensitive substring search across opportunity title and linked contact name, email, or phone number. |
| `sort_by` | `created_at_desc` | Sort order listed below. |

> [!NOTE]
>
> The default request returns only open, non-archived opportunities. Use `status=all` to include won and lost opportunities. To retrieve both archived and non-archived records, paginate separate requests with `archived=true` and `archived=false`.

When `external_id` and `origin` are both supplied, they must match the same external record. For example, use the stable `origin` and `external_id` submitted to [Create opportunities](https://docs.cria.chat/api-reference/crm/opportunities/create.md) to locate an imported opportunity. These filters do not require a specific provider.

Search trims leading and trailing whitespace. It searches phone numbers as stored, so use a matching portion of the stored number. Opportunities whose contacts were deleted can still appear when other filters match, but their deleted-contact snapshot is not searched by `q`.

### Sorting

Accepted `sort_by` values:

* `created_at_asc` and `created_at_desc`.
* `updated_at_asc` and `updated_at_desc`.
* `entered_at_asc` and `entered_at_desc`.
* `value_asc` and `value_desc`.
* `manual`: ascending position, then ascending opportunity ID.

Date and value sorts place null values last and use opportunity ID in the same direction to break ties. `manual` sorts by position across the filtered result, so use `stage_id` when retrieving a single stage's card order.

### Dates and pagination

Use timestamps such as `2026-10-01T00:00:00Z` or `2026-10-01T00:00:00-03:00`. Date-only values and timestamps without a timezone are rejected. If both bounds are supplied for the same date field, the `before` bound must be strictly later than the `after` bound.

For each query, increment `page` until it reaches `data.meta.total_pages`. `all_count` counts all matching opportunities before pagination. A page beyond the last page returns an empty `payload`. With no matches, `all_count` and `total_pages` are `0`.

Pagination uses page numbers rather than a snapshot or cursor. Records can move between pages if they change while you are reading them.

## Response models

### 200 OK

| Field | Type | Description |
| - | - | - |
| `data.meta.all_count` | integer | Total matching opportunities within the token's access scope. |
| `data.meta.current_page` | integer | Requested page number. |
| `data.meta.per_page` | integer | Requested or default page size. |
| `data.meta.total_pages` | integer | Number of pages for the filtered result. |
| `data.payload` | array of objects | Opportunities on the current page. Empty when no records match or the page is beyond the last page. |

Each object in `data.payload` contains:

| Fields | Type | Description |
| - | - | - |
| `id`, `inbox_id`, `board_id`, `stage_id` | integer | Internal opportunity, inbox, board, and column IDs. Use `id` for [Change opportunity stage](https://docs.cria.chat/api-reference/crm/opportunities/change-stage.md). |
| `position` | integer | Position within the stage. |
| `title` | string or null | Opportunity title. |
| `status` | string | `open`, `won`, or `lost`. |
| `product`, `service`, `product_version`, `preferred_color` | string or null | Commercial details. |
| `value` | decimal string or null | Opportunity monetary value, serialized as a string. |
| `currency` | string | Currency code. |
| `opportunity_type`, `external_status`, `external_owner` | string or null | Type, status, and owner from the external system. |
| `source`, `sub_source`, `conversion_point` | string or null | Acquisition and conversion details. |
| `current_motorcycle`, `current_vehicle` | string or null | Current vehicle details. |
| `qualified` | boolean or null | Qualification flag. |
| `first_contact_time_minutes`, `days_without_update` | integer or null | External contact and update metrics. |
| `last_customer_contact_at`, `archived_at` | string or null | ISO 8601 timestamps, when available. |
| `created_at`, `updated_at`, `entered_at` | string | ISO 8601 timestamps for creation, last update, and entry into the current stage. |
| `contact_id` | integer or null | Linked contact ID. |
| `contact` | object or null | Linked contact with `id`, `name`, `email`, and `phone_number`. Contact details can be null. |
| `contact_deleted` | boolean | Whether the opportunity has no linked contact. |
| `deleted_contact` | object or null | Retained contact snapshot, when available. |
| `assignee` | object or null | Assigned CriaChat user with `id` and `name`; null if unassigned. |
| `external_records` | array of objects | Import identities; empty when none exist. Each contains string fields `provider` and `external_id`, nullable string fields `origin` and `external_url`, and an ISO 8601 `imported_at` timestamp. |

The list does not include financing, profile, consent, record, or detailed sale and loss fields.

### 401 Unauthorized

An invalid API token returns:

```json theme={null}
{
  "error": "Invalid Access Token"
}
```

Missing API-token authentication, suspended accounts, and account access failures can also return `401`, with a different `error` message.

### 404 Not Found

An invalid or inaccessible inbox returns:

```json theme={null}
{
  "error": "Opportunity or inbox is invalid or inaccessible"
}
```

An inaccessible or nonexistent stage or board supplied as a filter does not produce this error: it produces an empty list when no visible opportunities match.

### 422 Unprocessable Entity

Invalid query values return an error such as:

```json theme={null}
{
  "error": "assignee_id cannot be combined with assignee_type"
}
```

| Field | Type | Description |
| - | - | - |
| `error` | string | Reason the request failed. Shared by the `401`, `404`, and query-validation `422` models above. |

## Validation rules

* `page`, `per_page`, and supplied ID filters must be positive integers. `per_page` cannot exceed `100`.
* `status`, `assignee_type`, and `sort_by` must use the accepted values above.
* Boolean filters accept only `true` and `false`.
* `assignee_id` cannot be combined with `assignee_type=me`, `assigned`, or `unassigned`.
* Date bounds must be ISO 8601 timestamps with a timezone, and paired bounds must form a non-empty interval.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.