{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/copper-financial/main/json-schema/copper-financial-opportunity-schema.json",
  "title": "Opportunity",
  "x-generated": "2026-10-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/copper-financial-openapi.json#/components/schemas/Opportunity",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "Unique identifier for the opportunity"
    },
    "name": {
      "type": "string",
      "description": "The name of the opportunity"
    },
    "assignee_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Unique identifier of the user that will be the owner of the opportunity"
    },
    "close_date": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The expected close date of the opportunity (Unix timestamp)"
    },
    "company_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The unique identifier of the primary company with which the opportunity is associated"
    },
    "company_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "The name of the primary company with which the opportunity is associated"
    },
    "customer_source_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Unique identifier of the customer source that generated this opportunity"
    },
    "details": {
      "type": [
        "string",
        "null"
      ],
      "description": "Description of the opportunity"
    },
    "loss_reason_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "If the opportunity's status is 'Lost', the unique identifier of the loss reason that caused this opportunity to be lost"
    },
    "monetary_value": {
      "type": [
        "number",
        "null"
      ],
      "description": "The monetary value of the opportunity"
    },
    "pipeline_id": {
      "type": "integer",
      "description": "The unique identifier of the pipeline in which this opportunity is"
    },
    "pipeline_is_revenue": {
      "type": "boolean",
      "description": "The revenue type of the pipeline associated with the opportunity"
    },
    "pipeline_stage_id": {
      "type": "integer",
      "description": "The unique identifier of the pipeline stage of the opportunity"
    },
    "pipeline_type": {
      "type": "string",
      "description": "The type of the pipeline ('opportunity', 'project', or 'item') associated with the opportunity",
      "enum": [
        "opportunity",
        "project",
        "item"
      ]
    },
    "primary_contact_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "The unique identifier of the person who is the primary contact for this opportunity"
    },
    "priority": {
      "type": "string",
      "description": "The priority of the opportunity",
      "enum": [
        "None",
        "Low",
        "Medium",
        "High"
      ]
    },
    "status": {
      "type": "string",
      "description": "The status of the opportunity",
      "enum": [
        "Open",
        "Won",
        "Lost",
        "Abandoned"
      ]
    },
    "tags": {
      "type": "array",
      "description": "An array of the tags associated with the opportunity",
      "items": {
        "type": "string"
      }
    },
    "win_probability": {
      "type": "integer",
      "description": "The expected probability of winning the opportunity. Valid values are [0-100] (inclusive)",
      "minimum": 0,
      "maximum": 100
    },
    "interaction_count": {
      "type": "integer",
      "description": "The number of interactions with this opportunity"
    },
    "date_created": {
      "type": "integer",
      "description": "A Unix timestamp representing the time at which this opportunity was created"
    },
    "date_modified": {
      "type": "integer",
      "description": "A Unix timestamp representing the time at which this opportunity was last modified"
    },
    "custom_fields": {
      "type": "array",
      "description": "An array of custom field values belonging to the opportunity. When custom_field_computed_values query parameter is true, each field will include a computed_value with human-readable labels for Dropdown and Multi-select fields.",
      "items": {
        "type": "object",
        "properties": {
          "custom_field_definition_id": {
            "type": "integer",
            "description": "The id of the custom field definition for which this custom field stores a value"
          },
          "value": {
            "description": "The value (number, string, option id, or timestamp) of this custom field",
            "nullable": true
          },
          "computed_value": {
            "description": "The human-readable value of this custom field. For Dropdown/Multi-select fields, this contains the option label(s) instead of IDs. Only present when custom_field_computed_values=true is specified.",
            "nullable": true
          }
        }
      }
    }
  },
  "required": [
    "id",
    "name"
  ]
}