---
title: entities.leadOpptyKpi
description: Read lead oppty KPI records with the leadOpptyKpi repository, and change them with the lead oppty KPI mutations. Same records as the REST LeadOpptyKPIs entity.
canonical: https://developers.coevera.com/reference/graphql/lead-oppty-kpi/
section: graphql
verification: schema
generatedFrom: schema f155746 (2026-10-20)
publisher: Coevera
---

# entities.leadOpptyKpi

Read lead oppty KPI records with the leadOpptyKpi repository, and change them with the lead oppty KPI mutations. Same records as the REST LeadOpptyKPIs entity.

REST: [LeadOpptyKPIs](https://developers.coevera.com/reference/rest/lead-oppty-kpis.md).

## Queries

- `getById(entityId: ID!): LeadOpptyKPIEntity` Returns the record with the given id, or null when there is none. Deleted records are returned as well.
- `getByIds(entityIds: [ID!]!): [LeadOpptyKPIEntity!]!` Returns the records with the given ids; ids without a record are left out. Deleted records are returned as well.
- `getAll(limit: Int, offset: Int, filter: LeadOpptyKPIFilterInput, orderBy: [LeadOpptyKPIOrderByInput!], includeDeleted: Boolean): [LeadOpptyKPIEntity!]!` Returns the records that match the filter, paged with limit and offset.
- `getByCriteria(filter: LeadOpptyKPIFilterInput, orderBy: [LeadOpptyKPIOrderByInput!], includeDeleted: Boolean, before: String, after: String, first: Int, last: Int): LeadOpptyKPIEntityConnection` Returns the records that match the filter as a cursor-paginated connection.
- `getChangedFieldsSinceRevision(id: UUID!, revision: Int!): [UUID!]!` Returns the ids of the fields of a record that changed after the given revision. Returns an empty list for entities without change tracking.

## Mutations

- `createLeadOpptyKpi(input: CreateLeadOpptyKPIInput!, validationLevel: [ValidationLevel!]): CreateLeadOpptyKPIPayload` Create one record.
- `updateLeadOpptyKpi(input: UpdateLeadOpptyKPIInput!, validationLevel: [ValidationLevel!], sessionIdToUpdate: String): UpdateLeadOpptyKPIPayload` Update fields.
- `bulkUpdateLeadOpptyKpi(input: [CreateOrUpdateLeadOpptyKPIInput!]!, deleteInput: [DeleteLeadOpptyKPIInput!], validationLevel: [ValidationLevel!], rollbackMethod: RollbackMethod, match: MatchingInput): BulkUpdateLeadOpptyKPIPayload` Create or update many; per-item results.
- `deleteLeadOpptyKpi(input: DeleteLeadOpptyKPIInput!): DeleteLeadOpptyKPIPayload` Soft-delete.

## Types

### LeadOpptyKPIEntity (object)

KPI event of a lead or opportunity (e.g. created, qualified, won, lost or moved to another step), used in activity reporting.

- `isDeleteProtected: Boolean!` True when the record is protected against deletion because it must always exist in the space. Deleting a record that is not protected can still fail on other checks. Read-only.
- `id: ID!` Unique identifier of entity.
- `isDeleted: Boolean` Specifies if the entity is considered deleted.
- `modified: DateTime` Last modification time.
- `created: DateTime` Creation time.
- `client: ClientEntity` User who triggered the KPI event (e.g. created the lead, qualified it, won or lost the opportunity, moved the record).
- `lead: LeadEntity` Lead this KPI event relates to. Set when leadOpptyId resolves to a Lead; otherwise empty.
- `oppty: OpportunityEntity` Opportunity this KPI event relates to. Set when leadOpptyId resolves to an Opportunity; otherwise empty.
- `owner: ClientEntity` Lead/opportunity owner at the time the KPI event occurred.
- `unit: SalesUnitEntity` Sales unit the triggering user belonged to at the time of the event.
- `applicationId: ID` Application context in which the KPI event was triggered (e.g. browser, automation, third-party integration).
- `clientId: ID` Id of the user who triggered the event.
- `kpi: LeadOpptyKpiEnum!` KPI metric this event represents: CreateLeads, CreateOppty, QualifyLead, WinOppty, LoseLead, LoseOppty, LastMove or LastModified.
- `leadOpptyId: ID!` Id of the lead or opportunity the KPI event relates to.
- `ownerId: ID` Id of the lead/opportunity owner at the time of the event.
- `unitId: ID!` Id of the sales unit.
- `revision: Int` Revision when entity was lastly changed.
- `instancePermissions: [EntityPermsEnum!]! (1 args)` Permissions the current user has on this record, out of the requested ones.

### LeadOpptyKPIEntityConnection (object)

Paginated list of LeadOpptyKPI records.

- `pageInfo: PageInfo!` Pagination data for this connection.
- `edges: [LeadOpptyKPIEntityEdge]!` Contains the nodes in this connection.
- `totalCount: Int` Total number of items in the connection.

### LeadOpptyKPIEntityEdge (object)

A Relay edge containing a `LeadOpptyKPIEntity` and its cursor.

- `node: LeadOpptyKPIEntity` The item at the end of the edge
- `cursor: String!` A cursor for use in pagination

### LeadOpptyKpiEnumFilterInput (input)

Conditions on an enumeration field. Several conditions given together must all match.

- `eq: [LeadOpptyKpiEnum!]` Matches any of the listed values.
- `NOT: LeadOpptyKpiEnumFilterInput` Matches values that do not meet this condition.

### LeadOpptyKPIFilterInput (input)

Filter conditions for LeadOpptyKPI records. Conditions on different fields are combined with AND; use OR, AND and NOT for other combinations.

- `OR: [LeadOpptyKPIFilterInput!]` Matches records that meet at least one of the listed filters.
- `AND: [LeadOpptyKPIFilterInput!]` Matches records that meet all of the listed filters.
- `NOT: LeadOpptyKPIFilterInput` Matches records that do not meet this filter.
- `globalSearchQuery: String` Search term matched against the fields that the global search covers for this entity.
- `id: EntityFilterStringField` Unique identifier of entity.
- `isDeleted: Boolean` Specifies if the entity is considered deleted.
- `modified: EntityFilterDateTimeField` Last modification time.
- `created: EntityFilterDateTimeField` Creation time.
- `applicationId: EntityFilterStringField` Application context in which the KPI event was triggered (e.g. browser, automation, third-party integration).
- `clientId: EntityFilterStringField` Id of the user who triggered the event.
- `kpi: LeadOpptyKpiEnumFilterInput` KPI metric this event represents: CreateLeads, CreateOppty, QualifyLead, WinOppty, LoseLead, LoseOppty, LastMove or LastModified.
- `leadOpptyId: EntityFilterStringField` Id of the lead or opportunity the KPI event relates to.
- `ownerId: EntityFilterStringField` Id of the lead/opportunity owner at the time of the event.
- `unitId: EntityFilterStringField` Id of the sales unit.
- `revision: EntityFilterNumberField` Revision when entity was lastly changed.
- `client: ClientFilterInput` User who triggered the KPI event (e.g. created the lead, qualified it, won or lost the opportunity, moved the record). Matches records where a related record meets these conditions.
- `lead: LeadFilterInput` Lead this KPI event relates to. Set when leadOpptyId resolves to a Lead; otherwise empty. Matches records where a related record meets these conditions.
- `oppty: OpportunityFilterInput` Opportunity this KPI event relates to. Set when leadOpptyId resolves to an Opportunity; otherwise empty. Matches records where a related record meets these conditions.
- `owner: ClientFilterInput` Lead/opportunity owner at the time the KPI event occurred. Matches records where a related record meets these conditions.
- `unit: SalesUnitFilterInput` Sales unit the triggering user belonged to at the time of the event. Matches records where a related record meets these conditions.

### LeadOpptyKPIOrderByInput (input)

Sorting of LeadOpptyKPI records. Set exactly one field in each item; list several items to sort by more fields, in order of priority.

- `id: OrderByEnum` Unique identifier of entity.
- `isDeleted: OrderByEnum` Specifies if the entity is considered deleted.
- `modified: OrderByEnum` Last modification time.
- `created: OrderByEnum` Creation time.
- `client: [ClientOrderByNestedInput!]` User who triggered the KPI event (e.g. created the lead, qualified it, won or lost the opportunity, moved the record). Sorts by fields of the related record, listed in order of priority.
- `lead: [LeadOrderByNestedInput!]` Lead this KPI event relates to. Set when leadOpptyId resolves to a Lead; otherwise empty. Sorts by fields of the related record, listed in order of priority.
- `oppty: [OpportunityOrderByNestedInput!]` Opportunity this KPI event relates to. Set when leadOpptyId resolves to an Opportunity; otherwise empty. Sorts by fields of the related record, listed in order of priority.
- `owner: [ClientOrderByNestedInput!]` Lead/opportunity owner at the time the KPI event occurred. Sorts by fields of the related record, listed in order of priority.
- `unit: [SalesUnitOrderByNestedInput!]` Sales unit the triggering user belonged to at the time of the event. Sorts by fields of the related record, listed in order of priority.
- `clientId: OrderByEnum` Id of the user who triggered the event.
- `leadOpptyId: OrderByEnum` Id of the lead or opportunity the KPI event relates to.
- `ownerId: OrderByEnum` Id of the lead/opportunity owner at the time of the event.
- `unitId: OrderByEnum` Id of the sales unit.
- `revision: OrderByEnum` Revision when entity was lastly changed.

### CreateLeadOpptyKPIInput (input)

Field values of a new LeadOpptyKPI record.

- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).
- `modified: DateTime` Last modification time.
- `created: DateTime` Creation time.
- `applicationId: ID` Application context in which the KPI event was triggered (e.g. browser, automation, third-party integration).
- `clientId: ID` Id of the user who triggered the event.
- `kpi: LeadOpptyKpiEnum!` KPI metric this event represents: CreateLeads, CreateOppty, QualifyLead, WinOppty, LoseLead, LoseOppty, LastMove or LastModified.
- `leadOpptyId: ID!` Id of the lead or opportunity the KPI event relates to.
- `ownerId: ID` Id of the lead/opportunity owner at the time of the event.
- `unitId: ID!` Id of the sales unit.
- `revision: Int` Revision when entity was lastly changed.

### CreateOrUpdateLeadOpptyKPIInput (input)

Field values of a LeadOpptyKPI record to create, or to update when its id is set.

- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).
- `id: ID` Unique identifier of entity.
- `modified: DateTime` Last modification time.
- `created: DateTime` Creation time.
- `applicationId: ID` Application context in which the KPI event was triggered (e.g. browser, automation, third-party integration).
- `clientId: ID` Id of the user who triggered the event.
- `kpi: LeadOpptyKpiEnum` KPI metric this event represents: CreateLeads, CreateOppty, QualifyLead, WinOppty, LoseLead, LoseOppty, LastMove or LastModified.
- `leadOpptyId: ID` Id of the lead or opportunity the KPI event relates to.
- `ownerId: ID` Id of the lead/opportunity owner at the time of the event.
- `unitId: ID` Id of the sales unit.
- `revision: Int` Revision when entity was lastly changed.

### DeleteLeadOpptyKPIInput (input)

Id of the LeadOpptyKPI record to delete.

- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).
- `id: ID!` Unique identifier of entity.
- `leadOpptyId: ID` Id of the lead or opportunity the KPI event relates to.

### UpdateLeadOpptyKPIInput (input)

Id of a LeadOpptyKPI record and the field values to change.

- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).
- `id: ID!` Unique identifier of entity.
- `modified: DateTime` Last modification time.
- `created: DateTime` Creation time.
- `applicationId: ID` Application context in which the KPI event was triggered (e.g. browser, automation, third-party integration).
- `clientId: ID` Id of the user who triggered the event.
- `kpi: LeadOpptyKpiEnum` KPI metric this event represents: CreateLeads, CreateOppty, QualifyLead, WinOppty, LoseLead, LoseOppty, LastMove or LastModified.
- `leadOpptyId: ID` Id of the lead or opportunity the KPI event relates to.
- `ownerId: ID` Id of the lead/opportunity owner at the time of the event.
- `unitId: ID` Id of the sales unit.
- `revision: Int` Revision when entity was lastly changed.

### BulkUpdateLeadOpptyKPIPayload (object)

Result of the bulkUpdateLeadOpptyKpi mutation.

- `result: BulkUpdateResults!` Ids of the created, updated and deleted records, and the items that failed.

### CreateLeadOpptyKPIPayload (object)

Result of the createLeadOpptyKpi mutation.

- `leadOpptyKpi: LeadOpptyKPIEntity` The created record.
- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).

### DeleteLeadOpptyKPIPayload (object)

Result of the deleteLeadOpptyKpi mutation.

- `leadOpptyKpi: LeadOpptyKPIEntity` The deleted record.
- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).

### UpdateLeadOpptyKPIPayload (object)

Result of the updateLeadOpptyKpi mutation.

- `leadOpptyKpi: LeadOpptyKPIEntity` The updated record.
- `clientMutationId: String` Optional client-supplied identifier passed on a mutation input and echoed back unchanged on its payload, so a client can correlate the response with its request (Relay convention).

### LeadOpptyKpiEnum (enum)

Kind of lead or opportunity event recorded as a KPI entry; each record keeps at most one entry per kind, dated when the event last happened.

- `CreateLeads` The lead was created.
- `CreateOppty` The opportunity was created directly, not qualified from a lead.
- `QualifyLead` The lead was qualified into an opportunity.
- `WinOppty` The opportunity was won.
- `LoseLead` The lead was lost.
- `LoseOppty` The opportunity was lost.
- `LastMove` The record entered its current pipeline step (set on create and on every step change).
- `LastModified` The record was last modified.

Types several repositories share, such as `PageInfo` and the filter fields, are in the [types index](https://developers.coevera.com/reference/graphql/types.md). The [SDL](https://developers.coevera.com/graphql/schema.graphql) has the whole schema in one file.

## Example

```graphql
query FirstLeadOpptyKPIs {
  entities {
    leadOpptyKpi {
      getByCriteria(first: 3, orderBy: [{ modified: Desc }]) {
        totalCount
        edges { node { id modified } }
      }
    }
  }
}
```

```bash
curl 'https://{region}.api.coevera.com/api/v100/app/space/{space_id}/graphql/public' \
  --user "$COEVERA_API_KEY:$COEVERA_API_SECRET" \
  --header 'Content-Type: application/json' \
  --data '{"query":"query FirstLeadOpptyKPIs { entities { leadOpptyKpi { getByCriteria(first: 3, orderBy: [{ modified: Desc }]) { totalCount edges { node { id modified } } } } } }"}'
```
