Skip to main content

Search Opportunities

GET /public/action/opportunities/search

Find pipeline opportunities in your workspace and use a returned id with Update Opportunity.

Authentication: X-API-KEY header (see Authentication).

Query parameters​

ParameterTypeRequiredDescription
querystringNoCase-insensitive substring of the opportunity name or description. Omit or leave blank to list all non-archived opportunities.
idstringNoExact opportunity id; overrides query. Returns an empty array if no matching record is visible in your workspace.
clientIdstringNoOnly opportunities associated with this client.
stageNamestringNoExact stage label, case-insensitive. Unknown stages return no matches.
statusstringNoOPEN, WON, LOST, or ARCHIVED. Invalid values return HTTP 400. ARCHIVED includes archived records without requiring includeArchived=true.
includeArchivedbooleanNoDefaults to false. Set to true to include archived opportunities, including when looking up an exact id.

Filters are combined. id overrides only query; client, stage, status, and archive filters still apply. Archived records have state ARCHIVED regardless of their stage. For active records, ClosedWon and Complete stages map to WON, ClosedLost maps to LOST, and other stages map to OPEN. Status is a search filter; the response retains the existing statusId and archive fields.

Response field conventions and syncing​

The response uses the existing opportunity schema so records can be used with the update endpoint:

DataExisting fields
Identity and detailsid, accountId, name, description, value
Stage and archive statestatusId, archive; resolve stage labels and types with List Pipeline Stages
Close datesestCloseDate, actualCloseDate (ISO dates)
RelationshipsclientId, assignedTo (array of user ids), workflow (linked items)
Lead/contact dataformData, including name, email, business name, and lead source
Custom fieldscustomValues (array, using the existing custom-field format)
Creation and win timestampscreated, wonOn

Opportunities do not store a reliable last-modified timestamp. updatedAfter and dateUpdated are not supported; poll the full result set or subscribe to opportunity create/update/delete webhooks. This endpoint does not add synthetic currency, win-probability, or expanded client/contact/user objects.

Search, then update​

curl --get "https://api.withmoxie.com/public/action/opportunities/search" \
-H "X-API-KEY: your_api_key_here" \
--data-urlencode "query=Acme"

The response is an array of full Opportunity objects, including their id, statusId, clientId, and other stored fields. No matches returns []. Review the matches before choosing which record to update; names may not be unique.

[
{
"id": "66b0f8e5c3a9e40012ab8833",
"accountId": 10016,
"name": "Acme retainer",
"statusId": "stage_proposal",
"value": 12000,
"archive": false
}
]

Use the chosen id to change only the fields you need:

curl -X PATCH "https://api.withmoxie.com/public/action/opportunities/update" \
-H "X-API-KEY: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"id":"66b0f8e5c3a9e40012ab8833","value":14000}'

PATCH preserves omitted fields. PUT replaces the whole opportunity.