For the complete documentation index, see llms.txt. This page is also available as Markdown.

API - List Funnel Opportunities with Filters and Pagination

Complements the page API - API Call to List Opportunities for a Lead. While that endpoint returns all opportunities of a specific lead, this returns the opportunities of an entire funnel, with filters, implicit Kanban sorting, pagination and, above all, the ability to paginate column by column (stage by stage) through the parameter columnId.

It is the same endpoint that the CRM interface uses to build the Kanban: each column loads its own page of cards, independently of the others.

List opportunities in a funnel

POST /crm/opportunities/{funnelId}?i=suainstancia&apitoken=xxxxxx

{funnelId} = funnel ID (CRM). In the example below, 8.

Full endpoint: https://sprinthub-api-master.sprinthub.app/crm/opportunities/8?i=suainstancia&apitoken=xxxxxx

API base. https://sprinthub-api-master.sprinthub.app is the base URL. Replace suainstancia with your instance name, the same one that appears in the dashboard URL, and xxxxxx with your API key.

URL parameters

Parameter
Required
Description

i

Yes

Instance name. Example: ?i=suainstancia.

apitoken

Yes

Instance API key.

Headers

Name
Value

Content-Type

application/json

The returned opportunities respect the permissions linked to the API key (Departments, Permission Groups, and funnel permissions).


Before you start: finding the funnelId and the columnId

The funnelId of the URL is the CRM ID (funnel). To list all funnels in the instance in a single GET call:

Each returned funnel brings its ID, which is the value used in /crm/opportunities/{funnelId}, and the funnel stages, whose IDs populate the parameter columnId of the request body.

The stage IDs also appear in the field crm_column of each opportunity returned by this endpoint, which serves as a quick check.

Request body

Parameter reference

Parameter
Type
Default
Description

filterByUsers

array of integers

[]

IDs of the users responsible for the opportunities. Empty returns all responsible users visible to the session.

filterByStatus

array of strings

[]

Opportunity statuses: open, gain, lost. Accepts more than one. Empty returns all.

filterByCreateDate

object or null

null

Opportunity creation period. null turns off the filter.

filterByExpectedCloseDate

object or null

null

Expected close period. null turns off the filter.

filters

array of objects

[]

Advanced filters (combined conditions over opportunity, lead, and company fields). Empty turns off the filter.

search

string

""

Text search term. Empty turns off search.

searchBy

string

"lead"

Defines where the term of search is applied. lead searches the data of the contact linked to the opportunity.

page

integer

1

Desired page. The first page is 1.

limit

integer

25

Number of opportunities per page.

columnId

integer

-

Column ID (stage) of the funnel. Restricts the result to a single stage and paginates only within it.

onlyArchived

boolean

false

true returns only archived opportunities. false returns only non-archived ones.

Filter details

filterByUsers

Filters by the opportunity owner. Corresponds to the Owner filter in the interface.

Returns opportunities whose owner is user 12 or 47. The empty array does not mean "no owner": it means "no owner filter".

filterByStatus

Corresponds to the Status.

Value
Meaning

open

Open opportunity

gain

Won opportunity

lost

Lost opportunity

Attention. The view of won and lost opportunities depends on the permission CRM - Won and Lost Opportunities of the user's group. If the API key does not have this permission, the filter will not return these records.

filterByCreateDate and filterByExpectedCloseDate

They filter by period: opportunity creation date and expected close date, respectively. Correspond to the filters Creation date and Expected close date filter in the interface.

Send null (or omit) turns off the filter. The two filters are independent and can be combined in the same request.

filters

Receives the Advanced Filters of the CRM: conditions built over opportunity, lead, or company fields, including custom fields. Each item in the array represents a condition, and the conditions are combined with each other.

The safest way to discover the exact structure of a condition is to build it in the CRM interface and inspect the request body sent by the browser. The empty array is equivalent to "no advanced filters".

search and searchBy

search is the typed term. searchBy defines the search target. With searchBy: "lead", the term is compared with the data of the contact linked to the opportunity (name, phone, email), and not with the card title.

search empty ignores searchBy.

onlyArchived

Switches between the two base views. There is no combined view: the request either returns archived or non-archived.


Pagination by funnel column

This is the central point of this endpoint. The CRM does not paginate the funnel as a single list: each Kanban column is its own sequence of pages.

  • With columnId filled, page and limit navigate only within that stage. page: 5 with limit: 25 returns the opportunities from the 101st to the 125th position of that column, in the order they appear in the Kanban.

  • Without columnId, page and limit they navigate the entire funnel, mixing the stages.

  • The filters are applied before pagination. Changing any filter resets the count: go back to page: 1.

  • The end of the column is detected when the response returns fewer items than the limit requested, or when it returns an empty array.

Example: fifth page of column 58

Example: entire funnel, without separating by stage

Just omit columnId.

Example: won this month, from two sellers, in one stage

Example: sweep an entire column

To sweep the entire funnel stage by stage, run the function above in a loop over the funnel column IDs. This is the recommended way to export large volumes: each column is a smaller and more stable sequence than a single pagination over the whole funnel, which shifts whenever a card changes stage during the sweep.


Responses

200 OK

Each item brings crm_column the same as columnId requested, when the column filter is used.

400 Bad Request

Malformed body or funnelId nonexistent.

401 Unauthorized

apitoken missing, invalid, or lacking permission for the requested funnel.


Best practices

  • Use limit between 25 and 50 to feed interfaces. Higher values increase response time and the risk of timeout.

  • When reapplying filters, always restart page at 1.

  • Prefer paginating by columnId when the goal is to reproduce the Kanban or export the funnel in a predictable way.

  • Send all body fields, even the disabled ones ([] or null). This keeps the payload compatible with the interface and makes debugging easier by comparing it with browser requests.

  • The results always respect the API key permissions. Two different keys may receive different counts for the same filters.

Last updated

Was this helpful?