Skip to content

Get opportunity field definitions

client.Opportunity.Definitions(ctx, query) (*OpportunityDefinitionsResponse, error)
GET/v1/opportunities/definitions

Returns the schema for all field and relationship definitions available on opportunities, including both system-defined and custom fields. Useful for understanding the shape of opportunity data before creating or updating records. See Fields and relationships for more details.

Required scope: opportunities:read

Rate limit category: Read

ParametersExpand Collapse
query OpportunityDefinitionsParams
IncludeArchived param.Field[bool]Optional

Include archived field and relationship definitions, and those of an archived custom object type or whose other end is one. Defaults to false.

ReturnsExpand Collapse
type OpportunityDefinitionsResponse struct{…}
FieldDefinitions map[string, OpportunityDefinitionsResponseFieldDefinition]

Map of field keys to their definitions, including both system and custom fields.

Archived bool

Whether the field definition is archived.

ArchivedAt Time

When the field definition was archived, or null if active.

formatdate-time
Description string

Description of the field, or null.

Label string

Human-readable display name of the field.

TypeConfiguration OpportunityDefinitionsResponseFieldDefinitionTypeConfiguration

Type-specific configuration (e.g. select options, currency code). A key the field type does not support is absent; a supported key with nothing set is null.

Currency stringOptional

ISO 4217 3-letter currency code. Present on CURRENCY fields, absent on every other type.

DecimalPlaces int64Optional

Number of decimal places values carry, or null when none is set. Present on NUMBER and CURRENCY fields, absent on every other type.

minimum-9007199254740991
maximum9007199254740991
HandleService stringOptional

Social platform associated with this handle field, or null when none is set. Present on SOCIAL_HANDLE fields, absent on every other type.

One of the following:
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceTwitter OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "TWITTER"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceLinkedin OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "LINKEDIN"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceFacebook OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "FACEBOOK"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleServiceInstagram OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationHandleService = "INSTAGRAM"
MultipleValues boolOptional

Whether this field accepts multiple values. Present on EMAIL, TELEPHONE and URL fields, absent on every other type.

Options []OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionOptional

Available options. Always present on SINGLE_SELECT and MULTI_SELECT fields, as an empty list when there are none. Absent on every other type.

ID string

Unique identifier of the select option.

Label string

Human-readable display name of the option.

Category stringOptional

Lifecycle group of the option, in-progress (ACTIVE) or done (COMPLETED), or null when none is set. Absent on selects whose options are not grouped.

One of the following:
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionCategoryActive OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionCategory = "ACTIVE"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionCategoryCompleted OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionCategory = "COMPLETED"
Color stringOptional

Color the option is displayed in, GRAY when none was chosen. Absent on selects whose options take no color.

One of the following:
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorRed OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "RED"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorOrange OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "ORANGE"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorYellow OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "YELLOW"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorLime OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "LIME"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorGreen OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "GREEN"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorBlue OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "BLUE"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorIndigo OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "INDIGO"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorPurple OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "PURPLE"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorCopper OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "COPPER"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColorGray OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionColor = "GRAY"
Description stringOptional

Description of the option, or null.

ForecastPercentage float64Optional

Forecast weighting of the option from 0 to 100, or null when none is set. Absent on selects whose options take no forecast.

Icon stringOptional

Icon the option is displayed with, or null when none is set. Present only on $stage.

One of the following:
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIconBacklog OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIcon = "BACKLOG"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIconQualification OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIcon = "QUALIFICATION"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIconDiscovery OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIcon = "DISCOVERY"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIconActive OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIcon = "ACTIVE"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIconNegotiation OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIcon = "NEGOTIATION"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIconClosedWon OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIcon = "CLOSED_WON"
const OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIconClosedLost OpportunityDefinitionsResponseFieldDefinitionTypeConfigurationOptionIcon = "CLOSED_LOST"
ParentID stringOptional

For a dependent select, the ID of the option in the parent field named by typeConfiguration.parentFieldKey that owns this option. Absent for ordinary selects.

ParentFieldKey stringOptional

For a dependent select, the field key whose selected option determines which of this field’s options apply. Absent for ordinary selects.

Unique boolOptional

Whether values for this field must be unique, or null when not set. Present on EMAIL, TELEPHONE, URL and SOCIAL_HANDLE fields, absent on every other type.

ValueType string

Data type of the field.

One of the following:
const OpportunityDefinitionsResponseFieldDefinitionValueTypeAddress OpportunityDefinitionsResponseFieldDefinitionValueType = "ADDRESS"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeCheckbox OpportunityDefinitionsResponseFieldDefinitionValueType = "CHECKBOX"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeCurrency OpportunityDefinitionsResponseFieldDefinitionValueType = "CURRENCY"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeDate OpportunityDefinitionsResponseFieldDefinitionValueType = "DATE"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeDatetime OpportunityDefinitionsResponseFieldDefinitionValueType = "DATETIME"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeEmail OpportunityDefinitionsResponseFieldDefinitionValueType = "EMAIL"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeFullName OpportunityDefinitionsResponseFieldDefinitionValueType = "FULL_NAME"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeMarkdown OpportunityDefinitionsResponseFieldDefinitionValueType = "MARKDOWN"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeMultiSelect OpportunityDefinitionsResponseFieldDefinitionValueType = "MULTI_SELECT"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeNumber OpportunityDefinitionsResponseFieldDefinitionValueType = "NUMBER"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeSingleSelect OpportunityDefinitionsResponseFieldDefinitionValueType = "SINGLE_SELECT"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeSocialHandle OpportunityDefinitionsResponseFieldDefinitionValueType = "SOCIAL_HANDLE"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeTelephone OpportunityDefinitionsResponseFieldDefinitionValueType = "TELEPHONE"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeText OpportunityDefinitionsResponseFieldDefinitionValueType = "TEXT"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeURL OpportunityDefinitionsResponseFieldDefinitionValueType = "URL"
const OpportunityDefinitionsResponseFieldDefinitionValueTypeHTML OpportunityDefinitionsResponseFieldDefinitionValueType = "HTML"
ID stringOptional

Unique identifier of the field definition.

AIFillable stringOptional

Whether AI fills this field automatically (ON), only suggests values (SUGGEST), or leaves it alone (OFF). Absent on built-in fields that have no id.

One of the following:
const OpportunityDefinitionsResponseFieldDefinitionAIFillableOn OpportunityDefinitionsResponseFieldDefinitionAIFillable = "ON"
const OpportunityDefinitionsResponseFieldDefinitionAIFillableOff OpportunityDefinitionsResponseFieldDefinitionAIFillable = "OFF"
const OpportunityDefinitionsResponseFieldDefinitionAIFillableSuggest OpportunityDefinitionsResponseFieldDefinitionAIFillable = "SUGGEST"
AIFillablePrompt stringOptional

Instructions AI follows when filling this field, or null when none are set. Absent on built-in fields that have no id.

Formula stringOptional

Formula a calculated field evaluates, with fields and relationships referenced by key. Null for fields that are not calculated. Absent on built-in fields that have no id.

ReadOnly boolOptional

true for fields that are not writable via the API (e.g. AI-generated summaries, calculated fields). false or absent for writable fields.

ValueSource stringOptional

Whether values are entered (MANUAL) or calculated from a formula (COMPUTED). Absent on built-in fields that have no id.

One of the following:
const OpportunityDefinitionsResponseFieldDefinitionValueSourceManual OpportunityDefinitionsResponseFieldDefinitionValueSource = "MANUAL"
const OpportunityDefinitionsResponseFieldDefinitionValueSourceComputed OpportunityDefinitionsResponseFieldDefinitionValueSource = "COMPUTED"
ObjectType string

The object type these definitions belong to (e.g. account).

RelationshipDefinitions map[string, OpportunityDefinitionsResponseRelationshipDefinition]

Map of relationship keys to their definitions. Self-referential relationships include optional directional metadata on the bare definition.

Archived bool

Whether the relationship definition is archived.

ArchivedAt Time

When the relationship definition was archived, or null if active.

formatdate-time
Cardinality string

Whether this is a has_one or has_many relationship.

One of the following:
const OpportunityDefinitionsResponseRelationshipDefinitionCardinalityHasOne OpportunityDefinitionsResponseRelationshipDefinitionCardinality = "HAS_ONE"
const OpportunityDefinitionsResponseRelationshipDefinitionCardinalityHasMany OpportunityDefinitionsResponseRelationshipDefinitionCardinality = "HAS_MANY"
Description string

Description of the relationship, or null.

Label string

Human-readable display name of the relationship, as it reads from this object type.

ObjectType string

The type of the related object (e.g. account, contact).

ID stringOptional

Unique identifier of the relationship definition.

Directions OpportunityDefinitionsResponseRelationshipDefinitionDirectionsOptional

Directional metadata for a self-referential relationship. List filters use the relationship key with :asSource or :asDestination; writes continue to use the bare key.

AsDestination OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsDestination

The current record is the destination (incoming) endpoint.

Cardinality string

Whether this endpoint direction is HAS_ONE or HAS_MANY.

One of the following:
const OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinalityHasOne OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinality = "HAS_ONE"
const OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinalityHasMany OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsDestinationCardinality = "HAS_MANY"
Label string

Human-readable display name for this endpoint direction.

AsSource OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsSource

The current record is the source (outgoing) endpoint.

Cardinality string

Whether this endpoint direction is HAS_ONE or HAS_MANY.

One of the following:
const OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinalityHasOne OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinality = "HAS_ONE"
const OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinalityHasMany OpportunityDefinitionsResponseRelationshipDefinitionDirectionsAsSourceCardinality = "HAS_MANY"
Label string

Human-readable display name for this endpoint direction.

GroupKey stringOptional

Key of the relationship group this relationship belongs to, as listed under relationshipGroupDefinitions. Absent when the relationship is not in a group.

Inverse OpportunityDefinitionsResponseRelationshipDefinitionInverseOptional

How the same relationship reads from the related object type.

Cardinality string

Whether this endpoint direction is HAS_ONE or HAS_MANY.

One of the following:
const OpportunityDefinitionsResponseRelationshipDefinitionInverseCardinalityHasOne OpportunityDefinitionsResponseRelationshipDefinitionInverseCardinality = "HAS_ONE"
const OpportunityDefinitionsResponseRelationshipDefinitionInverseCardinalityHasMany OpportunityDefinitionsResponseRelationshipDefinitionInverseCardinality = "HAS_MANY"
Label string

Human-readable display name for this endpoint direction.

RelationshipGroupDefinitions map[string, OpportunityDefinitionsResponseRelationshipGroupDefinition]

Map of relationship group keys to their definitions. A group collects relationships between the same two object types, such as the roles a contact can hold on an opportunity. Relationships name their group with groupKey.

ID string

Unique identifier of the relationship group.

Archived bool

Whether the relationship group is archived.

ArchivedAt Time

When the relationship group was archived, or null if active.

formatdate-time
Inverse OpportunityDefinitionsResponseRelationshipGroupDefinitionInverse

How the same group reads from the related object type.

Label string

Human-readable display name of the group, as it reads from the related object type.

Label string

Human-readable display name of the group, as it reads from this object type.

ObjectType string

The type of the related object every relationship in the group points to.

Get opportunity field definitions

package main

import (
  "context"
  "fmt"

  "github.com/Lightfld/lightfield-go"
  "github.com/Lightfld/lightfield-go/option"
)

func main() {
  client := githubcomlightfldlightfieldgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  opportunityDefinitionsResponse, err := client.Opportunity.Definitions(context.TODO(), githubcomlightfldlightfieldgo.OpportunityDefinitionsParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", opportunityDefinitionsResponse.FieldDefinitions)
}
{
  "fieldDefinitions": {
    "foo": {
      "archived": true,
      "archivedAt": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "label": "label",
      "typeConfiguration": {
        "currency": "currency",
        "decimalPlaces": -9007199254740991,
        "handleService": "TWITTER",
        "multipleValues": true,
        "options": [
          {
            "id": "id",
            "label": "label",
            "category": "ACTIVE",
            "color": "RED",
            "description": "description",
            "forecastPercentage": 0,
            "icon": "BACKLOG",
            "parentId": "parentId"
          }
        ],
        "parentFieldKey": "parentFieldKey",
        "unique": true
      },
      "valueType": "ADDRESS",
      "id": "id",
      "aiFillable": "ON",
      "aiFillablePrompt": "aiFillablePrompt",
      "formula": "formula",
      "readOnly": true,
      "valueSource": "MANUAL"
    }
  },
  "objectType": "objectType",
  "relationshipDefinitions": {
    "foo": {
      "archived": true,
      "archivedAt": "2019-12-27T18:11:19.117Z",
      "cardinality": "HAS_ONE",
      "description": "description",
      "label": "label",
      "objectType": "objectType",
      "id": "id",
      "directions": {
        "asDestination": {
          "cardinality": "HAS_ONE",
          "label": "label"
        },
        "asSource": {
          "cardinality": "HAS_ONE",
          "label": "label"
        }
      },
      "groupKey": "groupKey",
      "inverse": {
        "cardinality": "HAS_ONE",
        "label": "label"
      }
    }
  },
  "relationshipGroupDefinitions": {
    "foo": {
      "id": "id",
      "archived": true,
      "archivedAt": "2019-12-27T18:11:19.117Z",
      "inverse": {
        "label": "label"
      },
      "label": "label",
      "objectType": "objectType"
    }
  }
}
Returns Examples
{
  "fieldDefinitions": {
    "foo": {
      "archived": true,
      "archivedAt": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "label": "label",
      "typeConfiguration": {
        "currency": "currency",
        "decimalPlaces": -9007199254740991,
        "handleService": "TWITTER",
        "multipleValues": true,
        "options": [
          {
            "id": "id",
            "label": "label",
            "category": "ACTIVE",
            "color": "RED",
            "description": "description",
            "forecastPercentage": 0,
            "icon": "BACKLOG",
            "parentId": "parentId"
          }
        ],
        "parentFieldKey": "parentFieldKey",
        "unique": true
      },
      "valueType": "ADDRESS",
      "id": "id",
      "aiFillable": "ON",
      "aiFillablePrompt": "aiFillablePrompt",
      "formula": "formula",
      "readOnly": true,
      "valueSource": "MANUAL"
    }
  },
  "objectType": "objectType",
  "relationshipDefinitions": {
    "foo": {
      "archived": true,
      "archivedAt": "2019-12-27T18:11:19.117Z",
      "cardinality": "HAS_ONE",
      "description": "description",
      "label": "label",
      "objectType": "objectType",
      "id": "id",
      "directions": {
        "asDestination": {
          "cardinality": "HAS_ONE",
          "label": "label"
        },
        "asSource": {
          "cardinality": "HAS_ONE",
          "label": "label"
        }
      },
      "groupKey": "groupKey",
      "inverse": {
        "cardinality": "HAS_ONE",
        "label": "label"
      }
    }
  },
  "relationshipGroupDefinitions": {
    "foo": {
      "id": "id",
      "archived": true,
      "archivedAt": "2019-12-27T18:11:19.117Z",
      "inverse": {
        "label": "label"
      },
      "label": "label",
      "objectType": "objectType"
    }
  }
}