Skip to content

opportunity

Create an opportunity

POST/v1/opportunities

Creates a new opportunity for a client in the caller's tenant, always at status active, owned by the signed-in caller. stageId takes priority over stage (a name, matched case-insensitively); with neither, the workspace's default pipeline stage is used, or its first stage when no default is set. A stageId that is not one of the workspace's active stages answers conflict and creates nothing. value sets the total and the services forecast together; the three forecastedValue fields set the services, products and recurring forecasts on their own, and value cannot be combined with forecastedValueServices. Every amount is in the workspace's current currency. A client id outside the tenant, archived, or that does not exist answers not_found, as does a contactId that does not belong to the given client, a siteId that is not an active site of that client, and a billing or shipping contact outside the tenant. customFields can only be set from a signed-in session. Creating an opportunity starts the workspace's opportunity-created workflows and, when the client is linked to ConnectWise, queues the opportunity for ConnectWise; connectwiseWriteBack says what was queued, and names a refusal when ConnectWise would reject the opportunity for lacking a sales rep or a synced contact. record is the full opportunity for a signed-in caller and null for an API key.

Parameters

NameInRequiredTypeDescription
Idempotency-KeyheaderYesstringOpaque idempotency key, at most 255 characters, scoped to (tenant, principal, operation). A missing key is validation_failed.

Request body

  • clientId (required): string
  • name (required): string
  • value: number
  • stageId: string
  • stage: string
  • description: string
  • contactId: string
  • siteId: string
  • billingContactId: string
  • shippingContactId: string
  • probability: integer
  • forecastedValueServices: number
  • forecastedValueProducts: number
  • forecastedValueRecurring: number
  • expectedCloseDate: string
  • businessUnit: string
  • source: string
  • decisionCriteria: string
  • timelineNotes: string
  • notes: string
  • tags: array
  • customFields: object

Responses and errors

  • 200

    Create an opportunity

    • opportunity (required): object
    • record (required): object
    • connectwiseWriteBack (required): object
  • 202

    Error envelope. `error.code` carries the typed outcome and `error.type` resolves to its description.

    • ApprovalRequiredError:
    • allOf: ErrorEnvelope
  • 400

    Error envelope. `error.code` carries the typed outcome and `error.type` resolves to its description.

    • ValidationFailedError:
    • allOf: ErrorEnvelope
  • 401

    Error envelope. `error.code` carries the typed outcome and `error.type` resolves to its description.

    • UnauthorizedError:
    • allOf: ErrorEnvelope
  • 403

    Error envelope. `error.code` carries the typed outcome and `error.type` resolves to its description.

    • ForbiddenError:
    • allOf: ErrorEnvelope
  • 409

    Error envelope. `error.code` carries the typed outcome and `error.type` resolves to its description.

    • ConflictError:
    • allOf: ErrorEnvelope
  • 429

    Error envelope. `error.code` carries the typed outcome and `error.type` resolves to its description.

    • RateLimitedError:
    • allOf: ErrorEnvelope
  • 503

    Error envelope. `error.code` carries the typed outcome and `error.type` resolves to its description.

    • UnavailableError:
    • allOf: ErrorEnvelope

Example

curl --request POST \
  --url 'https://api.scopable.io/v1/opportunities' \
  --header 'Authorization: Bearer $SCOPABLE_API_KEY' \
  --data '<JSON request body>'

Replace $SCOPABLE_API_KEY with a key created in Settings, API; replace the request body placeholder with JSON matching the schema above.

View the OpenAPI 3.1 source

Need help with the API? …