Knowledge CenterAPI References

Opportunities

An Opportunity represents a sales deal in your pipeline. Opportunities can be linked to a Company and a point-of-contact Person.

Source:apiDocs/opportunity.md
MethodPathDescription
POST/rest/opportunitiesCreate a new opportunity
GET/rest/opportunities/{id}Get an opportunity by ID
GET/rest/opportunitiesList opportunities
PATCH/rest/opportunities/{id}Update an opportunity
DELETE/rest/opportunities/{id}Delete an opportunity
POST/graphqlSearch opportunities by name
POST/rest/opportunities

Create a new opportunity. Only name is required.

💡 $50,000 = 50000000000 micros. Stage values must be UPPER_SNAKE_CASE.

Body

namerequiredstring

Opportunity name

amount.amountMicrosnumber

Deal value in micros (× 1,000,000)

amount.currencyCodestring

Three-letter currency code, e.g. "USD"

stagestring

DISCOVERY · PROPOSAL · NEGOTIATION · CLOSED_WON · CLOSED_LOST

closeDatestring

Expected close date (ISO 8601)

companyIdUUID

Associated company

pointOfContactIdUUID

Primary contact person

ownerIdUUID

Workspace member who owns this record

Requestcurl
curl -X POST "https://app.usedalil.ai/rest/opportunities" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Q1 Enterprise License",
    "amount": {
      "amountMicros": 50000000000,
      "currencyCode": "USD"
    },
    "stage": "DISCOVERY",
    "closeDate": "2026-06-15T00:00:00.000Z",
    "companyId": "company-uuid",
    "pointOfContactId": "person-uuid"
  }'
GET/rest/opportunities/{id}

Get a single opportunity by UUID.

Parameters

idrequiredUUID

Opportunity ID

depthnumber

0 = record · 1 = + company, person, owner

Requestcurl
curl -G "https://app.usedalil.ai/rest/opportunities/uuid-here" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "depth=1"
GET/rest/opportunities

List opportunities with optional filtering and sorting.

Parameters

limitnumber

Records per page (default 60)

starting_afterUUID

Pagination cursor

filterstring

Filter expression URL-encode

order_bystring

Sort field and direction

Requestcurl
# Open deals sorted by close date
curl -G "https://app.usedalil.ai/rest/opportunities" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "filter=stage[not_in]:[CLOSED_WON,CLOSED_LOST]" \
  --data-urlencode "order_by=closeDate[AscNullsLast]"
PATCH/rest/opportunities/{id}

Update fields on an opportunity. Partial updates send only what changes.

Parameters

idrequiredUUID

Opportunity ID

Requestcurl
curl -X PATCH "https://app.usedalil.ai/rest/opportunities/uuid-here" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stage": "PROPOSAL",
    "amount": { "amountMicros": 75000000000, "currencyCode": "USD" }
  }'
DELETE/rest/opportunities/{id}

Permanently delete an opportunity.

Parameters

idrequiredUUID

Opportunity ID

Requestcurl
curl -X DELETE "https://app.usedalil.ai/rest/opportunities/uuid-here" \
  -H "Authorization: Bearer YOUR_API_KEY"

Filter Examples

filter=stage[eq]:DISCOVERY
filter=stage[not_in]:[CLOSED_WON,CLOSED_LOST]
filter=companyId[eq]:company-uuid
filter=amount.amountMicros[gt]:10000000000   # amount > $10,000
filter=closeDate[lte]:2026-06-30T23:59:59Z