{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ploid/json-schema/ploid-enrich-request-schema.json",
  "title": "EnrichRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ploid-enrichment-api-openapi.yml#/components/schemas/EnrichRequest",
  "oneOf": [
    {
      "$ref": "#/$defs/EnrichLegacyRequest"
    },
    {
      "$ref": "#/$defs/EnrichContactRequest"
    }
  ],
  "$defs": {
    "EnrichContactRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "fields"
      ],
      "properties": {
        "linkedin_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https?://(?:[^/]+\\.)?linkedin\\.com/in/[^/?#]+/?(?:[?#].*)?$"
        },
        "person_id": {
          "type": "string",
          "description": "Permanent Ploid person id."
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "Reverse contact lookup anchor."
        },
        "name": {
          "type": "string"
        },
        "company_domain": {
          "type": "string",
          "pattern": "^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,63}$"
        },
        "first_name": {
          "type": "string"
        },
        "last_name": {
          "type": "string"
        },
        "fields": {
          "type": "array",
          "minItems": 1,
          "maxItems": 3,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "enum": [
              "work_email",
              "personal_email",
              "phone"
            ]
          }
        },
        "response_format": {
          "const": "standard"
        }
      },
      "oneOf": [
        {
          "required": [
            "linkedin_url"
          ]
        },
        {
          "required": [
            "person_id"
          ]
        },
        {
          "required": [
            "email"
          ]
        },
        {
          "required": [
            "name",
            "company_domain"
          ]
        }
      ]
    },
    "EnrichLegacyRequest": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "linkedin_url"
      ],
      "properties": {
        "linkedin_url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https?://(?:[^/]+\\.)?linkedin\\.com/in/[^/?#]+/?(?:[?#].*)?$"
        },
        "first_name": {
          "type": "string"
        },
        "last_name": {
          "type": "string"
        },
        "enrichments": {
          "type": "array",
          "minItems": 1,
          "maxItems": 3,
          "default": [
            "profile"
          ],
          "items": {
            "type": "string",
            "enum": [
              "profile",
              "linkedin_profile",
              "email",
              "phone"
            ]
          }
        },
        "response_format": {
          "type": "string",
          "enum": [
            "standard",
            "markdown"
          ],
          "default": "standard"
        }
      }
    }
  }
}