Search Opportunities
Find pipeline opportunities in your workspace and use a returned id with Update Opportunity.
Authentication: X-API-KEY header (see Authentication).
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | No | Case-insensitive substring of the opportunity name or description. Omit or leave blank to list all non-archived opportunities. |
id | string | No | Exact opportunity id; overrides query. Returns an empty array if no matching record is visible in your workspace. |
clientId | string | No | Only opportunities associated with this client. |
stageName | string | No | Exact stage label, case-insensitive. Unknown stages return no matches. |
status | string | No | OPEN, WON, LOST, or ARCHIVED. Invalid values return HTTP 400. ARCHIVED includes archived records without requiring includeArchived=true. |
includeArchived | boolean | No | Defaults 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:
| Data | Existing fields |
|---|---|
| Identity and details | id, accountId, name, description, value |
| Stage and archive state | statusId, archive; resolve stage labels and types with List Pipeline Stages |
| Close dates | estCloseDate, actualCloseDate (ISO dates) |
| Relationships | clientId, assignedTo (array of user ids), workflow (linked items) |
| Lead/contact data | formData, including name, email, business name, and lead source |
| Custom fields | customValues (array, using the existing custom-field format) |
| Creation and win timestamps | created, 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.