API · v1 · estable
CODEMETA OSDeveloper Center
ES
Abrir la consola
Entidad · opportunities

Opportunity Schema

ID del esquema
opportunity
Colección
opportunities
Permisos
  • Leeropportunity_view
  • Crearopportunity_create
  • Modificaropportunity_edit
  • Eliminaropportunity_delete

Campos

Opportunity Schema

opportunities4 permisos

Schema for validating sales opportunity entities

titlestringobligatorio

Opportunity title

1–300 caracteres
descriptionstringopcional

Detailed description (plain text)

máx. 5000 caracteresadmite null
descriptionHtmlstringopcional

Rich text HTML version of the opportunity description

admite null
statusstringobligatorio

Pipeline status (tenant-configurable)

prioritystringopcional

Opportunity priority level

LOWNORMALHIGHCRITICAL
Valor por defecto: "NORMAL"
pipelineIduuidopcional

Sales pipeline UUID (references sales_pipelines collection)

admite null
partyIduuidopcional

Customer party UUID

admite null
partyAddressIduuidopcional

Specific site/address of the associated party

Valor por defecto: nulladmite null
contactPartyIduuidopcional

Contact person UUID

admite null
assignedToIduuidopcional

Assigned sales rep user UUID

admite null
orgUnitIduuidopcional

Organization unit UUID

admite null
valuestringopcional

Deal value / CLV (Decimal128 as string, synced with customerLifetimeValue)

Patrónadmite null
onetimeRevenuestringopcional

One-time revenue (hardware, projects, migrations)

Patrónadmite null
monthlyRecurringstringopcional

Monthly recurring revenue (MRR)

Patrónadmite null
contractDurationMonthsnumberopcional

Minimum contract duration in months

1 – 120admite null
estimatedLifetimeMonthsnumberopcional

Estimated customer lifetime in months (manual override; auto-calculated from party churn data or tenant default if null)

1 – 600admite null
annualRecurringRevenuestringopcional

ARR = MRR × 12

Patrónadmite null
totalContractValuestringopcional

TCV = onetime + (MRR × contractDurationMonths)

Patrónadmite null
customerLifetimeValuestringopcional

CLV = onetime + (MRR × estimatedLifetimeMonths)

Patrónadmite null
weightedValuestringopcional

Weighted value = CLV × (probability / 100)

Patrónadmite null
currencyCodestringopcional

ISO 4217 currency code

máx. 3 caracteresValor por defecto: "EUR"
probabilitynumberopcional

Win probability in percent

0 – 100admite null
expectedCloseDatedateopcional

Expected close date (YYYY-MM-DD)

admite null
dueDatedateopcional

Due date — act on the opportunity by this day (YYYY-MM-DD)

admite null
sourcestringopcional

Lead source (references opportunity_sources name)

máx. 100 caracteresadmite null
contractIduuidopcional

Linked contract UUID

admite null
projectIduuidopcional

Linked project UUID

admite null
lostReasonstringopcional

Reason for losing the opportunity

máx. 2000 caracteresadmite null
mergedIntoOpportunityIduuidopcional

If set, this opportunity was merged into the referenced opportunity

admite null
mergedIntoOpportunityNumberstringopcional

Opportunity number of the opportunity this was merged into (denormalized for display)

admite null
tagsstring[]opcional

Tags

Valor por defecto: []admite null
attachmentsobject[]opcional
Valor por defecto: []admite null
s3Keystringobligatorio
fileNamestringobligatorio
mimeTypestringobligatorio
sizeBytesnumberobligatorio
uploadedAtdatetimeobligatorio
uploadedByuuidobligatorio
isInternalbooleanobligatorio
linkedEntitiesobject[]opcional
Valor por defecto: []admite null
entityTypestringobligatorio
partyassetticketprojectuseropportunityproposalarticletaskcomplaintproblem
entityIduuidobligatorio
rolestringobligatorio
convertedToobjectopcional

Set when this opportunity was converted to another entity (ticket). The opportunity is kept — not deleted — so linked records stay reachable. Written only by the conversion routes.

solo lecturaadmite null
entityTypestringobligatorio
ticketopportunitycomplaint
entityIduuidobligatorio
convertedAtdatetimeopcional
admite null
convertedBystringopcional
admite null
convertedFromobjectopcional

Set when this opportunity was created by converting another entity (ticket). Written only by the conversion routes.

solo lecturaadmite null
entityTypestringobligatorio
ticketopportunitycomplaint
entityIduuidobligatorio
convertedAtdatetimeopcional
admite null
convertedBystringopcional
admite null
lineItemsobject[]opcional
Valor por defecto: []admite null
iduuidobligatorio
articleIduuidopcional

Article UUID (null = free-text manual position)

admite null
articleNamestringopcional

Denormalized article name at request time

admite null
articleNumberstringopcional

Denormalized article number at request time

admite null
quantitystringobligatorio

Requested quantity

Patrón
unitstringopcional

Unit label snapshot from the article (e.g. "Stk", "h")

máx. 100 caracteresadmite null
unitPricestringopcional

Quoted unit price (null = price on request)

Patrónadmite null
billingIntervalstringopcional

Billing interval — drives MRR/onetime auto-calculation. Null is treated as ONE_TIME.

nullONE_TIMEMONTHLYYEARLY
admite null
currencyCodestringopcional

ISO 4217 currency code

máx. 3 caracteresadmite null
sourcestringopcional

Origin of the line item

nullportalmanualproposalsales_orderai
admite null
optionalbooleanopcional

Optional position — offered, but not counted into MRR/onetime. Becomes an optional quotation position (weclapp quotationItem.optional). Missing/null = false.

admite null
requestedAtdatetimeopcional

When the article was added to the opportunity

admite null
notestringopcional

Per-item note (e.g. customer remark)

máx. 1000 caracteresadmite null
alternativesobject[]opcional

Alternative positions offered alongside this line (e.g. cheaper / premium variant). Not aggregated into MRR/onetime.

Valor por defecto: []admite null
iduuidobligatorio
articleIduuidopcional
admite null
articleNamestringopcional
admite null
articleNumberstringopcional
admite null
quantitystringopcional
Patrónadmite null
unitstringopcional
máx. 100 caracteresadmite null
unitPricestringopcional
Patrónadmite null
billingIntervalstringopcional
nullONE_TIMEMONTHLYYEARLY
admite null
currencyCodestringopcional
máx. 3 caracteresadmite null
notestringopcional
máx. 1000 caracteresadmite null
risksobject[]opcional

Internal calculation risks of the offer (extra effort, delivery, price, scope)

máx. 12 elementosValor por defecto: []admite null
iduuidobligatorio
titlestringobligatorio
1–120 caracteres
detailstringopcional
máx. 500 caracteresadmite null
effectstringopcional
nullhourspricedeliveryscopeother
admite null
sourcestringopcional
nullmanualai
admite null
assumptionsstring[]opcional

Customer-facing assumptions / scope boundaries the offer is based on (one sentence each)

máx. 12 elementosValor por defecto: []admite null
statusChangedAtdatetimeopcional

Timestamp of the last status change (drives time_in_status / time_to_status targets, ADR 0117a)

admite null
inboundReplyAckedAtdatetimeopcional

Timestamp at which the latest inbound prospect email was acknowledged as "handled, no reply needed". Clears the awaiting-reply badge when >= the last inbound email time; a newer inbound email re-arms the badge. Mirrors ticket.inboundReplyAckedAt.

admite null
inboundReplyAckedBystringopcional

User who acknowledged the latest inbound prospect email (see inboundReplyAckedAt).

admite null
awaitingReplyPinnedAtdate-time[]opcional

Timestamps of unanswered inbound customer emails that were carried over by a merge and that the standard computation can no longer see. The awaiting-reply badge derives from "inbound emails newer than the last OUTBOUND email of the record" — after a merge that comparison spans two formerly independent conversations, so a reply in one thread silently marks an open question in the other as answered. The merge therefore pins the affected timestamps here; the badge counts them in addition to the computed ones. Cleared by ack-inbound-reply. Server-managed (see merge.service.ts).

admite null
snoozedUntildatetimeopcional

Opportunity is snoozed until this timestamp; hidden from active pipeline views

admite null
snoozedByuuidopcional

User who snoozed the opportunity

admite null
snoozedAtdatetimeopcional

When the opportunity was snoozed

admite null
snoozeReasonstringopcional

Reason provided when snoozing

máx. 500 caracteresadmite null
snoozeFollowUpTaskIduuidopcional

ID of the follow-up task created at snooze time (due at snoozedUntil). Cleared on unsnooze.

admite null
snoozeWokenAtdatetimeopcional

Set by the snooze-wakeup worker when snoozedUntil passed. snoozedUntil/snoozeReason stay in place so the board can flag the opportunity as "Wiedervorlage fällig" (red) until a user acts on it; it also makes the wakeup fire exactly once. Cleared on snooze/unsnooze. Absent on documents predating the field = never woken (no backfill needed).

admite null
targetsobject[]opcional

Denormalized active service targets (ADR 0117a)

admite null
stageIdstringobligatorio
stageKindstringobligatorio
time_to_first_responsetime_in_statustime_to_statustime_to_close
stageStatusstringopcional
admite null
stageLabelstringopcional
admite null
bindingnessstringobligatorio
contractualinternal
deadlinedatetimeobligatorio
breachedAtdatetimeopcional
admite null
completedAtdatetimeopcional
admite null
profileIduuidobligatorio
sourceRefobjectopcional

Provenance marker for the source system a weclapp-born opportunity was imported from (ADR 0220). The weclapp sync anchor lives in externalReferences[system="weclapp"], NOT here.

Valor por defecto: nulladmite null
systemstringobligatorio

Source system identifier (e.g. weclapp)

idstringobligatorio

Entity ID in the source system

externalReferencesobject[]opcional

Cross-system linking refs (e.g. weclapp). The weclapp entry is the identity anchor for the bidirectional opportunity sync (ADR 0220). Read/written by the inbound + outbound sync workers and indexed for duplicate prevention.

Valor por defecto: []admite null
systemstringobligatorio
máx. 100 caracteres
externalIdstringobligatorio
máx. 200 caracteres
externalVersionstringopcional
admite null
externalNumberstringopcional
máx. 200 caracteresadmite null
syncedAtdatetimeopcional
admite null
lastSyncCorrelationIdstringopcional
admite null
lastInboundHashstringopcional
máx. 64 caracteresadmite null
lastOutboundHashstringopcional
máx. 64 caracteresadmite null

Endpoints estándar

Este recurso sigue el contrato CRUD genérico de la plataforma. Lea las convenciones sobre paginación, idempotencia, bloqueo optimista y auditoría. Los endpoints principales:

  • GET /api/v1/opportunities — Lista, paginada y filtrable
  • GET /api/v1/opportunities/<id> — Una entidad
  • POST /api/v1/opportunities — Crear
  • PATCH /api/v1/opportunities/<id> — Actualización parcial
  • DELETE /api/v1/opportunities/<id> — Eliminación lógica
  • GET /api/v1/opportunities/<id>/timeline — Auditoría y actividades

Búsqueda